Commit graph

18223 commits

Author SHA1 Message Date
Sebastian Ullrich
44ce73ced9 refactor: call generated boxed wrapper instead of reinventing it in the interpreter 2019-12-05 13:21:08 +01:00
Sebastian Ullrich
e3e50b7940 chore: rename confusing interpreter function 2019-12-05 13:21:08 +01:00
Sebastian Ullrich
3e46b8a8a4 test: simplify meta2.lean 2019-12-05 13:21:08 +01:00
Sebastian Ullrich
92380ec5bd feat: implement MetaHasEval for MetaM 2019-12-05 13:20:24 +01:00
Sebastian Ullrich
fde58d8fe4 feat: add Lean.MetaHasEval, rename HasEval to Lean.HasEval 2019-12-05 13:20:24 +01:00
Leonardo de Moura
3422dbca5f chore: fix tests 2019-12-04 17:25:46 -08:00
Leonardo de Moura
38861bb87e chore: update stage0 2019-12-04 17:18:18 -08:00
Leonardo de Moura
cc5a3cca29 chore: move helper modules to src/Init/Lean/Util 2019-12-04 17:17:34 -08:00
Leonardo de Moura
223b136a9e chore: update stage0 2019-12-04 17:03:42 -08:00
Leonardo de Moura
021fda2d80 chore: fix tests 2019-12-04 17:02:56 -08:00
Leonardo de Moura
f15af1df0a chore: move Lean auxiliary datatypes to src/Init/Lean/Data 2019-12-04 17:00:13 -08:00
Leonardo de Moura
827d2d7b72 chore: use mkAppN 2019-12-04 16:25:17 -08:00
Leonardo de Moura
f570d2a1c3 fix: caching condition 2019-12-04 16:14:26 -08:00
Leonardo de Moura
e3b8013c4e feat: add mkAppM
This is the generic application builder.
2019-12-04 16:12:24 -08:00
Leonardo de Moura
dacf69b2f0 chore: remove mkCApp* functions 2019-12-04 13:07:42 -08:00
Leonardo de Moura
ad54d8e024 feat: add helper functions 2019-12-04 12:43:24 -08:00
Leonardo de Moura
1784b0ee67 chore: Heq ==> HEq 2019-12-04 11:20:38 -08:00
Leonardo de Moura
07f3ff61ea chore: update stage0 2019-12-04 11:01:28 -08:00
Leonardo de Moura
5813fbb26a feat: add AppBuilder module
It is essentially a placeholder.
2019-12-04 11:00:17 -08:00
Leonardo de Moura
86279adc63 chore: add more comments, cleanup, enforce linearity 2019-12-04 09:46:26 -08:00
Leonardo de Moura
ab75062eb4 chore: avoid unnecessary complexity 2019-12-04 06:24:33 -08:00
Leonardo de Moura
7f852d1dad doc: getSubgoalsAux 2019-12-04 06:14:05 -08:00
Leonardo de Moura
1ad97e8e9e refactor: simplify code 2019-12-04 05:54:21 -08:00
Leonardo de Moura
a0a7f11faf refactor: remove unnecessary tryResolveCore from tryAnswer 2019-12-04 05:36:53 -08:00
Leonardo de Moura
1e16b31190 doc: Meta/SynthInstance.lean 2019-12-03 20:09:06 -08:00
Leonardo de Moura
2664a82c32 chore: remove old test 2019-12-03 15:06:02 -08:00
Leonardo de Moura
c164f2c049 chore: update stage0 2019-12-03 15:02:10 -08:00
Leonardo de Moura
4ce457eb51 chore: remove prototype for the new type class resolution
The code has been integrated into the `Meta` module.
2019-12-03 15:01:05 -08:00
Leonardo de Moura
e0089c89df chore: update stage0 2019-12-03 14:52:49 -08:00
Leonardo de Moura
b6dde16be5 chore: remove #synth debugging command 2019-12-03 14:51:54 -08:00
Leonardo de Moura
963063dfee chore: disable tests for type class resolution prototype 2019-12-03 14:50:14 -08:00
Leonardo de Moura
9994500284 test: add more tests 2019-12-03 14:40:38 -08:00
Leonardo de Moura
1aa398415c fix: accidental variable shadowing 2019-12-03 14:38:59 -08:00
Leonardo de Moura
bae4a5fc7c fix: use same approach used at instantiateMVars
The idea is to beta reduce whenever we instantiate `?m` at `?m xs`
with a lambda expression.
2019-12-03 14:13:04 -08:00
Leonardo de Moura
43fc18eb41 fix: incorrect local context being used to create new metavariables 2019-12-03 13:31:24 -08:00
Leonardo de Moura
a7aca58bf7 fix: missing instantiateMVars 2019-12-03 13:01:44 -08:00
Leonardo de Moura
618b22e9a1 fix: typo 2019-12-03 12:53:37 -08:00
Leonardo de Moura
98f9ec8b07 refactor: avoid code explosion generated by telescope functions 2019-12-03 12:28:54 -08:00
Leonardo de Moura
2e0b22d49d fix: MetavarContext propagation 2019-12-03 11:34:04 -08:00
Leonardo de Moura
2254da0367 test: add simple test 2019-12-03 10:42:43 -08:00
Leonardo de Moura
5adce9fa20 fix: use eta reduction at DiscrTree
@kha @dselsam

