Commit graph

11366 commits

Author SHA1 Message Date
Leonardo de Moura
1cdadba4b2 fix(library/compiler/csimp): type error
@kha This is another instance of a problem we discussed last summer.
I guess there are many more instances like this one that we are not handling.
Recall that we want to preserve types at `csimp` because we eventually
want to allow users to use equational theorems as rewriting rules during
compilation.
However, some of the transformations that `csimp` perform do not
preserve typeability in CIC.
Moreover, some of the optimizations require type inference.

I see the possible long term solutions:

1- Erase types and proofs as soon as possible. The main drawback here is
that we would have to develop an approach for translating Lean theorems
into valid rewriting rules for lambda pure. For example, the following
theorem should not be used as a rewriting rule after we erase types.
```
forall (xs : List Unit) (f : Unit -> Unit), List.map f xs = List.map id xs
```
BTW, I don't want to abandon the idea of using lemmas as rewriting rules in
the compiler.

2- Go over `csimp` and other compiler steps and make sure they work
properly even when `type_checker::infer_type` fails.
2019-06-03 17:36:40 -07:00
Leonardo de Moura
4a26f0028c chore(library/init/lean/environment): remove unnecessary function 2019-06-03 15:17:40 -07:00
Leonardo de Moura
ffbccf1ee9 fix(library/compiler): ByteArray bug 2019-06-03 15:01:16 -07:00
Leonardo de Moura
9310c807e6 feat(library/private): use environment extension in Lean
Remark: we don't need the `m_inv_map` anymore.
2019-06-03 11:50:33 -07:00
Leonardo de Moura
ed1a433d52 feat(library/init/lean/modifiers): add privatePrefix 2019-06-03 10:33:40 -07:00
Leonardo de Moura
224195a1fb feat(library/init/lean/modifiers): environment extension for private declarations 2019-06-03 10:10:00 -07:00
Leonardo de Moura
377b1ca042 chore(library/private): cleanup 2019-06-03 09:38:10 -07:00
Leonardo de Moura
cd73105dff refactor(kernel/environment,library/private,library/init/lean/environment): move main module name to header 2019-06-03 09:14:23 -07:00
Leonardo de Moura
23029cb386 chore(stage0): update 2019-06-03 08:24:53 -07:00
Leonardo de Moura
30a6a2ade8 feat(library/init/data, runtime): remove parray support from runtime, and implement them in Lean using Scala/Clojure Radix trees
The Scala/Clojure approach for persistent arrays works great with our
`reset/reuse`. We seem to be much more efficient than their
implementations because of `reset/reuse`. The new approach also seems
better than the old one implemented in the runtime, and has a few
advantages:
1- The reroot procedure used in the old approach required
synchronization for multi-threaded code, or we would need to perform
deep copies when sending `parray` objects between threads.
2- We don't need any runtime extension for the new approach.
3- The old approach used "trail lists" for undoing array updates.
This works well for bactracking search use cases, but it is bad
in use cases where we are simultaneously updating the persistent
arrays that have shared nodes.
2019-06-02 09:18:19 -07:00
Leonardo de Moura
c92fe75053 fix(library/init/lean/compiler/constfolding): Usize => USize
Camel case auto-conversion bug.
2019-06-01 09:42:22 -07:00
Leonardo de Moura
6f383ffa1d fix(runtime/object): overflow at lean::nat_mul 2019-06-01 09:23:41 -07:00
Leonardo de Moura
70c9733897 chore(stage0): update 2019-05-30 09:41:16 -07:00
Leonardo de Moura
8333e48037 chore(stage0): update 2019-05-30 09:16:09 -07:00
Leonardo de Moura
b86d9422b6 chore(library/compiler/borrowed_annotation): remove old borrow inference code 2019-05-27 21:28:22 -07:00
Leonardo de Moura
f67bc39ce4 chore(library/compiler/llnf): remove old IR compiler 2019-05-27 21:28:22 -07:00
Leonardo de Moura
51a9208ea9 chore(library/compiler): remove environment extension: llnf_code
We don't need it anymore. It was used by the old IR compiler
2019-05-27 21:28:22 -07:00
Leonardo de Moura
356a4fafcd chore(library/compiler): remove old code
@kha I am removing the old IR compiler. If there is a disaster with
the new one implemented in Lean, I will put it back.
2019-05-27 21:28:22 -07:00
Leonardo de Moura
fc0ce5b97e chore(library/aliases, frontends/lean): remove local_ref's
We don't need them since we removed parameters
2019-05-27 21:28:22 -07:00
Leonardo de Moura
9aa40e2491 chore(library/aliases): remove dead code 2019-05-27 21:28:22 -07:00
Leonardo de Moura
8c6ae127c9 chore(library/scoped_ext): remove dead code 2019-05-27 21:28:22 -07:00
Leonardo de Moura
0e8abd81bb chore(stage0): update 2019-05-25 16:35:43 -07:00
Leonardo de Moura
0f43c2e2d9 feat(library/init/data/array/basic): efficient heterogeneous Array.map
This commit also removes Array.hmap.
Motivation: I wanted to use Array.hmap as an example in the paper, but
I found it would be too distracting to explain why we had `Array.hmap`
and `Array.map`.

