Commit graph

570 commits

Author SHA1 Message Date
Leonardo de Moura
9984d28bb2 fix(library/init/lean/frontend): make sure new frontend works with new io monad 2019-03-16 18:24:53 -07:00
Leonardo de Moura
6d0ec3a8c9 refactor(library/init/io): implement io monad using estate monad 2019-03-16 15:34:58 -07:00
Sebastian Ullrich
e19ed79414 feat(shell/lean): pass environment to and from Lean, remove environment.mk_empty axiom
/cc @leodemoura

I didn't remove the implementation of `environment.mk_empty`, we may want to use
it in tests.
2019-03-16 19:27:16 +01:00
Leonardo de Moura
ffc3436dd6 feat(library/init/lean): remove some TODOs using the new opaque constants 2019-03-15 17:49:10 -07:00
Leonardo de Moura
0b7d987699 feat(frontends/lean, library/init/lean): opaque constants
@kha I have added support for opaque constants to the old C++ frontend,
and made sure the new frontend can still parse `library/init/core.lean`.
The kernel should enforce that opaque constants are really opaque, and
the following example should fail
```
constant x : nat := 0
theorem foo : x = 0 := rfl
```
If it doesn't, it is a bug.

Here are some remaining issues:
1- `environment.mk_empty` is currently an axiom because we cannot create
an inhabitant of an opaque type. A possible solution is to use
`option environment` instead of `environment`.

2- There is no support for opaque constants in the new
frontend. However, I modified it to handle axioms, and fixed the literal
values with decl_cmd_kind. I tried to mark some of my changes with
comments, but it is probably much easier for you to just check the
commit change list.

3- I did not add any support for automatically constructing `e`
at `constant x : t := e`. I think we can do this later
after we replace the old frontend with the new one. BTW, it took only a
few minutes to provide the inhabitants manually.
2019-03-15 17:41:44 -07:00
Leonardo de Moura
ecdb9d6df0 feat(library/init, frontends/lean): add abbreviation for abbreviation 2019-03-15 16:01:25 -07:00
Leonardo de Moura
a78c773f37 feat(library/init/lean): unsafe support in the new frontend 2019-03-15 15:49:03 -07:00
Leonardo de Moura
20ba4c4b04 feat(kernel): opaque constants
They are very similar to `theorems`, but they are never ever unfolded.
2019-03-15 15:45:06 -07:00
Leonardo de Moura
0888dee25e chore(*): meta ==> unsafe 2019-03-15 15:04:40 -07:00
Leonardo de Moura
51838aede9 refactor(library/init/lean/parser/rec): use init.fix 2019-03-12 08:31:58 -07:00
Leonardo de Moura
68ebc2a5c5 feat(library/init/data/string/basic): implement iterators using uft8 low level API 2019-03-12 06:56:05 -07:00
Leonardo de Moura
a1cbd39d74 feat(library/init/lean/extern): remove restriction from expand_extern_pattern 2019-03-10 11:42:39 -07:00
Leonardo de Moura
4828df1c7a chore(library/init/lean/frontend): revert 4333ab620
The specializer has been fixed. So, we don't need this workaround
anymore.
2019-03-08 12:06:49 -08:00
Leonardo de Moura
baec9a1b78 chore(library/init/lean/compiler/ir): minor 2019-03-08 09:14:54 -08:00
Sebastian Ullrich
d0929c93cd perf(library/init/lean/frontend): make file_map construction explicit, do it only once 2019-03-08 17:17:27 +01:00
Sebastian Ullrich
4333ab620c refactor(library/init/lean/frontend): use direct unbounded recursion instead of iterate_eio 2019-03-08 17:04:46 +01:00
Sebastian Ullrich
e0bbc094ad chore(library/init): remove coroutines from stdlib 2019-03-08 15:34:17 +01:00
Sebastian Ullrich
234e4d1e8a refactor(library/init/lean/elaborator): replace coroutines with explicit state 2019-03-08 15:23:01 +01:00
Leonardo de Moura
db6f08e66d feat(library/init/lean/compiler/ir): collect fnbody free variables 2019-03-07 15:37:45 -08:00
Leonardo de Moura
27028309a3 feat(library/init/lean/kvmap): add == for kvmap 2019-03-07 14:12:10 -08:00
Leonardo de Moura
a836bcc204 feat(library/init/lean/compiler/ir): alpha equivalence 2019-03-07 13:50:35 -08:00
Sebastian Ullrich
81615fc856 refactor(library/init/lean/parser/module): replace coroutines with explicit snapshot state 2019-03-07 10:32:28 -08:00
Leonardo de Moura
0d4da4bc76 fix(library/init/lean/elaborator): borrow annotations
@kha I see you found this problem too :)
2019-03-07 10:26:40 -08:00
Leonardo de Moura
819d17ebbd chore(library/init/lean/compiler/ir): use has_beq 2019-03-07 10:21:14 -08:00
Leonardo de Moura
626d155c81 feat(library/init/lean/compiler/ir): alpha eqv for lean.ir.expr 2019-03-07 10:21:14 -08:00
Sebastian Ullrich
0e01871182 fix(library/init/lean/elaborator): re-add borrow annotations 2019-03-07 15:51:40 +01:00
Sebastian Ullrich
430fb81f69 fix(library/init/lean/parser/term,frontends/lean/builtin_exprs): @& should have higher rbp than -> 2019-03-07 14:35:25 +01:00
Sebastian Ullrich
a37dd02a41 perf(library/init/lean/frontend): do not hold on to outputs (syntax trees etc.) by default 2019-03-07 12:56:48 +01:00
Sebastian Ullrich
6f83faaee0 perf(library/init/lean/parser/command): index command parsers by first token 2019-03-07 11:28:42 +01:00
Leonardo de Moura
515556a718 feat(library/init/lean/compiler/ir): add new terminal: unreachable 2019-03-06 17:00:50 -08:00
Leonardo de Moura
d0c1c40cc1 feat(library/init/lean/compiler/ir): started alpha equivalence
I will continue this module later, after I fix a bug in the compiler
exposed by these new functions.
2019-03-06 12:32:30 -08:00
Leonardo de Moura
50476328ff feat(library/init/lean/name): add name_map 2019-03-06 12:32:08 -08:00
Sebastian Ullrich
ed4a0d904d feat(library/init/lean/elaborator): make meta, remove max_commands 2019-03-06 16:26:21 +01:00
Leonardo de Moura
5e39a711fc chore(init/lean/ir): remove old IR 2019-03-06 07:04:47 -08:00
Leonardo de Moura
6defbf82bd feat(library/init/lean/compiler/ir): add meta data, fix names and declarations
cc @kha
2019-03-06 06:56:16 -08:00
Sebastian Ullrich
cfce916438 perf(library/init/lean/parser/module): make sure commands_aux is tail-recursive 2019-03-06 13:58:26 +01:00
Sebastian Ullrich
85bc52b9f2 feat(library/init/lean/frontend): profile frontend 2019-03-06 11:08:38 +01:00
Sebastian Ullrich
f2a161e5a9 feat(library/init/lean/util): Lean API for profiler 2019-03-06 10:37:38 +01:00
Leonardo de Moura
ed4cd39d59 feat(library/init/lean/compiler/ir): new IR for Lean
It is currently implemented in C++. The plan is to move the procedures
for inserting inc/dec, reset/reuse, and inferring borrow inferences to
Lean. Another goal is to make sure new IR optimizations can be
implemented in Lean, and to avoid backend optimizations that would
have to be duplicated in each backend (e.g., `emit_proj_inc_reset_seq`
at `emit_cpp.cpp`).

