Commit graph

4841 commits

Author SHA1 Message Date
Leonardo de Moura
dec166b387 chore(library/module): remove dead info 2018-08-27 15:35:10 -07:00
Leonardo de Moura
d27a360912 chore(library/update_declaration): remove dead file 2018-08-27 15:18:23 -07:00
Leonardo de Moura
4917ab0c65 chore(library): remove congr_lemma 2018-08-23 16:48:43 -07:00
Leonardo de Moura
e0f7fa3bd9 chore(library/tactic): remove leftovers 2018-08-23 16:00:34 -07:00
Leonardo de Moura
d334bb1fa7 chore(*): remove more stuff 2018-08-23 15:56:31 -07:00
Leonardo de Moura
17ae59b5b0 chore(*): remove more stuff 2018-08-23 15:27:12 -07:00
Leonardo de Moura
c21555240a chore(library/tactic): remove more stuff 2018-08-23 15:20:07 -07:00
Leonardo de Moura
5f65b3a6f1 chore(library/tactic): remove unused bindings 2018-08-23 15:04:23 -07:00
Leonardo de Moura
e2b912237d chore(library/native_compiler): remove leftovers 2018-08-23 14:58:57 -07:00
Leonardo de Moura
a7f6d1d38d chore(library/tactic): remove tactic/eval.cpp and tactic/gexpr.cpp 2018-08-23 14:54:41 -07:00
Leonardo de Moura
22101a2c55 chore(library/tactic): remove assert_tactic and change_tactic 2018-08-23 14:50:55 -07:00
Leonardo de Moura
05a6d8a791 chore(library/tactic): remove destruct_tactic, generalize_tactic and fun_info_tactics 2018-08-23 14:47:51 -07:00
Leonardo de Moura
ed5d884d8f chore(library/tactic): remove app_builder_tactics 2018-08-23 14:22:00 -07:00
Leonardo de Moura
a6604dcf56 chore(library/tactic): remove rewrite and apply and interactive tactics 2018-08-23 14:18:16 -07:00
Leonardo de Moura
7a47406c4c chore(library/tactic): remove simp_lemmas 2018-08-23 14:10:36 -07:00
Leonardo de Moura
88c8c560a9 chore(library/equations_compiler): do not generate equation lemmas 2018-08-23 14:04:37 -07:00
Leonardo de Moura
22ba0a1155 chore(library): remove inverse.cpp
We used this module to implement inductive_compiler pack/unpack functions
2018-08-23 13:16:27 -07:00
Leonardo de Moura
8e351d46a1 chore(library/equations_compiler): remove support for pack/unpack
We don't need it anymore because we removed inductive_compiler/nested.cpp
2018-08-23 13:16:27 -07:00
Leonardo de Moura
7fb763c50f chore(library/tactic): remove dsimp and unfold tactics 2018-08-23 11:57:38 -07:00
Leonardo de Moura
ef27df8907 chore(library/tactic): remove simp 2018-08-23 11:57:38 -07:00
Leonardo de Moura
9b4f59e511 chore(library/inductive_compiler): remove simp references 2018-08-23 11:57:38 -07:00
Leonardo de Moura
fc96c335fb chore(library/constructions): remove has_sizeof
This will be implemented in Lean in the future.
2018-08-23 11:57:38 -07:00
Leonardo de Moura
dc479c6837 chore(library/inductive_compiler): remove mutual.cpp 2018-08-23 11:57:38 -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
Sebastian Ullrich
5c066b6e84 fix(library/derive_attribute): pass options to type_context 2018-08-23 10:48:38 -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
Sebastian Ullrich
6009279ab3 fix(library/compiler/cse): deactivate CSE for constructor applications
Fixes 1968
2018-08-22 14:32:03 -07:00
Sebastian Ullrich
6384d118a8 fix(frontends/lean/builtin_cmds,library/vm/vm): fix debug build 2018-08-22 14:32:03 -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
04fbbbb0d6 refactor(library/init/lean/declaration): declaration -> constant_info
This is the first step in the declaration vs constant_info refactor.
Here is the design notes:

In Lean3, we use the `declaration` objects to represent new declarations
that are sent to the kernel, and to store information for all constants
declared in an environment.
This design decision was done when we did not have support for
mutual (meta) declarations, and information about inductive datatypes,
constructors and recursors were stored in an environment extension.
This design now seems weird since we have four different methods for
adding declarations into the environment:
```
    environment add(certified_declaration const & d) const;
    environment add_meta(buffer<declaration> const & ds, bool check = true) const;
    environment add(inductive_decl const & decl) const;
    environment add_quot() const;
```
Moreover, we use `mk_constant_assumption` to represent inductive
datatype, constructors, recursors, and `quot` primitives.
Since inductive datatypes, constructors, recursors and `quot` primitives
are not considered axioms, we have the method:
```
    bool environment::is_builtin(name const & n) const;
```

We can avoid these hacks by having a type for representing
declarations (i.e., objects that are sent to the kernel) and
objects for storing information of the constant declarations stored
in an environment object.

