Commit graph

102 commits

Author SHA1 Message Date
Leonardo de Moura
77d3a788e8 refactor(init): init/category ==> init.control 2018-04-27 08:33:08 -07:00
Leonardo de Moura
1ad1080f11 refactor(library): keep only basic nat theorems
All theorems are proved without using the tactic framework.
Thus, we can define `fin/uint32/uint64` types and their operations
before we define the tactic framework.
2018-04-11 16:47:54 -07:00
Leonardo de Moura
5f99056c1a feat(library/init/meta): basic support for ignoring auto and opt params 2017-11-21 11:52:40 -08:00
Leonardo de Moura
b9b3b43471 chore(library/init/meta/expr): helper predicates 2017-11-16 11:03:10 -08:00
Leonardo de Moura
394e0d5f0a refactor(library/init): remove has_cmp and is_ordering type classes
Now, `cmp` is just a fixed helper function.
In the future, we will be able to use (more efficient) specialized
versions during code generation by defining simp rules.
2017-11-14 08:33:24 -08:00
Leonardo de Moura
c4605b3b96 refactor(library/init): rename has_ordering => has_cmp 2017-11-13 14:47:14 -08:00
Leonardo de Moura
b40f3af801 feat(library/init/meta): move rb_tree and rb_map to native namespace
cc @kha
2017-11-07 13:41:45 -08:00
Sebastian Ullrich
4d1c4aee03 feat(init/meta/mk_has_reflect_instance): add derive_handler for has_reflect 2017-09-11 16:56:03 -07:00
Sebastian Ullrich
e18a14d6e0 fix(init/meta/expr): reflected.subst should always return an expr of the correct type 2017-09-11 16:56:03 -07:00
Sebastian Ullrich
52a9f82bc2 feat(init/meta/derive): implement [derive] attribute 2017-09-05 23:14:34 +02:00
Sebastian Ullrich
cbf65c1339 fix(init/meta/interactive): implement generalize2 via generalize/kabstract 2017-07-17 13:59:21 +02:00
Leonardo de Moura
9afb53fad5 feat(kernel/expr): allow metavariables to have user-facing names
We need this feature for:
1) Defining nonlinear search patterns. Example: (?m <= ?m + 1)
2) Preprocessing recursive equations and support the pattern
refinement approach used in Agda. Example: in Agda, they accept
```
def append {A : Type} : Π (m n : nat), Vec A m -> Vec A n -> Vec A (m + n)
| m n nil            ys := ys
| m n (cons m' x xs) ys := cons x (append m' n xs ys)
```
These equations have to be refined. For example, `m` has to be
replaced with `0` (in the first equation), and `succ m'` in the
second. To implement this kind of refinement, we need to convert
the pattern variables (local constants) into metavariables during
elaboration. Then, the unassigned metavariables become local constants
again. This preprocessing step will fix some of the issues on #1594.
To completely fix #1594, we will need yet another preprocessing step
which will implement "complete transition" used in the equation
compiler before we start elim_match.cpp
2017-07-16 07:16:41 -07:00
Leonardo de Moura
70b27fb2d3 feat(library/init/meta/interactive): unfold is now based on the simp framework
See issue #1694.

There is an orthogonal issue. `simp` (and consequently `unfold`) cannot be used to
reduce projections (e.g., `has_add.add`). This issue has been
previously raised by @Armael, but it was not addressed yet.
2017-07-02 11:30:48 -07:00
Leonardo de Moura
d73facb8bc feat(library/init/meta/expr): add expr.has_local_in 2017-07-01 20:23:37 -07:00
Sebastian Ullrich
9033cba7d3 feat(frontends/lean,init/meta/interactive): assume and suppose tactics 2017-06-27 18:50:10 -07:00
Daniel Selsam
d95b003c0b feat(init/meta/congr_tactic.lean): tactic to apply congruence rules 2017-06-26 09:17:53 -04:00
Leonardo de Moura
b8fa7f5311 fix(library): expr, level, hash_map, rb_map has_repr instances should be has_to_string since they do not produce results that can be parsed by Lean
See #1664
2017-06-18 18:33:27 -07:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Gabriel Ebner
1a81425098 chore(library): convert comments to docstrings 2017-06-12 15:17:00 +02:00
Rob Lewis
6f545718a0 fix(reflect): move format instance to expr.lean 2017-06-08 15:54:41 +02:00
Leonardo de Moura
4eefc41b6e refactor(*): wrap string in a structure
We want to make sure string users do not depend on the string
implementation. This is the first step.

