Commit graph

15933 commits

Author SHA1 Message Date
Leonardo de Moura
43cbd1e2a3 chore(bin/leanc.in): remove flags that do not exist on clang++ for OSX
@kha If we need these flags on Linux, we need to test which platform
is being used.
2019-03-18 08:38:50 -07:00
Sebastian Ullrich
dec8b76c32 feat(src/CMakeLists): build stdlib using leanc instead of nested CMake run 2019-03-18 16:11:39 +01:00
Sebastian Ullrich
f6d3062524 feat(bin/leanc): add simple C++ compiler wrapper script 2019-03-18 16:11:30 +01:00
Sebastian Ullrich
b4ce2ba1a5 chore(shell/CMakeLists): add REBUILD_STAGE0 dev option 2019-03-18 16:09:20 +01:00
Sebastian Ullrich
8a04ae56d5 chore(library/Makefile.in): update stage1/CMakeLists.txt only when out of date
not sure this really improves anything
2019-03-18 16:09:20 +01:00
Sebastian Ullrich
ee15a70098 fix(*/CMakeLists): build all binaries via (staged) leanstatic 2019-03-18 16:09:20 +01:00
Sebastian Ullrich
074b179984 feat(shell/CMakeLists): do not touch src/boot by default, use untracked dir src/stage1 instead 2019-03-18 16:09:20 +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
8f6444c76a chore(library/init/core): remove todo 2019-03-16 18:42:37 -07:00
Leonardo de Moura
1935986f3c fix(library/compiler/compiler): we must compile (non external) opaque constants 2019-03-16 18:41:58 -07:00
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
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
dcdeff1794 chore(runtime): remove dead file 2019-03-16 15:34:58 -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
62284c7f39 feat(library/init/control): add estate monad
Optimized `except_t ε (state_t σ id) α`
2019-03-16 15:24:12 -07:00
Sebastian Ullrich
b325908d4a chore(frontends/lean/vm_elaborator): rename to lean_elaborator, update some comments 2019-03-16 19:29:12 +01: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
Sebastian Ullrich
5d466b1fd1 chore(boot/): hide diffs on Github 2019-03-15 09:50:03 +01: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
9afee85919 fix(library/vm/vm_aux): remove old code
Remark: `vm_timeit` was for the Lean 3 `timeit` primitive which is
different from the Lean 4 one. It has a different arity, and was
producing an assertion violation at emit_bytecode.cpp
2019-03-14 16:04:10 -07:00
Leonardo de Moura
65441a79ca fix(library/compiler/llnf): neutral element 2019-03-14 16:01:42 -07:00
Leonardo de Moura
590e40cb7b chore(library/compiler/csimp): leftover 2019-03-14 16:00:59 -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
562f530522 chore(runtime/io): use std::cerr 2019-03-14 11:04:12 -07:00
Leonardo de Moura
14052ff785 chore(boot): update 2019-03-14 10:46:12 -07:00
Leonardo de Moura
d3ba9ef7fa feat(library/compiler/csimp): eliminate join points that are used only once 2019-03-14 10:43:35 -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
a3ee9da967 chore(boot): update 2019-03-13 16:43:14 -07:00
Leonardo de Moura
e50d8e0b92 chore(tests/playground/flat_parser): continue experiment 2019-03-13 16:40:12 -07:00
Leonardo de Moura
b1e812ea9d feat(library/compiler/specialize): restrict the kind of argument that can be specialized 2019-03-13 16:39:30 -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
cbc65544f0 chore(boot): update 2019-03-12 18:20:10 -07:00
Leonardo de Moura
77dc3f3d32 feat(library/init/io): use fix to implement iterate 2019-03-12 18:06:23 -07:00
Leonardo de Moura
88453f037c feat(library/compiler/csimp): erase base argument from fix_core 2019-03-12 18:05:41 -07:00
Leonardo de Moura
907627ee9e chore(boot): update 2019-03-12 14:11:27 -07:00
Leonardo de Moura
62df218a8e fix(library/compiler/specialize): another bug 2019-03-12 14:08:52 -07:00
Leonardo de Moura
e858d7f5b8 fix(library/compiler/specialize): yet another specializer bug
@kha I found yet another bug in the specializer code :(
The bug is related to the previous bug fix where we try avoid
duplication of work by lambda abstracting let-variables.
We knew this could introduce type errors, but I thought it would only
happen in very complicated programs that make a heavy use of dependent
types. Actually, this is not the case. I just found an instance when
I was playing with the new parser.
2019-03-12 12:25:32 -07:00
Leonardo de Moura
64e60f77b3 chore(runtime/object): remove dead code 2019-03-12 12:25:11 -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
b320452f70 chore(runtime/object): remove iterator primitives from runtime
They are now implemented in Lean.
2019-03-12 07:09:48 -07:00
Leonardo de Moura
2a2f3c1429 chore(boot): update 2019-03-12 06:56:05 -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
cf3bbd7e25 feat(runtime): add utf8_prev and utf8_set
Next goal: implement string.iterator in Lean
2019-03-11 18:05:40 -07:00