Commit graph

96 commits

Author SHA1 Message Date
Kyle Miller
a1c3a36433
feat: parity between structure instance notation and where notation (#6165)
This PR modifies structure instance notation and `where` notation to use
the same notation for fields. Structure instance notation now admits
binders, type ascriptions, and equations, and `where` notation admits
full structure lvals. Examples of these for structure instance notation:
```lean
structure PosFun where
  f : Nat → Nat
  pos : ∀ n, 0 < f n

def p : PosFun :=
  { f n := n + 1
    pos := by simp }

def p' : PosFun :=
  { f | 0 => 1
      | n + 1 => n + 1
    pos := by rintro (_|_) <;> simp }
```
Just like for the structure `where` notation, a field `f x y z : ty :=
val` expands to `f := fun x y z => (val : ty)`. The type ascription is
optional.

The PR also is setting things up for future expansion. Pending some
discussion, in the future structure/`where` notation could have have
embedded `where` clauses; rather than `{ a := { x := 1, y := z } }` one
could write `{ a where x := 1; y := z }`.
2024-11-30 20:27:25 +00:00
Marc Huisinga
aadf3f1d2c feat: use new structInstFields parser to tag structure instance fields 2024-11-19 09:26:58 +01:00
Kyle Miller
1d66ff8231
fix: app unexpander for sorryAx (#5759)
Fixes a long-standing bug in the the `sorryAx` app unexpander that
prevented it from applying. Now `sorry` pretty prints as `sorry`.
2024-10-18 01:44:52 +00:00
Sebastian Ullrich
6c63c9c716
feat: quotations for parser aliases (#4307)
Another papercut towards incremental `have`
2024-05-30 09:22:22 +00:00
Leonardo de Moura
995726f75f chore: fix tests 2024-03-13 21:15:48 -07:00
Joachim Breitner
b5122b6a7b feat: per-function termination hints
This change

 * moves `termination_by` and `decreasing_by` next to the function they
   apply to
 * simplify the syntax of `termination_by`
 * apply the `decreasing_by` goal to all goals at once, for better
   interactive use.

See the section in `RELEASES.md` for more details and migration advise.

This is a hard breaking change, requiring developers to touch every
`termination_by` in their code base. We decided to still do it as a
hard-breaking change, because supporting both old and new syntax at the
same time would be non-trivial, and not save that much. Moreover, this
requires changes to some metaprograms that developers might have
written, and supporting both syntaxes at the same time would make
_their_ migration harder.
2024-01-10 17:27:35 +01:00
Sebastian Ullrich
c67686132a feat: include unexpected token in error message 2023-09-12 11:42:24 +02:00
Sebastian Ullrich
8fc1af650a fix: symmetry in orelse antiquotation parsing 2023-07-28 08:36:33 -07:00
Mario Carneiro
a8d6178e19 feat: implement have this (part 2) 2023-06-02 16:19:02 +02:00
Sebastian Ullrich
4c11743f4b refactor: split paren parser, part 2 2022-11-11 13:45:41 +01:00
Mario Carneiro
32b6bd0d8b feat: empty type ascription syntax (e :) (part 2) 2022-11-07 19:10:56 +01:00
Sebastian Ullrich
1893857f15 fix: expandCDot? should create canonical syntax 2022-10-25 12:23:13 +02:00
Gabriel Ebner
fb4d90a58b feat: dynamic quotations for categories 2022-10-18 14:59:14 -07:00
Sebastian Ullrich
d7bcc271be refactor: avoid nested sequence in simpleBinder 2022-07-08 19:06:10 +02:00
Sebastian Ullrich
3a56db2812 chore: fix tests 2022-06-27 22:37:02 +02:00
Sebastian Ullrich
6f096e0f0d chore: fix tests 2022-06-16 23:33:57 +02:00
Leonardo de Moura
9290a0e9b1 chore: fix tests 2022-05-31 18:17:56 -07:00
Sebastian Ullrich
a2baf2cb96 refactor: split term/command quotations 2022-04-15 08:50:46 -07:00
Leonardo de Moura
0241d7c197 chore: fix tests 2022-04-01 11:34:50 -07:00
Leonardo de Moura
51ee6fe4f1 chore: fix test 2022-03-20 13:27:19 -07:00
Leonardo de Moura
764a1d9f51 chore: fix tests 2022-02-14 15:47:12 -08:00
Leonardo de Moura
a12ade3da4 chore: fix test 2021-10-03 17:20:16 -07:00
Leonardo de Moura
d43876ac2d chore: fix test 2021-09-21 14:54:45 -07:00
Leonardo de Moura
c93982d10c chore: disable pp.analyze for now
see #651
2021-09-07 07:51:43 -07:00
Leonardo de Moura
bbb74bfd9a feat: elaborate optional deriving after def 2021-09-03 10:22:17 -07:00
Leonardo de Moura
8a268e184b feat: update def parser with optional deriving ... 2021-09-03 09:42:17 -07:00
Daniel Selsam
0036111db9 feat: pp.analyze original mvars are not unknown 2021-08-03 09:13:18 +02:00
Daniel Selsam
c3d62c1076 chore: patch tests for pp.analyze default 2021-08-03 09:13:18 +02:00
Sebastian Ullrich
e4bf5977d9 fix: syntax pattern match against multiple identifiers 2021-06-10 18:15:40 +02:00
Sebastian Ullrich
a02c6fd3eb chore: adapt stdlib & tests 2021-05-20 15:17:36 -07:00
Sebastian Ullrich
23f0c1051c feat: improve ToString/Quote Name 2021-05-19 09:34:01 +02:00
Sebastian Ullrich
088774536e fix: syntax match: do not discard other patterns after splices 2021-05-07 16:08:10 +02:00
Leonardo de Moura
fc96a24d7b chore: improve error message 2021-05-04 19:37:24 -07:00
Sebastian Ullrich
683ecb2d65 feat: ignore unquoted identifiers in prechecked quotations 2021-04-29 13:30:09 +02:00
Sebastian Ullrich
9f0fa19237 feat: notation: unfold to prechecked quotation 2021-04-27 16:38:37 -07:00
Sebastian Ullrich
9301e05a7e feat: double-quoted quotation semantics and basic precheck hooks 2021-04-27 16:38:37 -07:00
Leonardo de Moura
1c23d68c6a feat: add (generalizing := true/false) optional attribute to match 2021-04-15 17:04:25 -07:00
Sebastian Ullrich
435431ca7e feat: hide elaboration errors from partial syntax trees by default 2021-04-13 19:24:35 +02:00
Sebastian Ullrich
1e61b7db89 fix: partial syntax tree panic
Fixes #391
2021-04-12 18:33:39 +02:00
Leonardo de Moura
7de9cfeac8 chore: fix StructInst and add mkGroupNode 2021-04-07 22:46:07 -07:00
Leonardo de Moura
fb40b5e80d chore: fix test 2021-03-12 18:07:58 -08:00
Sebastian Ullrich
18aaef4d93 chore: fix test 2021-02-11 18:45:06 +01:00
Sebastian Ullrich
1945ebd275 feat: delaborate sorryAx 2021-01-26 12:08:25 +01:00
Sebastian Ullrich
b2b78eb222 test: use printMessageEndPos for leantests 2021-01-15 16:27:59 +01:00
Sebastian Ullrich
07c7638fd7 feat: token source info antiquotations tk%$id
/cc @leodemoura
2020-12-22 13:11:04 +01:00
Sebastian Ullrich
c54f9dd8c8 feat: "slice" patterns [$x, $y, $zs,*, $w] in syntax match
/cc @leodemoura
2020-12-21 15:29:46 +01:00
Sebastian Ullrich
fdbec9101f fix: pattern reordering in syntax match 2020-12-20 13:52:25 +01:00
Sebastian Ullrich
efc2b79aba feat: as patterns in syntax match
@leodemoura no problem using the new architecture :)
2020-12-19 22:03:37 +01:00
Sebastian Ullrich
29c2023410 fix: adapt to new matchAlt syntax 2020-12-16 18:52:56 +01:00
Sebastian Ullrich
8dfa588983 feat: introduce SepArray and use it for sepBy antiquotation splices 2020-12-12 16:02:15 +01:00