Commit graph

50 commits

Author SHA1 Message Date
Leonardo de Moura
c7ae8354fd feat: improve type mismatch error messages
Use heuristic to automatically annotate terms with `pp.explicit`.
2020-12-17 07:11:52 -08:00
Leonardo de Moura
04a07c15b9 chore: use deriving Inhabited 2020-12-13 11:57:59 -08:00
Leonardo de Moura
ae5aa51712 chore: add explicit discard 2020-12-08 06:18:18 -08:00
Leonardo de Moura
9d304df757 feat: heterogeneous Append experiment
@Kha This one required a bunch of manual fixes. The main issue is that
before we added the string interpolation feature, we created
`MessageData`s using `++` and coercions. For example, given
`(e : Expr)`, we would write
```
let msg : MessageData := "type: " ++ e
```
and rely on the coercions `String -> MessageData` and
`Expr -> MessageData`, and the instance `Append MessageData`.
However, heterogeneous operators "block" the expected type propagation downwards.
This kind of code is obsolete now since we can write a more compact
version using string interpolation
```
let msg := m!"type: {e}"
```
2020-12-01 16:32:41 -08:00
Leonardo de Moura
b6f242434d fix: fixes #229 2020-11-30 11:51:13 -08:00
Leonardo de Moura
0869f38de4 chore: update structure, class, inductive 2020-11-27 15:09:30 -08:00
Leonardo de Moura
d6f778bec4 refactor: arbitrary without explicit arguments
@Kha I was tired of writing `arbitrary _` :)
There 0 places in the stdlib where the type needs to be provided.
If in the future we need to specify the type we can use
`arbitrary (α := <type>)`
2020-11-25 09:07:38 -08:00
Leonardo de Moura
8f1ad0411d fix: fixes #220 and #223 2020-11-24 10:18:02 -08:00
Leonardo de Moura
5c39cd5120 chore: cleanup 2020-11-24 10:18:02 -08:00
Leonardo de Moura
ecfe590268 refactor: split Match.lean 2020-11-24 10:18:02 -08:00
Leonardo de Moura
f67c93191f feat: use |>. 2020-11-19 08:38:47 -08:00
Leonardo de Moura
c305c2691f chore: use := 2020-11-19 07:22:31 -08:00
Leonardo de Moura
49e9064202 refactor: add MatcherInfo.lean 2020-11-15 14:22:05 -08:00
Leonardo de Moura
db5fe843de chore: add expandInterpolatedStr helper function, rename msg! => m! 2020-11-14 13:52:52 -08:00
Sebastian Ullrich
3665e3b7b5 feat: pretty print match
Fixes #177
2020-11-10 10:11:24 -08:00
Leonardo de Moura
defa45ae2f feat: improve error message
when match-expression LHSs still contain metavariables after elaboration
2020-11-09 18:26:14 -08:00
Leonardo de Moura
2d2d39c78e chore: use mut 2020-11-07 17:32:13 -08:00
Leonardo de Moura
81d6e065e7 chore: adjust files and tests 2020-11-07 17:32:12 -08:00
Leonardo de Moura
6858cb5fb6 chore: cleanup 2020-10-29 10:24:16 -07:00
Leonardo de Moura
4ba21ea10c chore: cleanup src/Array/Basic.lean 2020-10-28 19:35:42 -07:00
Leonardo de Moura
5ea49c92bb chore: cleanup 2020-10-27 13:26:21 -07:00
Leonardo de Moura
13c2a8ff51 chore: remove #lang lean4 header 2020-10-25 09:54:07 -07:00
Leonardo de Moura
d89f559683 chore: fix definitions
See commit before update stage0 for explanation.
2020-10-24 07:27:25 -07:00
Leonardo de Moura
21757b2be9 feat: add helper option for fixing bootstrapping issue at src/Init/Data/Int/Basic 2020-10-23 11:13:04 -07:00
Leonardo de Moura
bebd5075fd chore: cleanup 2020-10-23 10:00:23 -07:00
Leonardo de Moura
af968c60e6 chore: cleanup 2020-10-22 07:32:23 -07:00
Leonardo de Moura
1495f403a1 chore: use builtin_initialize instead of initialize at src/Lean 2020-10-19 15:17:02 -07:00
Leonardo de Moura
ef18b0ab49 chore: use [builtinInit] 2020-10-19 14:58:38 -07:00
Leonardo de Moura
c354c3f8b1 chore: move to new frontend 2020-10-17 09:19:59 -07:00
Leonardo de Moura
deb9b570d5 chore: move to new frontend 2020-10-17 09:14:04 -07:00
Leonardo de Moura
319bbd4554 chore: move to new frontend 2020-10-17 09:09:56 -07:00
Leonardo de Moura
aeac85dadb chore: cleanup 2020-10-17 09:09:30 -07:00
Leonardo de Moura
0c1fda999e chore: cleanup 2020-10-17 09:00:05 -07:00
Leonardo de Moura
96d4c3d49b chore: move to new frontend 2020-10-17 08:54:40 -07:00
Leonardo de Moura
6a7e997534 chore: improve error message 2020-10-15 10:44:16 -07:00
Leonardo de Moura
82e11c401d fix: #eval was not capturing dbgTrace! output in pure code
In the following example, the output produced by `dbgTrace!` was not
being captured. It could break the lean server. At least, it broke the lean4-mode.
```lean
def f (x : Nat) : Nat :=
dbgTrace! ">>> " ++ toString x;
x + 1

eval f 10
```

cc @Kha
2020-10-05 10:22:04 -07:00
Leonardo de Moura
66d35cdd76 fix: the generated matcher must be able to eliminate into different universe levels 2020-09-24 19:34:14 -07:00
Leonardo de Moura
7edc52682b fix: processNonVariable 2020-09-24 17:16:50 -07:00
Leonardo de Moura
8135d37ddb feat: add MatcherApp.addArg
Helper method for adding a new (dependent) argument to a (dependent) matcher.
2020-09-22 18:56:02 -07:00
Leonardo de Moura
1256fc3cbc refactor: move MatcherInfo methods to Meta namespace 2020-09-22 16:59:21 -07:00
Leonardo de Moura
a397b3d2ae feat: add matchMatcherApp? 2020-09-22 16:54:54 -07:00
Leonardo de Moura
12aabcb731 feat: add introNP and intro1P
Versions of `introN` and `intro1` that preserve the binder name.
They are used to implement the idiom: "revert", do something, re-"intro"-tuce
Before this commit `introNP mvarId n` was `intro1 mvarId n [] false`.
2020-09-18 12:35:25 -07:00
Leonardo de Moura
a28679358e refactor: remove MonadError 2020-09-18 09:58:13 -07:00
Leonardo de Moura
f2835207a8 refactor: move isDefEqGuarded helper 2020-09-16 10:15:47 -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
b136c519e2 fix: scope and improve error message 2020-09-09 16:44:43 -07:00
Leonardo de Moura
854cc3418e feat: improve error message for dependent-match elimination failures
@Kha This is a first attempt to improve the error message for examples
like the one Andrew Kent posted on Zulip.
I created a simpler example using "vectors".
2020-09-09 13:43:06 -07:00
Leonardo de Moura
aed9b16dc8 feat: add MatcherInfo extension 2020-09-07 15:08:21 -07:00
Leonardo de Moura
fded18d114 chore: mkElim ==> mkMatcher 2020-09-07 14:33:39 -07:00
Leonardo de Moura
a12bc273bb refactor: src/Lean/Meta/EqnCompiler ==> src/Lean/Meta/Match 2020-09-07 11:09:48 -07:00