Commit graph

26741 commits

Author SHA1 Message Date
Leonardo de Moura
4ee3332763 chore(stage0): update 2019-06-04 16:56:53 -07:00
Leonardo de Moura
c480f1f95c refactor(library/init/lean/environment): move scope management to attributes.lean 2019-06-04 16:50:29 -07:00
Leonardo de Moura
89ab07a4b0 refactor(library/init/lean/environment): more flexible PersistentEnvExtensionState
The previous API was not flexible enough to implement the new
`AttributeManager` with all "bells and whistles" we want.
For example, the new `addImportedFn` field allows us to initialize
the state for the imported entries using a `Thunk`.
2019-06-04 16:35:21 -07:00
Leonardo de Moura
3bb8826bb4 feat(library/init/lean/environment): scope management skeleton 2019-06-04 15:20:07 -07:00
Leonardo de Moura
83e4c63d27 feat(library/init/data/persistentarray/basic): add PersistentArray.modify 2019-06-04 10:40:46 -07:00
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
ca12439e25 feat(library/init/lean/environment): add persistent := true parameter to addEntry 2019-06-03 17:03:46 -07:00
Leonardo de Moura
0a08569b46 feat(library/init/lean/environment): remove lazy, add addImported field to PersistentEnvExtension
It seems `lazy := false` is only going to be used in the attribute
manager. So, I remove it. I added a new field `addImported : Bool`
instead. An extension can specify whether `addEntryFn` is going to be
invoked or not for imported entries. `addImported := false` is useful for extensions such
as `protected`, and I will use it in the attribute manager too.
2019-06-03 16:45:27 -07:00
Leonardo de Moura
90dc3356dc chore(library/init/lean/environment): remove unnecessary local instance 2019-06-03 16:24:36 -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
483f1efc4d refactor(library/init/lean/environment): move fields that are rarely used to a separate structure, add setMainModuleName 2019-06-03 08:23:00 -07:00
Leonardo de Moura
6d39b8478f chore(library/init/lean/environment): remove dead field 2019-06-03 08:08:04 -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
9d00a8d262 feat(tests/playground/radixtree): use bit shift and land instead instead of / and % 2019-06-01 11:06:45 -07:00
Leonardo de Moura
3251f1c75b feat(library/init/data/uint): add shift_left and shift_right 2019-06-01 10:57:08 -07:00
Leonardo de Moura
8d913e382d feat(library/init/lean/compiler/constfolding): fold Nat.pow, UInt*.toNat and USize.toNat 2019-06-01 10:28:04 -07:00
Leonardo de Moura
336761d787 feat(tests/playground/radixtree): add stats 2019-06-01 09:47:57 -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
d2d2c32c81 feat(library/init/data/nat/bitwise): use lean::nat_land and lean::nat_lor 2019-05-31 21:55:57 -07:00
Leonardo de Moura
e87c471e7f test(tests/playground/radixtree): Scala/Clojure inspired persistent arrays
@kha It is a pity we didn't use this example in our paper. It works
really well with `reset`/`reuse`.
2019-05-31 21:55:57 -07:00
Leonardo de Moura
8256a48cda fix(library/init/lean/compiler/ir/rc): uset live vars 2019-05-31 21:55:57 -07:00
Sebastian Ullrich
9fe86c3f96 chore(tests/bench): further tweak Swift support 2019-05-31 10:48:50 +02:00
Sebastian Ullrich
2a6fb67afc feat(tests/bench): add qsort.swift 2019-05-31 00:40:09 +02:00
Leonardo de Moura
fab4fdf7c4 tests(tests/bench): add rbmap.swift 2019-05-30 14:47:06 -07:00
Leonardo de Moura
27c690b0c5 test(tests/bench/rbmap_checkpoint): add swift version 2019-05-30 14:35:58 -07:00
Leonardo de Moura
c347643361 test(tests/bench): add deriv.swift 2019-05-30 11:34:58 -07:00
Sebastian Ullrich
d532c4ad29 feat(tests/bench): add safe binarytrees.swift from https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-swift-1.html 2019-05-30 19:33:38 +02:00
Sebastian Ullrich
c30209ee02 feat(tests/bench): add Swift support 2019-05-30 19:33:23 +02:00
Leonardo de Moura
70c9733897 chore(stage0): update 2019-05-30 09:41:16 -07:00
Leonardo de Moura
d9cceec9eb feat(library/init/lean/compiler/ir/emitcpp): avoid unnecessary var decls 2019-05-30 09:36:28 -07:00
Leonardo de Moura
8333e48037 chore(stage0): update 2019-05-30 09:16:09 -07:00
Leonardo de Moura
4da2e9f7b6 test(tests/bench/rbmap_checkpoint): OCaml version using myLen 2019-05-30 07:40:53 -07:00
Leonardo de Moura
40ce455e79 chore(tests/bench/rbmap_checkpoint): myLen version for GHC 2019-05-30 07:35:22 -07:00
Leonardo de Moura
e954ed12bc chore(tests/bench/rbmap_checkpoint): use myLean 2019-05-30 07:30:07 -07:00
Leonardo de Moura
d9856889d6 chore(*): cleanup 2019-05-30 07:30:07 -07:00
Sebastian Ullrich
007e45794f chore(tests/bench/default): update MLKit 2019-05-30 16:25:41 +02:00
Sebastian Ullrich
9ec570416d chore(tests/bench): rename benchmarks 2019-05-30 16:25:41 +02:00
Sebastian Ullrich
8a2c2ffe84 chore(tests/bench/Makefile): reduce rbmap input sizes 2019-05-30 16:18:03 +02:00
Leonardo de Moura
30fefdb188 chore(tests/playground): add zipper 2019-05-29 14:33:47 -07:00
Leonardo de Moura
0009435add chore(tests/playground/lazylist): fix test 2019-05-29 14:33:47 -07:00
Sebastian Ullrich
4e3191123c chore(tests/bench/default.nix): remove compilers of retired categories 2019-05-29 17:36:42 +02:00
Sebastian Ullrich
dfea4be7a4
chore(tests/bench): add readme 2019-05-29 17:32:35 +02:00