Commit graph

14212 commits

Author SHA1 Message Date
Leonardo de Moura
1a3dd6df43 feat(kernel): add reduce_proj and infer_proj 2018-06-19 16:40:00 -07:00
Leonardo de Moura
9e7e600ad7 feat(kernel): add expr.proj constructor
TODO: implement infer_proj and reduce_proj
2018-06-19 15:45:49 -07:00
Leonardo de Moura
d87dfbfb03 chore(library/equations_compiler): remove equations macro 2018-06-19 13:41:08 -07:00
Leonardo de Moura
f972fb2299 chore(library/equations_compiler): remove equations_result macro 2018-06-19 13:41:07 -07:00
Leonardo de Moura
140e906267 chore(library/equations_compiler): remove equation and no_equation macros 2018-06-19 13:41:07 -07:00
Leonardo de Moura
b4f4924be4 chore(library/equations_compiler): remove as_pattern macro 2018-06-19 13:41:07 -07:00
Leonardo de Moura
c0a9b0bb4b chore(frontends/lean): remove field_notation macro
In the new parser, field_notation will be a syntax object.
2018-06-19 13:41:07 -07:00
Sebastian Ullrich
51d3ff21eb feat(library/init/control/state): monad_state: add specialized MonadState methods + modify
Absent inlining, these may perform better than `lift` when e.g. used with an
implementation based on unboxed tuples
2018-06-19 13:01:15 +02:00
Leonardo de Moura
970d14afa9 refactor(frontends/lean/structure_instance): implement structure instances using mdata 2018-06-18 15:57:42 -07:00
Leonardo de Moura
5fa357e887 chore(frontends/lean/choice): cleanup 2018-06-18 15:29:21 -07:00
Leonardo de Moura
f948892505 refactor(frontends/lean/choice): use mdata to implement choice 2018-06-18 14:21:11 -07:00
Leonardo de Moura
bf5bef2088 chore(frontends/lean/choice): remove dead code 2018-06-18 13:46:22 -07:00
Leonardo de Moura
3356c1d08d refactor(library,frontends/lean): move choice to frontends/lean
Remark: `choice` will be a syntax object in Lean4
2018-06-18 13:43:42 -07:00
Leonardo de Moura
b84090aaca feat(library/annotation): remove annonation macro
We now use the new `expr.mdata` constructor.
2018-06-18 13:39:02 -07:00
Leonardo de Moura
9d7609ac66 chore(library/type_context): remove dead code 2018-06-18 13:36:22 -07:00
Leonardo de Moura
0847571ea6 feat(kernel): add mdata constructor 2018-06-18 13:36:22 -07:00
Sebastian Ullrich
70970ce5e0 feat(library/init/lean/parser/reader): add simplistic implementation of a tiny initial part of the Lean reader
Maybe 'reader' isn't the best name.
2018-06-18 19:23:58 +02:00
Leonardo de Moura
d704bfef17 fix(util/pair_ref): missing file 2018-06-18 08:19:32 -07:00
Sebastian Ullrich
bf9bf19215 doc(library/init/lean/parser/parser_t): some monad_parser documentation 2018-06-18 13:50:05 +02:00
Leonardo de Moura
9ef934e090 chore(util): style 2018-06-15 16:05:11 -07:00
Leonardo de Moura
f7d73fb304 feat(util/kvmap): add C++ kvmap wrapper 2018-06-15 16:05:11 -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
c8a13a9ada refactor(*): name convention obj_list => list_ref
Remark: we use the `_ref` suffix for Lean object smart pointers
when the name clashes with an existing name.
2018-06-15 16:05:11 -07:00
Leonardo de Moura
fe2d416cde fix(runtime,util,kernel): should not use strcmp to compare Lean string objects
Reason:
- UTF8 encoding
- Lean strings may contain null char. That is, null char is not an end
  of string delimiter like in C. Lean string objects are similar to std::string
