Commit graph

79 commits

Author SHA1 Message Date
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
Sebastian Ullrich
9e06680541 chore: remove old antiquotations splice syntax 2020-12-12 14:57:14 +01:00
Sebastian Ullrich
a13f129312 feat: antiquotation suffix splices such as $x:k,*
/cc @leodemoura
2020-12-12 14:57:14 +01:00
Sebastian Ullrich
686a28fcc9 feat: allow do lifts inside unescaped antiquotations
/cc @leodemoura
2020-12-12 13:01:05 +01:00
Sebastian Ullrich
bf63c4c0d0 feat: make sure dynamic quotations can only be used for parsers of arity 1 2020-12-11 21:34:30 +01:00
Sebastian Ullrich
591392840c fix: accept dynamic quotations in match 2020-12-11 21:34:30 +01:00
Leonardo de Moura
9437f262af chore: fix test 2020-12-10 12:01:16 -08:00
Leonardo de Moura
ccabb59e88 chore: fix test 2020-12-10 11:50:12 -08:00
Leonardo de Moura
2463371a25 chore: fix test 2020-12-04 18:13:36 -08:00
Leonardo de Moura
8dbbe37d38 chore: fix test 2020-12-04 16:22:45 -08:00
Sebastian Ullrich
d7f27a140e feat: antiquotation scopes 2020-12-04 19:24:32 +01:00
Leonardo de Moura
2120883307 refactor: heterogeneous operators
@Kha I had some unexpected surprises, but it is a good change.
Here is the summary.

1- We could get rid of `a %ₙ b` and `ModN` class. We can use `HMod`
instead. It was a positive surprise since I didn't remember we had
this `ModN` class.

2- Coercions are never used in heterogeneous operators. This is
expected since `a * b` is now notation for `HMul.hMul a b`, and
`a` and `b` may have different types. I manually added instances such
as `HMul Nat Int Int`. However, I did not try to add generic instances
such as
```
instance [Coe a b] [Mul b] : HMul a b b where
  hMul x y := mul (coe x) y
```
I will try later.

3- Give `h : cs.size > 0`, I got a type error at
```
let idx : Fin cs.size := ⟨cs.size - 1, Nat.predLt h⟩
```
`Nat.predLt h` has type `Nat.pred cs.size < cs.size`
However, `Nat.pred cs.size` doesn't unify with `cs.size - 1`.
The problem is that we can't synthesize the `HSub` instance until
we apply the default instances.
It worked before because `isDefEq` would force the pending TC
problem `Sub Nat` to be resolved, and after that we would be able
to reduce `cs.size - 1` and establish that it is definitionally
equal to `Nat.pred cs.size`.
I considered two possible workarounds
a) `let idx : Fin cs.size := ⟨cs.size - (1:Nat), Nat.predLt h⟩`
b) `let idx : Fin cs.size := ⟨cs.size - 1, by exact Nat.predLt h⟩`
The first one works because we are not providing enough information
for synthesizing the `HSub` instance. The second works because it
postpones the elaboration of `Nat.predLt h`. The default instances
will be applied before we start applying tactics.

4- The `.` notation is affected too. For example, `(x + 1).toUInt8`
doesn't work since we don't know the type of `x+1` until we apply
default instances. I fixed it by using `(x + (1:Nat)).toUInt8`.
Another possible fix is `Nat.toUInt8 (x + 1)`.
Similarly, `(x+1).fold ...` doesn't work.

5- The following code failed to be elaborated
```
indent (push s!"{ss'}\n") (some (0 - Format.getIndent (← getOptions)))
```
It was working before, but it relied on how the expected type is
propagated. The elaborator process
```
some (0 - Format.getIndent (← getOptions))
```
with expected type `(Option Int)`. So, the `-` is interpreted as
`Int.sub` although `Format.getIndent (← getOptions)` has type `Nat`.
In the new `HSub`, the expected type doesn't really influence TC
resolution since it is an `outparam`. So, we failed with the error
failed to synthesize `HSub Nat Nat Int`.
One possible fix was to add the instance `HSub Nat Nat Int` with
`Int.sub`, but I used the following fix
```
some ((0 : Int) - Format.getIndent (← getOptions))
```
which makes it clear that we want the `Int.sub` operator instead of
`Nat.sub`.
2020-12-01 14:02:46 -08:00
Sebastian Ullrich
0242b0e1eb fix: test 2020-12-01 12:05:54 -08:00
Leonardo de Moura
1e84fa1eed refactor: more general OfNat, remove One and Zero classes 2020-12-01 07:49:52 -08:00
Leonardo de Moura
ac85650e0a feat: add optional where clause at declarations
closes #191

@Kha Note that it expands into a "let rec".
There are many other places where an optional `where`-clause is
useful. We can add them later. It is relatively easy to add support in
other places using the new helper functions
`expandWhereDeclsOpt` and `expandMatchAltsWhereDecls`
2020-11-23 12:04:51 -08:00
Leonardo de Moura
909969a7c2 chore: fix test 2020-11-19 09:25:13 -08:00
Leonardo de Moura
d30e96bc7d chore: fix tests 2020-11-11 19:09:23 -08:00
Leonardo de Moura
dbf99a17b6 chore: define notation using infix commands 2020-11-11 08:26:12 -08:00