Commit graph

150 commits

Author SHA1 Message Date
Leonardo de Moura
c620a2a59d feat: refine parser location 2020-09-16 17:28:09 -07:00
Leonardo de Moura
0abca5475f refactor: move ppExpr to IO
@Kha I am also tracking `currNamespace` and `openDecls`.

BTW, I also tried an experiment where I added `currNamespace` and
`openDecls` to `Meta.Context`, but it looked weird. This information
is only needed in the elaborator and pretty printer.
The `PPContext` object should contain everything you need. You
can put `currNamespace` and `openDecls` in the `Delaborator.Context`.
2020-09-15 18:48:21 -07:00
Leonardo de Moura
3fa7e61b26 feat: add done and admit syntax 2020-09-15 10:46:40 -07:00
Leonardo de Moura
e66f6cdd6c feat: using indentation 2020-09-14 16:12:23 -07:00
Leonardo de Moura
c49ccda46a feat: add antiquotation for indentedNonEmptySeq 2020-09-14 14:57:38 -07:00
Leonardo de Moura
05e6a779ba fix: can't use maxPrec at by
If `by` uses `maxPrec`, then `have A by B ...` is parsed as
`have (A by B) ...` :(

cc @Kha
2020-09-14 14:57:14 -07:00
Leonardo de Moura
f95675dc22 feat: add have-by and show-by syntax 2020-09-14 14:25:35 -07:00
Leonardo de Moura
fc4ab139b5 feat: indented by
@Kha This one is not as useful as the indented `do`. When writing
interactive proofs I like the error message at the `}` showing the
resulting tactic state. We can simulate it using a `skip` in the end of the sequence :)
We remove the `skip` when the proof is done. Note that, the last `;`
is usually not part of the `by`. Example:
```lean
theorem ex (x y z : Nat) : y = z → y = x → x = z :=
fun _ _ =>
  have x = y by apply Eq.symm; assumption; -- <<< the last `;` is part of the `have`
  Eq.trans this (by assumption)
```
2020-09-14 14:20:02 -07:00
Leonardo de Moura
4c6a589e6c feat: indented do blocks
@Kha it is soooooo much nicer :)
2020-09-14 13:44:51 -07:00
Leonardo de Moura
3c2044f06b chore: add coercion for new frontend 2020-09-13 10:12:25 -07:00
Leonardo de Moura
151012cb39 feat: remove emptyc elaboration hack
@Kha I removed the hack. We know get a nice error message.
2020-09-11 14:41:44 -07:00
Leonardo de Moura
ba4fdce508 feat: expand helper macros 2020-09-10 14:25:07 -07:00
Leonardo de Moura
d77dc5efb8 feat: add helper syntax 2020-09-10 13:31:45 -07:00
Leonardo de Moura
232fe8cadd doc: document parser trick 2020-09-10 11:20:09 -07:00
Leonardo de Moura
20152c1192 chore: change by precedence
@Kha it now uses the same precedence of `fun`.
The main motivation is to allow us to write `@by { ... }` instead of
`@(by { ... })`.