2018-06-15 16:05:11 -07:00
Leonardo de Moura
a49de9ccd3 feat(library/init/lean): add kvmap
We use it to implement `expr.mdata` and `options`
2018-06-15 16:05:11 -07:00
Leonardo de Moura
e80ad07590 chore(library/init/core): remove dead code 2018-06-15 16:05:11 -07:00
Sebastian Ullrich
7ae87705c2 feat(library/init/lean/parser/parser_t): introduce monad_parser 2018-06-15 17:48:20 +02:00
Leonardo de Moura
71fc35af1d chore(library/vm): remove meta rb_map
We should use the non-meta rbmap that is implemented in Lean.
2018-06-14 17:34:43 -07:00
Leonardo de Moura
0394018e98 chore(library/init/lean/macro): update TODO 2018-06-14 16:28:34 -07:00
Leonardo de Moura
8101b9df6e refactor(library/string): remove string_macro
We now use expr_lit.
2018-06-14 16:26:39 -07:00
Leonardo de Moura
af8853829e fix(kernel/expr): bug at literal::kind 2018-06-14 16:18:15 -07:00
Leonardo de Moura
882fa6e71f fix(library/init/meta/expr): order does not match C++ implementation 2018-06-14 16:12:02 -07:00
Leonardo de Moura
70d489db25 feat(frontends/lean): remove prenum macro
We now encode prenum using expr_lit
2018-06-14 15:46:35 -07:00
Leonardo de Moura
7d40bb5db1 fix(kernel/expr): literal RC issue 2018-06-14 15:36:12 -07:00
Leonardo de Moura
ef38890784 fix(kernel/expr): missing case 2018-06-14 15:28:12 -07:00
Leonardo de Moura
91a65f692f refactor(library/compiler): remove nat_value macro 2018-06-14 15:26:32 -07:00
Leonardo de Moura
78192972e9 chore(kernel): expr_kind::Meta ==> expr_kind::MVar 2018-06-14 15:13:45 -07:00
Leonardo de Moura
73e067d361 feat(kernel): add expression literals 2018-06-14 14:55:14 -07:00
Leonardo de Moura
1a18bb265d chore(frontends/lean): remove a few old_type_checker occurrences 2018-06-14 14:05:04 -07:00
Leonardo de Moura
4878abfda4 chore(util/nat): fix style 2018-06-14 14:04:37 -07:00
Leonardo de Moura
46a846dd99 chore(frontends/lean/inductive_cmds): fix nonsense 2018-06-14 13:51:09 -07:00
Leonardo de Moura
3843c50cd7 chore(tests/kernel): remove old test 2018-06-14 13:49:27 -07:00
Leonardo de Moura
3e846e1fc9 chore(library): remove unnecessary inaccessible annotations 2018-06-14 11:33:00 -07:00
Leonardo de Moura
70fc656931 refactor(library/init/data/nat/basic): remove nat.less_than_or_equal inductive predicate
We now define nat.le using (nat.ble : nat -> nat -> bool) function.
We will add builtin support for reducing `nat.ble` efficiently when the arguments are the to be added nat literals.
2018-06-14 11:30:09 -07:00
Leonardo de Moura
021bc40e95 feat(library/init/lean/expr): new lean.expr type 2018-06-13 15:44:15 -07:00
Leonardo de Moura
4c370e4558 refactor(kernel/expr): fix binder_info 2018-06-13 12:20:58 -07:00
Leonardo de Moura
017e1d7a5f fix(util/name): strcmp does not implement Lean string equality 2018-06-13 11:43:05 -07:00
Leonardo de Moura
7512d1996e feat(runtime): add string_eq and string_ne 2018-06-13 11:42:57 -07:00
Leonardo de Moura
40bf1365ae chore(library/inductive_compiler/nested): compilation warning 2018-06-13 09:59:44 -07:00
Leonardo de Moura
4432629eb0 feat(util/nat): add C++ wrapper for manipulating runtime nat values 2018-06-13 09:29:52 -07:00