Commit graph

16235 commits

Author SHA1 Message Date
Leonardo de Moura
4d3689ea33 feat(library/init/data/array/basic): add new array functions
@kha I renamed the homogeneous `map` to `hmap`, and added the
heterogeneous one as `map`. As soon as we add user-defined rewriting
rules, we will be able to replace `map` with `hmap` whenever the types
are the same.
2019-04-06 19:25:32 -07:00
Leonardo de Moura
0c9fe3c7d4 feat(library/compiler): add [inline2] attribute, and stage2 inlining
This feature is useful since it allows us to perform inlining
after lambda lifting has been performed.
2019-04-06 08:00:58 -07:00
Leonardo de Moura
d3afb41f51 feat(library/compiler/lambda_lifting): add function detecting lambda_lifting aux declarations 2019-04-06 07:42:45 -07:00
Leonardo de Moura
c54589007e feat(library/compiler): extract closed terms after caching stage2 decls 2019-04-06 07:19:19 -07:00
Leonardo de Moura
23febc9977 test(tests/playground/parser/parser2): more experiments 2019-04-05 18:09:13 -07:00
Leonardo de Moura
69fb157ff7 chore(tests/playground/parser/parser2): update TODO list 2019-04-05 17:25:36 -07:00
Leonardo de Moura
50d2488946 fix(library/compiler/csimp): cases-merging was failing when scrutinee was a constant 2019-04-05 17:24:01 -07:00
Leonardo de Moura
d603baea70 test(tests/compiler): add new test 2019-04-05 16:58:47 -07:00
Leonardo de Moura
1bb920322d feat(library/init/lean/compiler/constfolding): constant folding for strictAnd and strictOr 2019-04-05 16:51:29 -07:00
Leonardo de Moura
2cd3954198 chore(library/init/core): remove misleading annotation
The compiler will not try to inline definitions tagged as `@[extern]`.
`strictOr` and `strictAnd` must be handled using the constant folding module.
2019-04-05 16:29:44 -07:00
Leonardo de Moura
da9ceea0e5 chore(stage0): update 2019-04-05 16:16:46 -07:00
Leonardo de Moura
1e198ca72e fix(library/compiler/csimp): missing optimization opportunity 2019-04-05 16:16:24 -07:00
Leonardo de Moura
7b835f3d02 feat(library/compiler/csimp): keep simplifying if cse and elim_dead_let reduced expression
Both `cse` and `elim_dead_let` may create new simplification opportunities for `csimp`.
2019-04-05 15:39:43 -07:00
Leonardo de Moura
6c44a5d997 feat(library/compiler/csimp): add Thunk.get (Thunk.mk f) ==> f () simplification 2019-04-05 14:55:48 -07:00
Leonardo de Moura
48fbaefa2a chore(library/constants.txt): remove leftover 2019-04-05 14:29:51 -07:00
Leonardo de Moura
8ec95767d7 chore(stage0): update 2019-04-05 14:18:50 -07:00
Leonardo de Moura
994ca779ef feat(library/compiler/csimp): improve try_inline_instance 2019-04-05 14:16:38 -07:00
Leonardo de Moura
e7f379fb0f chore(library/init/control/id): spurious [inline] annotations 2019-04-05 14:16:38 -07:00
Leonardo de Moura
c44f79f981 test(tests/playground/parser/parser2): yet another parsing combinators experiment 2019-04-05 08:18:28 -07:00
Leonardo de Moura
de880dc15f chore(stage0): update 2019-04-04 15:26:43 -07:00
Leonardo de Moura
c2e474f216 chore(library/init/lean/compiler): cleanup notation 2019-04-04 15:26:09 -07:00
Leonardo de Moura
f25554baa7 test(tests/playground/parser): multiple targets 2019-04-04 10:50:34 -07:00
Leonardo de Moura
dd72df26bd test(tests/playground/parser): create directory and Makefile for experiment 2019-04-04 10:36:17 -07:00
Leonardo de Moura
5f6106be83 chore(init): add reserve for all control notation at core.lean
cc @kha
2019-04-04 08:53:42 -07:00
Leonardo de Moura
861a292d8f chore(stage0): update 2019-04-03 13:29:09 -07:00
Leonardo de Moura
8b145d7884 chore(library/init/control/combinators): use Applicative instead of Monad in relevant combinators 2019-04-03 13:28:08 -07:00
Leonardo de Moura
e09374afa6 perf(library/init/data/hashmap/basic): reuse AssocList memory cells when expanding hashtable 2019-04-03 10:49:46 -07:00
Leonardo de Moura
273a0775d6 perf(library/init/data/array): mkArray in Lean doesn't seem to buy us anything
The primitive implementation combines all `inc`'s into a single one.
2019-04-03 10:27:58 -07:00
Leonardo de Moura
a18c88a727 perf(library/init/data/hashmap/basic): add [inline] to reinsertAux 2019-04-03 09:52:34 -07:00
Leonardo de Moura
d9be0290ae perf(library/init/data/hashmap/basic): missing @[inline]
This commit adds the auxiliary function `expand` to break a nasty
interaction between code specialization, erasure and memory reuse.