BTW, I am considering disabling implicit lambdas for `by ...` expressions.
It is automatically "intro"ducing the implicit variables without
giving an opportunity for users to pick their names.
2020-09-10 11:17:42 -07:00
Leonardo de Moura
b24d1c2d90 feat: add .. syntax for pattern applications 2020-09-09 09:55:29 -07:00
Leonardo de Moura
cf944e32cf chore: add back support for Lean3 mixfix/reserve syntax
We have tests that rely on them :(
2020-09-07 16:40:12 -07:00
Leonardo de Moura
804ebcec16 feat: adjust mixfix syntax 2020-09-07 15:55:02 -07:00
Leonardo de Moura
7dc1b461fa chore: give a proper node to matchAlts 2020-09-04 18:42:09 -07:00
Leonardo de Moura
70c42456b9 feat: expand intro+matchAlts macro 2020-09-04 18:22:56 -07:00
Leonardo de Moura
a88b2be72a feat: add intro + funMatchAlts syntax 2020-09-04 16:32:53 -07:00
Leonardo de Moura
ef64e1c25a feat: fun+match macro
Example:
```
fun
  | 0 => true
  | _ => false
```
2020-09-04 16:23:01 -07:00
Leonardo de Moura
0883f96da0 chore: remove optional partial from 'let rec'
It will inherit the parent declaration annotation.
2020-09-02 17:02:22 -07:00
Leonardo de Moura
bda85f287c feat: in trailing command 2020-09-02 09:52:54 -07:00
Leonardo de Moura
095e07d52d chore: letrec => let rec
cc @Kha
2020-09-01 13:27:41 -07:00
Leonardo de Moura
b192293b8a feat: allow arbitrary commands (except end) in a mutual block
This is useful, for example, for having a mutual command with macros
that expand into definitions.
2020-08-31 15:37:41 -07:00
Leonardo de Moura
2563d03ae2 feat: add notFollowedBy 2020-08-31 15:37:41 -07:00
Sebastian Ullrich
75b2dc1baf refactor: simplify ppModule using new module parser 2020-08-31 15:44:58 +02:00
Sebastian Ullrich
2418d851fc feat: declarative module parser
/cc @leodemoura
2020-08-31 14:45:21 +02:00
Leonardo de Moura
e3f3a1db8f feat: add refine! tactic syntax 2020-08-30 16:00:24 -07:00
Leonardo de Moura
6f0e9452b2 chore: remove begin ... end syntax
We should use `by { ... }` from now on.

cc @Kha
2020-08-30 14:15:33 -07:00
Leonardo de Moura
0a0ca9f930 fix: funImplicitBinder 2020-08-30 08:10:58 -07:00
Leonardo de Moura
b4f938d859 chore: namedHole => syntheticHole 2020-08-30 08:04:15 -07:00
Leonardo de Moura
89e0fa1488 chore: allow ?_
Note that `?_` is not equivalent to `_`. Both do not have a name, but
`?_` is a synthetic metavariable which **cannot** be assigned by typing
constraints, and `_` is a regular metavariable.
We use `?_` to mark an anonymous hole that must be filled using tactics.

@Kha I will rename `namedHole` to `syntheticHole`
2020-08-30 07:54:34 -07:00
Leonardo de Moura
825d9643cd feat: allow structure instances as fun binder without ()
The issue is that `{ x := ... }` was being parsed as an implicit
binder, and we were getting an error at `:=`.
2020-08-30 07:35:41 -07:00
Leonardo de Moura
fc65b76331 feat: lift useful binder term syntax to tactics 2020-08-30 07:15:42 -07:00
Leonardo de Moura
a9e70a4d83 feat: intro similar to fun 2020-08-29 15:15:24 -07:00
Leonardo de Moura
af86cc801d feat: add change tactic parser 2020-08-29 08:10:55 -07:00
Leonardo de Moura
2287c7e7b3 feat: elaborate #print axioms command 2020-08-28 13:08:42 -07:00
Leonardo de Moura
cc1c9f3dfb feat: add #print axioms 2020-08-28 12:26:07 -07:00
Leonardo de Moura
76bda91ff8 feat: add evalMatch for tactics 2020-08-27 18:05:06 -07:00
Leonardo de Moura
d2f9f250db feat: add match tactic parser 2020-08-27 15:57:05 -07:00
Leonardo de Moura
546c108497 chore: revise letrec syntax 2020-08-26 10:50:32 -07:00
Leonardo de Moura
effaf64a07 feat: allow user to specify attributes letrec declarations 2020-08-26 09:57:46 -07:00
Leonardo de Moura
6a83577703 feat: letrec syntax 2020-08-26 09:33:52 -07:00
Leonardo de Moura
5ffbada3df feat: add Lean.MonadEnv, Lean.MonadError, and Lean.MonadOptions
This is the first set of polymorphic methods. I will add more later,
and keep reducing code duplication.

cc @Kha
2020-08-22 16:00:43 -07:00
Leonardo de Moura
916b395d1b chore: cleanup 2020-08-21 09:29:09 -07:00
Sebastian Ullrich
e5de32c2dd feat: auto-generate header formatter 2020-08-21 16:43:55 +02:00
Sebastian Ullrich
5f30d62d9b feat: [runParserAttributeHooks] 2020-08-21 16:38:41 +02:00
Sebastian Ullrich
14211cc932 refactor: more core 2020-08-21 15:51:37 +02:00