A `declaration` object is now of the form
```
inductive declaration
| defn_decl        (val : definition_val)
| axiom_decl       (val : axiom_val)
| thm_decl         (val : theorem_val)
| quot_decl
| mutual_defn_decl (defns : list definition_val) -- All definitions must be marked as `meta`
| induct_decl      (lparams : list name) (nparams : nat) (types : list inductive_type) (is_meta : bool)

/-
If we want, we can let users specify their own names for `quot`,
`quot.mk`, `quot.lift` and `quot.ind`. We just need to add them
as fields of `declaration.quot_decl`.
-/
```

When we check a declaration, one or more `constant_info` objects are
created for each new constant in the declaration.
```
inductive constant_info
| assump_info   (val : assumption_val)
| defn_info     (val : definition_val)
| axiom_info    (val : axiom_val)
| thm_info      (val : theorem_val)
| quot_info     (val : quot_val)
| induct_info   (val : inductive_val)
| cnstr_info    (val : constructor_val)
| rec_info      (val : recursor_val)
```
For simple declarations `constant` (aka `assumption`), `definition`,
`theorem` and `axiom`, the information stored in the `constant_info` is
identical to the information in the `declaration` object. This is
expected since these are the original Lean3 declarations.

The `environment` object stores a mapping from `name` to
`constant_info`. The function `check` validates a declaration
and produces a `certified_declaration`. A `certified_declaration` is
a pair `(declaration, list constant_info)`. The `list` here makes it
explicit that a declaration may add one or more new constants into the
environment. Finally, the `environment` object has a single `add`
method and a single `get` and `find`:
```
    environment add(certified_declaration const & d) const;

    /** \brief Return info for the constant with name \c n (if it is defined in this environment). */
    optional<constant_info> find(name const & n) const;

    /** \brief Return info for the constant with name \c n. Throws an
        exception if has not been declared in this environment. */
    constant_info get(name const & n) const;
```

Moreover, the method `environment::builtin` is not necessary anymore.
If `environment::get(n)` returns an `axiom_info` or an `assump_info`, then
we know for sure the constant named `n` has been postulated.

This commit only defined the new types in Lean. I still need to make
the changes to the C++ code base.
2018-08-21 09:59:30 -07:00
Sebastian Ullrich
a42fb533f4 fix(library/vm/vm_io): move all primitives into io
While `cmdline_args` has no side-effects, it is certainly not a pure function.
The `stdin` etc. should have been safe since all accessors are in `io`, but
better be safe than sorry.
2018-08-21 08:43:10 -07:00
Sebastian Ullrich
9db688f4c2 fix(library/{vm/vm_io,init/io}): fix bugs and tests 2018-08-21 08:43:09 -07:00
Sebastian Ullrich
0936d4d81e feat(library/init/io): introduce has_eval class to customize #eval output 2018-08-21 08:43:09 -07:00
Sebastian Ullrich
a260bf91d4 refactor(library/vm/vm_io,library/system/io): remove io classes, make errors explicit 2018-08-21 08:43:09 -07:00
Sebastian Ullrich
a02fd7fb4c feat(library/noncomputable): sorts are computable
i.e.

constant io.real_world : Type
2018-08-21 08:43:09 -07:00
Sebastian Ullrich
6e3a6ff40f feat(library/noncomputable): mark all VM builtins as computable 2018-08-21 08:43:09 -07:00
Sebastian Ullrich
d4364850ff feat(library/derive_attribute): support out_params after main parameter 2018-08-02 14:45:37 -07:00
Sebastian Ullrich
10adf10634 fix(library/derive_attribute): prevent infinite loop during parsing 2018-08-02 08:08:21 -07:00
Sebastian Ullrich
eda9e4bb3f feat(library/derive_attribute): temporary, hacky C++ implementation of @[derive] 2018-08-01 18:44:23 -07:00
Sebastian Ullrich
8033649335 chore(library/util): fix doc 2018-08-01 18:44:23 -07:00
Leonardo de Moura
9d35d31529 refactor(kernel): merge constant_assumption and axiom 2018-08-01 09:57:47 -07:00
Sebastian Ullrich
57c25ce01d feat(src/library/vm/vm): profile: record and display self times 2018-07-30 17:30:20 -07:00
Leonardo de Moura
c0b93d3694 refactor(kernel): remove unnecessary certify_unchecked 2018-07-30 12:54:05 -07:00
Gabriel Ebner
73d4a004ac fix(library/print): add missing break in switch 2018-07-27 16:27:57 -07:00
Leonardo de Moura
95f758d240 feat(library/system/io_interface): improve iterate interface
The new version is better for lifting.
2018-07-26 16:07:30 -07:00
Sebastian Ullrich
f254a906b3 fix(src/library/vm/vm_io): get_cwd 2018-07-05 10:53:07 +02:00
Sebastian Ullrich
80745ba776 chore(library/init/data/string/basic): rename string.iterator's next_to_string to remaining_to_string
The old name implied that `curr` was not part of its result
2018-07-05 10:42:37 +02:00
Leonardo de Moura
f62256853c refactor(library/init/lean/declaration): use lean.declaration to implement init.meta.declaration 2018-06-25 13:08:13 -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