Commit graph

7042 commits

Author SHA1 Message Date
Leonardo de Moura
45c4a78f59 chore(tests/playground/environment_ext): revert accidental commit 2019-03-22 13:26:17 -07:00
Leonardo de Moura
e24ad8c0b5 feat(library/init/core): add HasBeq default instances for types that implement DecidableEq
@kha I think code looks less weird if we don't mix Booleans and
propositions in the same expression.
2019-03-22 11:23:45 -07:00
Leonardo de Moura
548e7c5436 chore(tests/playground): fix playground tests 2019-03-21 18:30:58 -07:00
Leonardo de Moura
452d5107ac chore(library/init/data/array): naming convention
The array read and write operations are now called:

- "Comfortable" version (with runtime bound checks):
  `Array.get` and `Array.set` like OCaml.
   It is also consistent with `Ref.get` and `Ref.put`,
   and `get` and `set` for `MonadState`.

- `Fin` version (without runtime bound checks):
  `Array.index` and `Array.update` like in F*.

- `USize` version (without runtime bound checks and unboxing):
  `Array.idx` and `Array.updt`.

cc @kha
2019-03-21 18:03:29 -07:00
Leonardo de Moura
3befc219c9 chore(library/init): Empty => empty when it is a function 2019-03-21 17:03:15 -07:00
Leonardo de Moura
4bf41f0036 chore(tests/lean/run/coroutine): fix test 2019-03-21 16:46:53 -07:00
Leonardo de Moura
7bb015c6b3 chore(tests/lean): fix more tests 2019-03-21 15:11:05 -07:00
Leonardo de Moura
2cbdb287c3 chore(tests): fix/disable some tests 2019-03-21 15:11:05 -07:00
Sebastian Ullrich
f34d37c371 chore(tests): port tests, fix at least compiler tests 2019-03-21 15:11:05 -07:00
Sebastian Ullrich
25ac67516e chore(tests/playground/environment_ext): remove unused attr field 2019-03-20 15:05:59 +01:00
Leonardo de Moura
3184023ab3 feat(tests/playground): force test to backtrack 2019-03-19 16:34:08 -07:00
Leonardo de Moura
adffbdd5a8 test(tests/playground): new parser monad 2019-03-19 15:14:58 -07:00
Sebastian Ullrich
93c2a47ad1 chore(tests/playground/environment_ext): reduce number of callbacks 2019-03-19 23:04:45 +01:00
Leonardo de Moura
e31e562c79 test(tests/playground/flat_parser2): more experiments 2019-03-19 11:25:55 -07:00
Sebastian Ullrich
b61fb79ea9 chore(tests/playground/environment_ext): prototype 2019-03-19 17:18:43 +01:00
Leonardo de Moura
2e21e0122c test(tests/playground/flat_parser2): another experiment 2019-03-18 18:27:05 -07:00
Leonardo de Moura
970ebd2b91 test(tests/playground/ref2): small example using [init] 2019-03-18 15:52:36 -07:00
Sebastian Ullrich
f160fd8de0 chore(tests): compile tests using -O3 again 2019-03-18 17:55:28 +01:00
Sebastian Ullrich
f6d3062524 feat(bin/leanc): add simple C++ compiler wrapper script 2019-03-18 16:11:30 +01:00
Leonardo de Moura
1da4782483 feat(runtime, library/init/io): add io.ref 2019-03-16 22:16:28 -07:00
Leonardo de Moura
b1c187f717 feat(library/compiler): allow io unit as main function result type
When `io unit` is used, we use `return 0` for `result.ok`, and `return
1` for `result.except`.
2019-03-16 16:05:45 -07:00
Leonardo de Moura
6d0ec3a8c9 refactor(library/init/io): implement io monad using estate monad 2019-03-16 15:34:58 -07:00
Leonardo de Moura
3eedc327c7 feat(tests/playground/flat_parser): tail recursive many combinator 2019-03-14 16:11:51 -07:00
Leonardo de Moura
39dd079e37 feat(runtime): low tech allocation profiler
```
@[extern 4 "lean_io_allocprof"]
constant allocprof {α : Type} (msg : @& string) (fn : io α) : io α
```
2019-03-14 15:15:29 -07:00
Leonardo de Moura
39e752d28a chore(tests/playground/flat_parser): remove debugging stuff 2019-03-14 11:05:13 -07:00
Leonardo de Moura
44cdb1fc56 chore(tests/playground/flat_parser): add new file_map
Goal: minimize the number of constructor object allocations.
They derailed me when I was looking for performance bottlenecks in the
flat_parser.
2019-03-14 08:38:08 -07:00
Leonardo de Moura
e50d8e0b92 chore(tests/playground/flat_parser): continue experiment 2019-03-13 16:40:12 -07:00
Leonardo de Moura
3fe6858a93 feat(library/compiler/csimp): make csimp simplifies unreachable branches
`let x := lc_unreachable in e` => `lc_unreachable`
`let x := e in lc_unreachable` => `lc_unreachable`
2019-03-13 11:45:40 -07:00
Leonardo de Moura
cf3bbd7e25 feat(runtime): add utf8_prev and utf8_set
Next goal: implement string.iterator in Lean
2019-03-11 18:05:40 -07:00
Leonardo de Moura
d55a439542 test(tests/playground/fix_1): add fix.lean variant: fix_1.lean
`fix.lean` and `fix_1.lean` are very similar, but fix.lean is almost
twice as fast. Reason: `fix.lean` uses `fix_2` instead of `fix_1` and
avoid the creation of many closures. Here are runtime numbers on my
machine.

