Leonardo de Moura
dca8a8ed98
fix: match or-pattern
...
This issue has been reported at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Probably.20a.20bug/near/283779934
2022-05-25 20:05:46 -07:00
Leonardo de Moura
f44a701637
chore: style
2022-05-11 15:32:18 -07:00
Sebastian Ullrich
91991649bc
fix: connect occurrences of mutable variable inside and outside for in info tree
2022-05-07 15:50:26 -07:00
Sebastian Ullrich
22f8ea147c
fix: propagate position information of variables in do blocks
2022-05-07 15:50:26 -07:00
Leonardo de Moura
6d926c7989
feat: macro expand match alternatives
...
see #371
This commit does not implement all features discussed in this issue.
It has implemented it as a macro expansion. Thus, the following is
accepted
```lean
inductive StrOrNum where
| S (s : String)
| I (i : Int)
def StrOrNum.asString (x : StrOrNum) :=
match x with
| I a | S a => toString a
```
It may confuse the Lean LSP server. The `a` on `toString` shows the
information for the first alternative after expansion (i.e., `a` is an `Int`).
After expansion, we have
```
def StrOrNum.asString (x : StrOrNum) :=
match x with
| I a => toString a
| S a => toString a
```
2022-03-20 14:20:13 -07:00
Leonardo de Moura
8f4d58893f
feat: update match parser
...
Support for
```
def fib (x : Nat) : Nat :=
match x with
| 0 | 1 => 1
| x+2 => fib (x+1) + fib x
```
TODO: expand `matchAlts`
2022-03-20 13:22:39 -07:00
Leonardo de Moura
8b248e2d8c
feat: elaborate for h : x in xs do ... notation
2022-03-03 19:52:26 -08:00
Leonardo de Moura
92937b3aba
feat: add for h : x in xs do ... notation
...
The idea is to have `h : x \in xs`.
This commit just adds the parser.
2022-03-03 18:27:40 -08:00
Leonardo de Moura
93b5b74b36
feat: modify notation for providing motive in "match" expressions
2022-02-14 15:36:14 -08:00
Leonardo de Moura
12e2a79170
chore: fix codebase after removing auto pure
2022-02-03 18:08:14 -08:00
Leonardo de Moura
5f74cd4968
feat: add let pat := val | elseCase do-notation
2022-02-03 15:55:03 -08:00
Mario Carneiro
5e36162f9b
fix: adapt to doHave syntax change
2022-01-03 07:55:52 -08:00
Leonardo de Moura
3856d0030c
feat: improve do notation error message for pure code
...
See #770
2021-12-13 11:08:38 -08:00
Leonardo de Moura
483f32edd8
feat: in pure code, do use assume Id monad at do notation
...
This feature produced counterintuitive behavior and confused users.
See discussion at #770 .
As pointed out by @tydeu, it is not too much work to write `Id.run <|`
before the `do` when we want to use the `do` notation in pure code.
closes #770
2021-12-10 12:55:14 -08:00
Gabriel Ebner
bfc74decde
feat: add info field to Syntax.node
2021-10-26 20:19:27 +02:00
Siddharth Bhat
3374806d0f
refactor: eliminate unused ExtractMonadResult.hasBindInst
2021-10-15 06:57:24 -07:00
Leonardo de Moura
acd21052c0
chore: remove old notation
2021-10-02 15:06:40 -07:00
Leonardo de Moura
b99f1c698b
feat: use if-then-else notation at Do.lean
...
Otherwise, the `if` in the `Do` notation will not benefit from the
improved elaborator.
2021-09-30 22:34:36 -07:00
Leonardo de Moura
d378df47d7
fix: fixes #633
2021-09-16 14:11:34 -07:00
Leonardo de Moura
a821dcbff2
chore: enforce naming convention for theorems
...
see issue #402
fix: `ElabTerm.lean`
2021-08-07 12:48:38 -07:00
Leonardo de Moura
76cc99179d
fix: fixes #370
2021-08-06 12:52:23 -07:00
Sebastian Ullrich
4a4b4c1ef4
fix: mkAtomFrom: generate synthetic position like other *From functions
...
Also consistently use binders as reference position for an elided binder type.
Before, type errors were always given extent 1, the length of the
synthetic `_` token.
2021-07-19 13:24:59 -07:00
Leonardo de Moura
953dd85c06
chore: avoid inline
2021-06-28 10:17:01 -07:00
Leonardo de Moura
ae6a28af52
chore: remove unnecessary specialize
2021-06-28 10:11:23 -07:00
Leonardo de Moura
712206f80e
refactor: add BindersUtil.lean
2021-06-28 08:44:16 -07:00
Leonardo de Moura
7e1bb3e65b
refactor: add MatchAltView.lean and PatternVar.lean
2021-06-28 08:29:47 -07:00
Sebastian Ullrich
720954d63a
perf: Lean.Elab.Do: avoid code explosion
2021-06-17 12:51:23 -07:00
Daniel Selsam
ded51882a0
feat: pp motives and misc delab fixes
2021-06-13 00:06:27 +02:00
Leonardo de Moura
b91e22af2b
fix: fixes #241
2021-05-22 19:10:07 -07:00
Leonardo de Moura
e5083f2521
fix: avoid unnecessary unfolding at do
2021-05-02 21:29:32 -07:00
Sebastian Ullrich
40b17bc364
refactor: introduce a few double-backtick quotations
2021-04-28 12:09:13 +02:00
Sebastian Ullrich
9301e05a7e
feat: double-quoted quotation semantics and basic precheck hooks
2021-04-27 16:38:37 -07:00
Leonardo de Moura
c76820a251
fix: no method lift over let
2021-04-24 19:33:55 -07:00
Leonardo de Moura
1c23d68c6a
feat: add (generalizing := true/false) optional attribute to match
2021-04-15 17:04:25 -07:00
Leonardo de Moura
36a4f337e9
fix: fixes #247
2021-04-15 12:33:45 -07:00
Leonardo de Moura
327eb1a96d
fix: ensure ill-formed if do-statements do not trigger non termination
2021-04-13 15:51:20 -07:00
Leonardo de Moura
2384826933
chore: add loop prenvention code at do-expander
2021-04-13 15:46:47 -07:00
Leonardo de Moura
1df84e3a6d
feat: allow haveDecl, sufficesDecl, letRecDecls in antiquotations
2021-03-12 17:40:16 -08:00
Leonardo de Moura
be841a7cad
chore: throwError! => throwError, throwErrorAt! => throwErrorAt
...
@Kha I marked the corresponding methods as `protected`.
I currently can't stand `throw_error`, and I am optimistic about
server highlighting feature you are working on :)
2021-03-11 11:59:45 -08:00
Leonardo de Moura
1112ab6eff
chore: use new notation
2021-03-11 11:19:33 -08:00
Leonardo de Moura
e7140959c4
chore: add elaborator for let_fun and let_delayed
2021-03-11 10:40:25 -08:00
Leonardo de Moura
164577d94e
chore: remove parser! and tparser!
...
The new macros are called "leading_parser` and `trailing_parser`.
cc @Kha
2021-03-11 09:36:58 -08:00
Leonardo de Moura
68143ca8ba
chore: trace[...]! ==> trace[...]
...
@Kha I think this one is a good change, there is no real reason for
using the `!` suffix here.
2021-03-10 18:44:43 -08:00
Leonardo de Moura
2d6b59f4bb
feat: add dummy elabForIn
2021-02-05 17:02:57 -08:00
Leonardo de Moura
3d4bc9f991
chore: provide ambient monad to forIn
2021-02-04 18:31:28 -08:00
Leonardo de Moura
53539b1dff
chore: use polymorphic method forIn
2021-02-04 18:13:01 -08:00
Leonardo de Moura
d956f0ae9f
feat: use destructTuple to compile for in notation instead of pattern matchin
2021-02-04 17:17:51 -08:00
Leonardo de Moura
d7ca646071
fix: make sure mkUnit return Syntax that is a valid term and pattern
2021-01-28 11:27:28 -08:00
Sebastian Ullrich
79107a2316
feat: copy & store whole ref range in SourceInfo
2021-01-20 16:48:50 +01:00
Sebastian Ullrich
462e1d54a3
chore: replace uses of copyInfo with automatic position copying in syntax quotations
...
We could introduce a `copyPos` alternative, but turns out we don't need it right now
2021-01-20 16:48:50 +01:00