Suppose we have
```lean
let  new_array := array.update array i v in
have pr : <some property that mentions array>, from <proof>,
f  new_array pr
```
Suppose `f` is not marked with `[specialize]`. Then, `pr` is erased and we get:

```lean
let  new_array := array.update array i v in
f  new_array box(0)
```
If `RC(array) == 1`, then the update performs a destructive update, and
we are happy.

Now, assume that `f` is marked with `[specialize]`.
Moreover, function specialization occurs before erasure since we want to
be able to use the to-be-implemented user-defined rewriting rules after specialization.
When we specialize `f` we compute a closure of its dependencies, and one of them is array because of `pr`.
Thus, we get
```lean
let  new_array := array.update array i v in
f_spec new_array array
```
after specialization and erasure, but now, we don't perfom the destructive update.

BTW, I assumed we should be able to reduce the arity of `f_spec` after
erasure since the parameter `array` be dead after it. However, I found the following TODO:
https://github.com/leanprover/lean4/blob/master/src/library/compiler/reduce_arity.cpp#L50
2019-04-03 09:38:03 -07:00
Leonardo de Moura
1815331828 perf(library/init/data): add @[specialize] to RBMap and RBTree functions that depend on lt : a -> a -> Bool
A few commits ago, a few `RBMap` and `RBTree` functions had
the parameters `(lt : a -> a -> Prop) [DecidableRel lt]` instead of
`(lt : a -> a -> Bool)`. Recall that the compiler automatically specializes
functions with arguments of the form `[ ... ]`. Thus, after we moved to
`(lt : a -> a -> Bool)` we have to include `@[specialize]` to force the
compiler to specialize.
2019-04-03 09:16:34 -07:00
Leonardo de Moura
a883042dc8 chore(library/init): fold functions argument order consistency 2019-04-03 07:42:14 -07:00
Leonardo de Moura
d6b7c9c1e2 test(tests/playground/map_perf): RBMap vs HashMap 2019-04-03 07:27:10 -07:00
Leonardo de Moura
fb3150e69d chore(tests/playground): fix test 2019-04-03 07:21:17 -07:00
Leonardo de Moura
2c72888af4 chore(stage0): update 2019-04-03 05:59:37 -07:00
Leonardo de Moura
c43374d296 refactor(library/init/data/hashmap): use AssocList and HasBeq 2019-04-03 05:55:08 -07:00
Leonardo de Moura
568b598729 fix(library/init/data/array/basic): incorrect borrow annotation 2019-04-03 05:50:53 -07:00
Leonardo de Moura
19856c4ca7 chore(library/init/data/hashmap/default): missing file 2019-04-03 05:50:19 -07:00
Leonardo de Moura
01b3eb2b05 feat(library/init/data/assoclist): add AssocList 2019-04-03 04:35:52 -07:00
Leonardo de Moura
ee050431e0 feat(runtime): add primitive hash functions 2019-04-03 04:01:36 -07:00
Leonardo de Moura
a46e27a3d7 feat(runtime/hash): use size_t instead of unsigned 2019-04-03 03:19:50 -07:00
Leonardo de Moura
02e6f953c8 chore(stage0): update 2019-04-03 03:02:20 -07:00
Leonardo de Moura
dc6c1e329f refactor(library/init/data/rbmap): use Bool instead of Prop 2019-04-03 02:54:34 -07:00
Leonardo de Moura
beb946d132 chore(library/init/data/int/basic): remove weird notation, dead code, and fix camelCase conversion issues 2019-04-03 02:54:34 -07:00
Sebastian Ullrich
5f8b1328c3 test(tests/playground/expander): add Leo's direct transformation 2019-04-03 11:27:06 +02:00
Leonardo de Moura
3d43f8a441 test(tests/playground/lazylist): LazyList 2019-04-02 17:26:29 -07:00
Leonardo de Moura
54b21bb3cd test(tests/playground/filemap): FileMap 2019-04-02 17:23:13 -07:00
Leonardo de Moura
9745f70fe2 chore(stage0): update 2019-04-02 17:22:19 -07:00
Leonardo de Moura
3d393d9b1d fix(library/compiler/csimp): bug introduced earlier today 2019-04-02 17:21:25 -07:00
Leonardo de Moura
5f36337322 chore(library/init/control/combinators): remove dependency 2019-04-02 17:21:13 -07:00