```
time ./fix_1.lean.out 23
352321527

real	0m0.729s
user	0m0.724s
sys	0m0.000s
```

```
~/projects/lean4/tests/playground (master +)$ time ./fix.lean.out 23
352321527

real	0m0.396s
user	0m0.388s
sys	0m0.004s
```

TODO: modify the compiler to replace `fix_core_n f a_1 ... a_m`
with `fix_core_m f a_1 ... a_m` whenever `n < m`.
This feature is quite useful for writing reusable/generic code. For
example, we cannot write an efficient `rec_t` without it because we
don't know the arity of `m A` when we write `rec_t`.
2019-03-11 13:44:07 -07:00
Leonardo de Moura
1e821d4057 chore(library/init/fix): rename primitives 2019-03-11 13:41:13 -07:00
Leonardo de Moura
5402178f73 test(tests/playground): fix tests
Forgot to add them.
2019-03-11 08:11:00 -07:00
Leonardo de Moura
01b4983fa2 fix(runtime/object): string_utf8_extract 2019-03-09 12:57:51 -08:00
Leonardo de Moura
67944a6c81 test(tests/compiler/str): new test for utf8 primitives 2019-03-09 12:41:33 -08:00
Leonardo de Moura
114f7ed190 feat(tests/playground/flat_parser): minor edits
We need a low level string.iterator to efficiently implement
primitives such as `str`.
2019-03-09 08:08:37 -08:00
Leonardo de Moura
489eaf3b71 test(tests/playground/flat_parser): experiment 2019-03-08 17:09:42 -08:00
Leonardo de Moura
7b1d15ec43 fix(library/compiler/specialize): avoid work duplication in the specializer 2019-03-08 11:21:49 -08:00
Sebastian Ullrich
e0bbc094ad chore(library/init): remove coroutines from stdlib 2019-03-08 15:34:17 +01:00
Leonardo de Moura
8e9b0d2799 fix(library/compiler): inferred types for stage2 declarations 2019-03-06 17:24:43 -08:00
Sebastian Ullrich
3b06c52d4f test(tests/playground/Makefile): re-add original ocamlopt parameters
This reverts commit 8e212ef9d9.
2019-03-05 15:44:42 +01:00
Sebastian Ullrich
069c07fa39 test(tests/playground/Makefile): update 2019-03-05 15:44:39 +01:00
Sebastian Ullrich
90a058a655 test(tests/playground/Makefile): bench fallback, all Lean tests 2019-03-05 15:44:03 +01:00
Sebastian Ullrich
467799c6c3 test(tests/playground/run.sh): fix 2019-03-05 15:37:11 +01:00
Leonardo de Moura
e5950cf710 test(tests/playground/gen): simple lean file generator
@kha
I am using this little program to generate big lean files to test the
new front end. For the output produced for `gen 5000`, the new frontend
is almost 10x slower than the old one.
I used `valgrind --tool=callgrind` to collect profiling data.
The number of closures is too big. For example, `free_closure_obj` was
invoked 38.5 million times. The total number of deallocated objects is around
49.5 million.
2019-03-04 16:19:50 -08:00
Leonardo de Moura
9cc41c4f3d chore(frontends/lean/inductive_cmds): disable broken check
@kha I have disabled this check. It was implemented 2 years ago by
Daniel, and I don't want to fix it. It seems you have already fixed a
bug there. AFAICT, this check is just for improving error messages.
I believe we may not even need it since the kernel now supports nested
inductive types. AFAIR, Daniel implemented this check here because the
inductive compiler was introducing a lot of auxiliary declarations
that were making the kernel error messages unreadable.
2019-03-04 11:05:21 -08:00
Sebastian Ullrich
5e7970dca3 test(tests/playground/deriv): Haskell version 2019-02-28 14:57:57 +01:00
Leonardo de Moura
b25c0db35d tests(tests/playground/deriv): deriv in OCaml 2019-02-27 11:15:52 -08:00
Leonardo de Moura
f4302a5f48 test(tests/playground): new versions of unionfind1
@kha I'm just trying to understand the performance numbers.
2019-02-26 16:47:53 -08:00
Leonardo de Moura
d128af10f9 test(tests/playground): add union find examples
@kha I tried to make the examples self contained.

- unionfind1.lean uses the modified StateT and ExceptT
- unionfind2.lean uses the standard StateT and ExceptT
2019-02-26 13:44:16 -08:00
Sebastian Ullrich
f366af76ac test(tests/playground/rbmap): consistent naming 2019-02-26 20:27:23 +01:00