Commit graph

18 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
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
91a65f692f refactor(library/compiler): remove nat_value macro 2018-06-14 15:26:32 -07:00
Leonardo de Moura
2d7b6ed12c chore(library/compiler): remove copy_tag from old compiler 2018-06-07 16:28:54 -07:00
Leonardo de Moura
b2f3d3f456 chore(*): remove redundant code 2018-05-22 16:46:04 -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
4b6583ae9f refactor(util): move mpz/mpq to util
The new lean_obj objects will be defined at util.
Reason: we will define `name`, `options`, `format`, ... on top of lean_obj.
lean_obj depends on mpz.
Remark: lean_obj will replace vm_obj.
2018-04-12 16:43:11 -07:00
Leonardo de Moura
bdea7d420d chore(*): type_context ==> type_context_old 2018-03-05 12:38:24 -08:00
Leonardo de Moura
e905e83e9e chore(library, frontends/lean): use override 2017-06-22 16:15:21 -07:00
Sebastian Ullrich
491802409a chore(*): remove unused macro_definition_cell::pp method 2017-05-24 09:51:23 +02:00
Leonardo de Moura
b313328cb9 feat(library/equations_compiler): int constants 2016-12-25 10:00:18 -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
0b2c3659cf perf(library/compiler/nat_value): replace all numerals with nat_value_macro
Reason: Later we try to type check the compiler intermediate results.
If only some of the numerals are converted, we may spend a lot of time
making sure the two different representations are equivalent.
2016-09-04 16:42:40 -07:00
Leonardo de Moura
53811822d4 chore(*): style 2016-05-25 18:10:15 -07:00
Leonardo de Moura
63ed0c0056 feat(library/compiler/erase_irrelevant): add support for IO monad.bind 2016-05-24 18:14:39 -07:00
Leonardo de Moura
423d129105 feat(library/vm/vm): bytecode serialization 2016-05-13 17:51:01 -07:00
Leonardo de Moura
752c81a166 fix(library/compiler/nat_value): add expand method, otherwise we may fail to type check terms using nat_value_macro 2016-05-13 12:50:28 -07:00
Leonardo de Moura
df9352ea6e feat(library/compiler): better support for numeric constants 2016-05-12 16:33:37 -07:00