We need this refactoring *now* to make sure it will not be
super painful to address issue #1175
2017-06-07 17:30:49 -07:00
Gabriel Ebner
04f9eb0b4f refactor(library/init/meta/expr): pure Lean implementation of reflected 2017-06-01 10:17:51 +02:00
Leonardo de Moura
8b0cca57d1 fix(library/noncomputable): fixes #1631
This commit fixes issue #1631. However, it is not a perfect solution.
This commit improves the predicate that checks whether a definition is
noncomputable or not. This predicate was implemented before we had
a code generator.
We should refactor the code and use the code generator to check
whether a definition is noncomputable or not. Otherwise, we will
keep finding mismatches between the predicate at noncomputable.cpp
and what the code generator implements.
2017-05-31 23:16:37 -07:00
Leonardo de Moura
42eeb445d4 fix(library): make sure `(t) does not evaluate t
See #1631
2017-05-31 22:03:15 -07:00
Leonardo de Moura
e163b5c884 feat(library/init/meta/expr): binder_info.other ==> binder_info.aux_decl 2017-05-23 21:42:52 -07:00
Sebastian Ullrich
49e5c69447 fix(init/meta/expr): have all reflected defns accept Sort 2017-05-23 11:00:33 +02:00
Sebastian Ullrich
9507297687 fix(init/meta/expr,library): reflect should accept Props
Fixes #1590
2017-05-19 14:17:06 +02:00
Sebastian Ullrich
84997bf4de refactor(init/meta/expr): unify expr and pexpr 2017-05-17 10:38:12 -07:00
Leonardo de Moura
4575c9e038 feat(frontends/lean): swap (t) and ``(t) semantics 2017-05-15 09:41:31 -07:00
Sebastian Ullrich
808ab73d93 refactor(init): use list for expr.macro args 2017-05-14 19:17:28 -07:00
Sebastian Ullrich
42eb0c680e feat(kernel/inductive,library/inductive_compiler): do not enforce positivity rule on meta inductives 2017-05-14 19:17:28 -07:00
Sebastian Ullrich
4b21b13649 refactor(init): replace has_quote class with reflected 2017-05-09 16:02:42 -07:00
Sebastian Ullrich
ead6318ee0 feat(frontends/lean/elaborator): substitute reflected locals into expr quotes 2017-05-09 16:02:41 -07:00
Sebastian Ullrich
2825c5fbcc feat(frontends/lean/elaborator): elaborate ``(e) to type reflected e` if possible and add coercion reflected -> expr 2017-05-09 16:02:41 -07:00
Leonardo de Moura
5cef84709f refactor(library): avoid auxiliary definitions such as add/mul/le/etc
See Section "Other goodies" at
https://github.com/leanprover/lean/wiki/Refactoring-structures

This commit also improves the support for projections in the
unifier/matcher.

Now, we consider the extra case-split for projections.
Given a projection `proj`, and the constraint `proj s =?= proj t`, we need to try first `s =?= t` and if it fails, then try to reduce.
This is needed in the standard library because we now have constraints such as:
```
@has_le.le ?A ?s ?a ?b  =?=  @has_le.le nat nat.has_add x y
```
If we reduce the right hand side, we get the unsolvable constraint
```
@has_le.le ?A ?s ?a ?b  =?=  nat.le x y
```
Before this change, the constraint was `@le ?A ?s ?a ?b  =?=  @le nat nat.has_add x y`, and we already perform a case-split in this case.
Moreover, projections were eagerly reduced whenever possible.
The extra case-split generates a performance problem in several tests. For example `fib 8 = 34` was timing out.
I worked around this issue by performing the case-split only when the constraint contains meta-variables.
There are also minor issues. Example. `<` is notation for `has_lt.lt`, but `>` is for `gt`.
2017-05-01 08:52:19 -07:00
Sebastian Ullrich
0ca6e2c96f refactor(library/{type_context,compiler/preprocess},frontends/lean/elaborator): use opaque, general type class instead of special app elaboration for eval_expr 2017-04-27 16:04:59 -07:00
Sebastian Ullrich
c8c8c27654 feat(init/meta): add has_to_format instances and prefer direct has_to_tactic_format implementations 2017-04-11 17:07:28 -07:00
Sebastian Ullrich
026c5ee509 fix(library/init/meta/expr,library/vm/vm_expr): fix macro args 2017-04-11 17:07:28 -07:00
Leonardo de Moura
71685e4dd6 feat(frontends/lean): add support for t.<id> and t.<idx> when t is a composite term
Replace `^.` with `.` in the stdlib
2017-03-28 17:47:49 -07:00
Sebastian Ullrich
3ead6be9ca feat(init): add default value proofs to the monadic hierarchy 2017-03-27 13:42:08 -07:00
Sebastian Ullrich
9cf80a6c94 feat(init/meta/interactive): rw goal info on ] 2017-03-22 07:54:12 -07:00
Leonardo de Moura
31b6dc222d feat(library/init/meta/expr): add expr.is_annotation 2017-03-18 13:40:11 -07:00
Daniel Selsam
538ac8d187 feat(inductive_compiler): generate injectivity lemmas 2017-03-10 22:27:18 -08:00
Johannes Hölzl
0ad5f5bc89 feat(library/init/meta/expr): add instantiate_local(s) 2017-03-07 19:30:51 -08:00
Sebastian Ullrich
5d68938a9c feat(frontends/lean): expr literals ```(...) 2017-03-05 08:37:16 -08:00
Leonardo de Moura
57c125c60e chore(library/init/meta/expr): unsigned ==> nat 2017-02-24 19:34:11 -08:00
Sebastian Ullrich
a443a5b7a6 chore(init/meta,tools/super): remove obsolete set_option eqn_compiler.max_steps 2017-02-23 01:52:13 +01:00
Sebastian Ullrich
908a7bd9f3 feat(frontends/lean/parser): expr patterns 2017-02-23 01:52:13 +01:00
Sebastian Ullrich
a053175714 refactor(init/meta,library/vm): use structure for position information 2017-02-21 11:06:39 -08:00
Leonardo de Moura
2f6f1eb458 feat(library/init): add helper functions 2017-02-18 16:23:15 -08:00