cc @kha
2019-05-25 16:32:59 -07:00
Leonardo de Moura
074002eb84 chore(stage0): update 2019-05-23 18:34:22 -07:00
Leonardo de Moura
5d04027050 chore(tests/playground): scripts for using old IR compiler 2019-05-23 18:33:29 -07:00
Leonardo de Moura
f72d54c2a0 chore(shell/lean): set new IR compiler as the default 2019-05-23 18:27:41 -07:00
Leonardo de Moura
c6f717e55b chore(stage0): update 2019-05-23 18:20:12 -07:00
Leonardo de Moura
bf3575a316 feat(library/init/lean/compiler/ir): improve expandresetreuse 2019-05-23 17:23:50 -07:00
Leonardo de Moura
f9f4e6c14b feat(library/init/lean/compiler/ir): add expandresetreuse 2019-05-23 08:58:16 -07:00
Leonardo de Moura
aede2476de chore(stage0): update
We changed the IR representation, and the C++ code interacts with both
stage0 and stage1.
2019-05-23 08:22:36 -07:00
Leonardo de Moura
013f0c9edb feat(library/init/lean/compiler/ir/rc): missing optimization 2019-05-22 18:46:43 -07:00
Leonardo de Moura
6bed0ca5b5 chore(library/compiler): style 2019-05-22 18:46:37 -07:00
Leonardo de Moura
3e76e43843 fix(library/init/lean/compiler/ir/borrow): visit join point body 2019-05-22 17:31:56 -07:00
Leonardo de Moura
fe0141918a fix(library/init/lean/compiler/ir) bug at addDecAfterFullApp 2019-05-22 16:30:42 -07:00
Sebastian Ullrich
29623cd2c5 fix(shell/lean): --cpp on stand-alone files 2019-05-22 23:23:30 +02:00
Leonardo de Moura
a570e35161 chore(stage0): update 2019-05-22 11:45:58 -07:00
Leonardo de Moura
2408d6dd80 fix(library/init/lean/compiler/ir/boxing): created boxed version for externs 2019-05-22 10:56:51 -07:00
Leonardo de Moura
fa3079f04e chore(stage0): update 2019-05-22 10:36:36 -07:00
Leonardo de Moura
4d2837430a fix(library/compiler/emit_cpp): tail call
Add temporary hack to fix `emit_tail_call`.
TODO: find a cleaner solution for the new IR compiler.
2019-05-21 23:07:10 -07:00
Leonardo de Moura
f1fbe5cd61 feat(library/compiler/ir): add boxed version for extern constants 2019-05-21 17:55:58 -07:00
Leonardo de Moura
89259d012b fix(stage0): missing files 2019-05-21 16:39:07 -07:00
Leonardo de Moura
91745cd16b fix(library/init/lean): remove hard coded file 2019-05-21 16:26:08 -07:00
Leonardo de Moura
8003ccec13 chore(stage0): update 2019-05-21 16:12:26 -07:00
Leonardo de Moura
5b3aec088e feat(library/init/lean/compiler/ir/emitcpp): emit module initialization code 2019-05-21 16:06:10 -07:00
Leonardo de Moura
ae8a51c718 feat(library/init/lean/runtime): expose runtime limit 2019-05-21 14:24:16 -07:00
Leonardo de Moura
db6933e3a4 chore(stage0): update
Make sure the new IR checker is used to validate generated code.
2019-05-21 13:45:49 -07:00
Leonardo de Moura
9f604ee0a1 fix(library/compiler/extern_attribute): register @[extern] projections in the new IR compiler 2019-05-21 13:42:42 -07:00
Leonardo de Moura
3b5093ebe0 fix(library/compiler/ir): fix ret irrelevant 2019-05-21 13:32:11 -07:00
Leonardo de Moura
63d2c03403 fix(library/compiler/ir): lambda IR translator 2019-05-21 13:01:43 -07:00
Leonardo de Moura
dbe2bebc06 fix(library/compiler/extern_attribute): register extern constructors in the new IR compiler 2019-05-21 08:09:05 -07:00