cc @kha
2019-03-04 16:46:10 -08:00
Leonardo de Moura
3f50df70bc perf(library/init/lean/name): use hash code to speedup name.quick_lt
We use the same trick in the C++ version of this function.

I measured the impact using `lean --new-frontend core.lean` and checking
the number of instructions executed reported by Valgrind.
Before:  4,891,642,264
After:   4,847,313,330
2019-03-04 12:48:06 -08:00
Leonardo de Moura
e84f7744c3 feat(library/init/lean/compiler/const_folding): const fold nat.succ and char.of_nat 2019-02-16 11:15:19 -08:00
Leonardo de Moura
61274c7d35 feat(library/init/data/char): use uint32 instead of nat for defining char 2019-02-15 18:07:55 -08:00
Leonardo de Moura
e0fd89e165 feat(library/init/lean/compiler): fold nat predicates 2019-02-15 16:17:16 -08:00
Leonardo de Moura
0cb3ac683d feat(library/compiler): connect new const_folding module implemented in Lean with csimp 2019-02-15 14:37:48 -08:00
Leonardo de Moura
6785ad9844 fix(library/init/lean/default): missing file 2019-02-14 15:21:53 -08:00
Leonardo de Moura
390c9009f7 chore(shell,boot): update boot, and initialization process 2019-02-14 14:49:16 -08:00
Leonardo de Moura
68e8aa8d1d feat(library/init/lean/compiler): add constant folding helper functions 2019-02-14 14:35:10 -08:00
Leonardo de Moura
5e7308d22d chore(library/init/lean/expr): get_app_fn 2019-02-14 14:12:25 -08:00
Sebastian Ullrich
587a7a001a feat(library/init/lean/elaborator): to_pexpr: support string literals 2019-02-14 14:07:05 -08:00
Sebastian Ullrich
dbc470d7e4 feat(library/init/lean/{parser/term,elaborator}): support @& borrowed annotations 2019-02-14 14:07:05 -08:00