Suppose we are trying to retrieve the global instances for
`(Monad (StateM Nat))`.
During retrieval, we reducde `StateM Nat` into `fun x => StateT Nat Id x`
However, the `DiscrTree` contains an entry for `Monad (StateT * *)`.
Thus, we fail to retrieve any instance.
I fixed the particular issue by using eta reduction.
Not sure we will encounter other definitional-equality related problems .
2019-12-03 10:30:53 -08:00
Leonardo de Moura
adddea3397 feat: add etaExpandedStrict? 2019-12-03 10:30:19 -08:00
Leonardo de Moura
3c515dcd21 feat: missing methods 2019-12-03 09:09:45 -08:00
Leonardo de Moura
57f830a751 chore: fix test 2019-12-02 19:42:44 -08:00
Leonardo de Moura
833c587fa3 feat: add generate, newSubgoal, tryResolve, and simpler table
TODO: `resume`
2019-12-02 19:00:43 -08:00
Leonardo de Moura
3eabda1c4d feat: add withMCtx 2019-12-02 12:48:34 -08:00
Leonardo de Moura
028531ba9b chore: M => SynthM 2019-12-02 11:41:44 -08:00
Leonardo de Moura
798001af75 refactor: do not save/restore cache at withNewMCtxDepth 2019-12-02 11:17:20 -08:00
Leonardo de Moura
770649ce1d refactor: do not save/restore cache at "telescope" methods
@kha @dselsam FYI

The original motivation for saving/restoring the cache was not
correctness, but cache size management. When we go inside a binder
using the telescope methods, we extend the local context with new fresh
free variables, execute the action `k` using the new extended local
context, and then restore it. Any cached result containing these
fresh variables is dead after executing `k`. So, `savingCache` here
could be viewed as a "checkpoint". However, it also removes any
cached entry that does not contain the new fresh variables.
I found this inconvenient in practice, and it is the wrong choice
in a few cases. Example: we have a `forall` expr (aka arrow), and use a
telescope to go inside, and then invoke TC. If the telescope uses
`savingCache`, we lose the cached TC instance witness. This is
wasteful since the witness often doesn't even depend on the new fresh
free variables created by the telescope.
Thus, this commit removes the `savingCache` occurrences from
the "telescope" methods. Users may still manually use it if
they think it is appropriate. That is, they can write
```lean
savingCache $ forallTelescope e $ fun xs body => <code>
```
if they really want to discard any new cache entry created while
executing `<code>`.
2019-12-02 11:11:49 -08:00
Leonardo de Moura
00a5860ce6 feat: add withMVarContext
cc @dselsam @kha
2019-12-02 10:50:00 -08:00