Commit graph

23 commits

Author SHA1 Message Date
Leonardo de Moura
58e91559d0 feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
Leonardo de Moura
8ed89c6ac3 chore(library): remove normalize.cpp
The command `#reduce` was also temporarily removed.
2018-09-04 10:51:14 -07:00
Leonardo de Moura
b24ba6b93d chore(library/compiler/simp_inductive): fix bogus g++ 4.9 warning 2018-06-21 16:52:27 -07:00
Leonardo de Moura
13c532d0d4 fix(*): truncation bugs
- Lean strings (like std::string) may contain null characters. The
  codebase was ignoring this issue.

- We now have a wrapper `string_ref` for wrapping Lean string objects in
  C++. This wrapper also implements correctly the coercions std::string <-> string_ref.
  Remark: I also found a few places where the code relies on the
  following property which is not true
  Forall s : std::string, std::string(s.c_str()) == s

- `name` object wrapper was assuming that all numerals were small
  `nat` values. This is true in most cases, but the system would
  crash when processing if it is a big number.

- The commit tries to make sure runtime/util/kernel are correct.
  Modules that will be deleted contain many `TODO` comments
  indicating they may crash and/or produce incorrect results
  when strings contain null characters and numerals are big.

cc @kha

@kha: I thought about using `string` instead of `string_ref`.
We consistently use `std::string`. So, it should be fine, but I
was concerned about code readability.

After we bootstrap Lean4, we will be able to delete `lean::list`
template, and rename `lean::list_ref` to `lean::list`.

I am going to add `pair_ref` for wrapping Lean pair objects.
If we use `lean::string` instead of `lean::string_ref`, then
we should also use `lean::pair` instead of `lean::pair_ref`.
But, there is a problem in this case since we have
https://github.com/leanprover/lean4/blob/master/src/util/pair.h#L13
:(
2018-06-15 16:05:11 -07:00
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
bdea7d420d chore(*): type_context ==> type_context_old 2018-03-05 12:38:24 -08:00
Leonardo de Moura
ada4932507 feat(library/compiler): add new cache support to compiler 2018-02-21 15:04:20 -08:00
Leonardo de Moura
96fab5172f perf(library/compiler): apply lambda lifting after erase trivial structures
cc @kha
2018-02-15 16:55:27 -08:00
Leonardo de Moura
96e02613fc fix(library/compiler/simp_inductive): erase trivial structure bug 2018-02-11 11:43:05 -08:00
Leonardo de Moura
0bbe51615e chore(library/compiler/vm_compiler): add helper function 2017-11-09 13:29:32 -08:00
Leonardo de Moura
b0a33259ee fix(library/compiler/simp_inductive): array^.data should not be treated as a regular projection 2017-03-09 19:11:51 -08:00
Leonardo de Moura
22988bb95d feat(library/compiler): avoid pack/unpack overhead produced by the inductive_compiler in the code generator
TODO: make sure the user is not manually using cases_on for the
auxiliary datatype generated by the inductive_compiler to
destruct nested inductives.
2017-03-04 13:54:44 -08:00
Leonardo de Moura
e9a98362d3 feat(library): functional arrays 2017-02-20 22:00:02 -08:00
Leonardo de Moura
fbc1bb4d89 perf(library/compiler): add common subexpression elimination
It addresses a performance problem reported by Brian (huffman@galois.com).
2016-12-11 14:43:51 -08:00
Leonardo de Moura
d6000416f8 feat(library/compiler,frontends/lean/elaborator): (try to) preserve position information
We will use this information in the debugger.
2016-11-09 16:51:48 -08:00
Leonardo de Moura
6f02d30185 feat(library/vm): add basic support for C++ name objects in the VM
We still need to add support for the recursor
2016-06-01 13:10:24 -07:00
Leonardo de Moura
c5616969e0 fix(library/compiler/simp_inductive): distribute extra cases_on arguments over minor premises in the simp_inductive step 2016-05-25 15:46:01 -07:00
Leonardo de Moura
9545620a54 fix(library/compiler/simp_inductive): generate error message for inductive predicates
indutive predicates that support elimination on Type (e.g., eq and acc) must be
eliminated before this step.
2016-05-23 13:27:05 -07:00
Leonardo de Moura
7852247376 feat(compiler/simp_inductive): add optimization for inductive datatypes that have only one constructor C, and C has only one relevant field 2016-05-12 14:24:14 -07:00
Leonardo de Moura
ecc9014d82 fix(library/compiler/simp_inductive): check ignore predicate at visit_constant 2016-05-11 16:06:21 -07:00
Leonardo de Moura
7ca916cddf feat(library/compiler/simp_inductive): add optimization for _cases based on the number of reachable cases 2016-05-11 14:40:53 -07:00
Leonardo de Moura
a5c6741d1b fix(library/compiler/simp_inductive): add support for constructor without arguments 2016-05-11 14:24:43 -07:00
Leonardo de Moura
e53bfb9d0a feat(library/compiler): add new compilation step where we reduce cases_on, constructor and projection applications into a basic primitives 2016-05-11 14:17:32 -07:00