Commit graph

1357 commits

Author SHA1 Message Date
Leonardo de Moura
776c977742 refactor(kernel): continue constant_info/declaration refactoring 2018-08-27 17:23:26 -07:00
Leonardo de Moura
96ff6b1718 feat(util/object_ref): add helper functions 2018-08-27 16:28:37 -07:00
Leonardo de Moura
27ef29a50f refactor(kernel/declaration): continue constant_info/declaration refactoring 2018-08-27 13:22:10 -07:00
Leonardo de Moura
252a017445 chore(library/inductive_compiler): remove nested.cpp
We added a temporary hack in the old inductive datatype module: we
accept nested inductive declarations.
2018-08-23 10:49:40 -07:00
Leonardo de Moura
82095cc018 refactor(kernel): split declaration into declaration and constant_info
This is just another step towards the design described at commit 16598391a07d4a
2018-08-22 17:53:11 -07:00
Leonardo de Moura
f3e99286bb chore(kernel): remove certified_declaration 2018-08-22 12:11:34 -07:00
Leonardo de Moura
dc477db71e chore(kernel/environment): remove environment::is_descendant
We will remove certified_declaration since we are adding tasks to the
kernel. We have removed `environment::replace`. We also don't need it
for checking the consistency of thread local caches since they will be
removed.
2018-08-21 13:25:58 -07:00
Leonardo de Moura
f6684b24c6 chore(kernel): cleanup 2018-08-21 13:09:27 -07:00
Leonardo de Moura
d9399924c9 chore(kernel/type_checker): hide aux procedure 2018-08-21 12:59:12 -07:00
Leonardo de Moura
027ce06f89 chore(kernel/environment): remove environment::replace
We added tasks to the runtime.
2018-08-21 12:47:08 -07:00
Leonardo de Moura
47d74e1a5a chore(kernel/declaration): minor cleanup 2018-08-21 10:11:23 -07:00
Leonardo de Moura
9d35d31529 refactor(kernel): merge constant_assumption and axiom 2018-08-01 09:57:47 -07:00
Leonardo de Moura
c0b93d3694 refactor(kernel): remove unnecessary certify_unchecked 2018-07-30 12:54:05 -07:00
Sebastian Ullrich
7cb90bedfe fix(src/kernel/old_type_checker): literals in inductive defs 2018-07-12 10:55:28 +02:00
Leonardo de Moura
bda46cc9ac feat(kernel): add inductive_decl type on top of runtime/object, and ajust kernel/inductive.cpp 2018-06-26 12:16:33 -07:00
Leonardo de Moura
bb0b43798c feat(kernel/declaration): add wrappers for accessing inductive/constructor/recursor declarations 2018-06-25 15:01:02 -07:00
Leonardo de Moura
7684860aec feat(kernel): add C++ wrappers for creating inductive declarations 2018-06-25 14:24:48 -07:00
Leonardo de Moura
ec1aa2553c refactor(kernel/declaration): implement definition/constant/axiom/theorem using runtime/object
TODO: inductive, constructor, recursor
2018-06-25 10:05:45 -07:00
Leonardo de Moura
9c6238e1ac refactor(kernel/declaration): reducibility hints as runtime/object 2018-06-25 08:04:44 -07:00
Leonardo de Moura
fd0f142bae chore(kernel/expr): comment 2018-06-22 14:48:42 -07:00
Leonardo de Moura
a18c508f5c chore(kernel/old_type_checker): fix test 2018-06-22 14:39:46 -07:00
Leonardo de Moura
f809758dd3 refactor(kernel/expr): remove extra field 2018-06-22 14:35:32 -07:00
Leonardo de Moura
e9f843ddf6 refactor(kernel/expr): remove mlocal_* functions
The constructors `mvar` and `fvar` have different memory layouts.
2018-06-22 14:25:31 -07:00
Leonardo de Moura
1371c636e5 refactor(kernel/expr): remove pp_name from metavariables 2018-06-22 13:12:42 -07:00
Leonardo de Moura
3729c7ffb2 chore(kernel/expr): remove some old/legacy functions 2018-06-22 12:52:14 -07:00
Leonardo de Moura
1063905d07 chore(kernel/expr): reorder constructors and fix typo 2018-06-22 12:39:16 -07:00
Leonardo de Moura
d0a54aceb6 refactor(kernel): remove unnecessary expr_kind printer 2018-06-22 12:35:38 -07:00
Leonardo de Moura
bc57c66ae3 refactor(kernel/level): naming consistency 2018-06-22 10:29:56 -07:00
Leonardo de Moura
ede1a51d60 refactor(kernel/declaration): remove self_opt flag from reducibility hints
This flag was used by the kernel to decide whether the following
heuristic should be used to avoid unfolding `f` at `is_def_eq`.

       f a =?= f b
       -----------
         a =?= b

This heuristic was introduced at Lean1 after a discussion with
Georges Gontier. Since this discussion, we added support for
caching failures of this heuristic. This proved to be much more
effective to attack the performance problems.
Moreover, we do not even use this flag in the `type_context::is_def_eq`
used during elaboration.

The current codebase contains only one place where this flag was set to
`false`: coercions generated at structure_cmd. This change was
made at commit
1c70514231
in the Lean2 codebase when we were not caching failures and
the kernel type checker was also used during elaboration.
2018-06-22 09:02:50 -07:00
Leonardo de Moura
01ea596aea refactor(kernel/expr): implement expr using runtime/object 2018-06-21 16:05:33 -07:00
Leonardo de Moura
c1de8e7ca7 chore(kernel/expr): make sure we can compile with g++ 4.9 2018-06-21 09:00:58 -07:00
Leonardo de Moura
96a9c7db78 feat(kernel/expr): add helper functions for computing scalar data offsets 2018-06-20 16:03:03 -07:00
Leonardo de Moura
bc82208591 chore(kernel/expr): move literal 2018-06-20 15:39:19 -07:00
Leonardo de Moura
fd5bfc7dfe refactor(kernel): simplify binder_info
Now, it is an enumeration type like its Lean counterpart.
2018-06-20 15:31:40 -07:00
Leonardo de Moura
c5714c2fac chore(kernel): remove expr.macro constructor
We are now ready to implement `expr` using `runtime/object`.
2018-06-19 17:54:43 -07:00
Leonardo de Moura
2b9eea3c86 chore(kernel/old_type_checker): copy&paste reduce_proj and infer_proj to old_type_checker
Remark: `old_type_checker` will be deleted in the future.
This commit is just to make sure we can compile legacy code.
2018-06-19 17:26:58 -07:00
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
0847571ea6 feat(kernel): add mdata constructor 2018-06-18 13:36: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
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
af8853829e fix(kernel/expr): bug at literal::kind 2018-06-14 16:18:15 -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
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
4c370e4558 refactor(kernel/expr): fix binder_info 2018-06-13 12:20:58 -07:00
Leonardo de Moura
335c58f8a7 feat(kernel): add expr_kind::Quote
This is a temporary expr constructor. We need it to be able to eliminate
expr_macro, and then define expr using runtime/object
2018-06-12 17:40:00 -07:00
Leonardo de Moura
e590ebf54d feat(kernel/inductive): initialize m_elim_level 2018-06-12 15:17:52 -07:00