Commit graph

14176 commits

Author SHA1 Message Date
Sebastian Ullrich
ab046db6ed feat: prettify mvars somewhat 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
650e836ab3 fix: pp internal names 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
607227dc7f feat: delaborator: tolerate ill-typed terms (such as IR) 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
4d2efd4d08 fix: HasOrelse (DelabM _) 2020-09-17 08:12:28 -07:00
Leonardo de Moura
a2e8a41f33 feat: rewrite tactic parser 2020-09-16 17:43:44 -07:00
Leonardo de Moura
c620a2a59d feat: refine parser location 2020-09-16 17:28:09 -07:00
Leonardo de Moura
b37158f4f8 fix: apply 2020-09-16 16:18:30 -07:00
Leonardo de Moura
9f5e63cd3c feat: add option pp.macroStack
@Kha I set it to `false` by default.
2020-09-16 15:29:28 -07:00
Leonardo de Moura
965a989dc2 fix: must log at evalCommand
Some macros expand a command into multiple commands. We should not
interrupt the elaboration of the command sequence when one fails.
2020-09-16 14:55:58 -07:00
Leonardo de Moura
0421f37eee fix: lean4 support for exports in the old frontend 2020-09-16 14:16:03 -07:00
Leonardo de Moura
751db760d5 fix: sanitizeNames
A macro scoped name cannot shadow a name without macro scopes.
2020-09-16 13:54:30 -07:00
Leonardo de Moura
e10cd085f4 feat: use sanitizeNames at ppGoal 2020-09-16 13:39:06 -07:00
Leonardo de Moura
0e3a296fba feat: use is_inaccessible_user_name in old pretty printer 2020-09-16 13:10:42 -07:00
Leonardo de Moura
18a7f5a489 feat: new name sanitizer 2020-09-16 11:57:55 -07:00
Leonardo de Moura
e88e398642 fix: multiple occurrences of named holes
@Kha I added a new test with the scenarios we discussed this morning.
2020-09-16 10:27:30 -07:00
Leonardo de Moura
f2835207a8 refactor: move isDefEqGuarded helper 2020-09-16 10:15:47 -07:00
Leonardo de Moura
4ebf1356d7 feat: add MetavarContext.findUserName? 2020-09-16 10:14:59 -07:00
Leonardo de Moura
d00dc1988a fix: isWellFormed 2020-09-16 10:14:47 -07:00
Leonardo de Moura
d81f1c585b fix: incorrect default configuration 2020-09-16 08:26:41 -07:00
Leonardo de Moura
544d2f4ce5 fix: kind for type metavariable
For example, `mkFreshExprMVar none MetavarKind.synthetic` should
create a fresh synthetic metavariable `?m` with type `?t` where `?t`
is a fresh natural metavariable. If users want a synthetic
metavariable `?t`, then it must create it themselves.
2020-09-16 08:24:15 -07:00
Leonardo de Moura
b52ce76222 feat: display uncaught internal exceptions 2020-09-16 08:23:12 -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
c8a4252461 refactor: move OpenDecl to Data 2020-09-15 16:53:53 -07:00
Leonardo de Moura
1ce80d5ba7 feat: hide auxiliary declarations 2020-09-15 16:50:16 -07:00
Leonardo de Moura
c4c1a3fc8d chore: make it clear the free variable dependency 2020-09-15 16:39:17 -07:00
Leonardo de Moura
19a7927f10 feat: sanitizeNames
@Kha I am using `_shadowed.<idx>` suffix for marking variables that
have been shadowed. It is a bit verbose, but at least it is easy to
understand understand error messages such as
```
shadow.lean:4:0: error: type mismatch
  h
has type
  x._shadowed.1 = x._shadowed.1
but it is expected to have type
  x = x
```
It is better than the old cryptic version
```
shadow.lean:4:0: error: type mismatch
  h
has type
  x = x
but it is expected to have type
  x = x
```
2020-09-15 16:28:50 -07:00
Leonardo de Moura
9af6264aad fix: do not fail if target is not found 2020-09-15 15:06:35 -07:00
Leonardo de Moura
4e99b19a96 fix: expandMatchDiscr cannot be a macro
The `matchType` created by the macro is bad for dependent pattern
matching. The `tst8` and `tst9` at `matchTac` failed to be elaborated
when using the macro.
2020-09-15 13:29:28 -07:00
Leonardo de Moura
e7f2d7af0b chore: remove default main name 2020-09-15 10:46:40 -07:00
Leonardo de Moura
232378070f feat: parentTag propagation for apply 2020-09-15 10:46:40 -07:00
Leonardo de Moura
177c00a895 feat: case tactic should reset tag 2020-09-15 10:46:40 -07:00
Leonardo de Moura
52d6fbb906 fix: appendTagSuffix operation 2020-09-15 10:46:40 -07:00
Leonardo de Moura
b36bcf3cf1 feat: admit and done 2020-09-15 10:46:40 -07:00
Leonardo de Moura
3fa7e61b26 feat: add done and admit syntax 2020-09-15 10:46:40 -07:00
Leonardo de Moura
b44b3aeffb fix: error position for unsolved goals 2020-09-15 10:46:40 -07:00
Leonardo de Moura
b8d90d77db feat: macro scope as the single mechanism for creating fresh names
cc @Kha
2020-09-14 20:09:07 -07:00
Leonardo de Moura
fde43e071d feat: improve matchType inference 2020-09-14 19:44:45 -07:00
Leonardo de Moura
cc3b48ce16 fix: check inductive datatype parameters in constructor resulting type 2020-09-14 16:56:13 -07:00
Leonardo de Moura
634f063631 feat: finish commit "using indentation" 2020-09-14 16:40:52 -07:00
Leonardo de Moura
e66f6cdd6c feat: using indentation 2020-09-14 16:12:23 -07:00
Leonardo de Moura
a6b19cd4af feat: expand show-by and have-by macros 2020-09-14 15:08:28 -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
163b0a7a3f fix: protected
- `protected` outside of a namespace is an error.
- Fix `protected` in recursive definitions.

cc @Kha
2020-09-14 13:09:04 -07:00
Leonardo de Moura
7c0216595e fix: remove duplicate error messages due to variable(s)
In Lean4, we re-elaborate `variable`(s) for each command, but we don't
want the error messages due to `variable` to appear in the log
multiple times.
2020-09-14 12:44:25 -07:00
Sebastian Ullrich
f3ab43e453 doc: task_object state machine 2020-09-14 17:57:33 +02:00
Sebastian Ullrich
fce8ca304b fix: reintroduce code that cancels all remaining tasks on task manager shutdown 2020-09-14 17:57:33 +02:00