Commit graph

188 commits

Author SHA1 Message Date
Sebastian Ullrich
84997bf4de refactor(init/meta/expr): unify expr and pexpr 2017-05-17 10:38:12 -07:00
Sebastian Ullrich
ead6318ee0 feat(frontends/lean/elaborator): substitute reflected locals into expr quotes 2017-05-09 16:02:41 -07:00
Daniel Selsam
b7d20a333f chore(src/library/constants): rm unused constants 2017-05-04 16:34:32 -07:00
Sebastian Ullrich
b37b1fb7c6 refactor(library/type_context,frontends/lean/elaborator): move reflected code back into elaborator
Since we do not want recursive special handling of `reflected`, this seems to be
the simpler design.
2017-05-03 13:27:35 -07:00
Leonardo de Moura
ba5eccdca8 refactor(library/init/core): rename out_param => inout_param
It is really input/output.
2017-05-01 14:01:41 -07:00
Leonardo de Moura
66a1fec94e feat(library/init/category): add has_orelse type class 2017-05-01 09:58:27 -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
e9a6c544af refactor(frontends/lean/{elaborator,structure_cmd}): compile structure inheritance to nested fields 2017-04-24 19:35:15 +02:00
Leonardo de Moura
0d97700c60 feat(library/compiler): add support for and.rec in the code generator 2017-04-16 13:31:37 -07:00
Sebastian Ullrich
c7b47c7b7f fix(system/io): try to fix io monad 2017-03-27 13:42:08 -07:00
Leonardo de Moura
527c8851a8 refactor(library/system/io): use type classes 2017-03-23 14:29:07 -07:00
Leonardo de Moura
60dd85719c feat(library/system/io): system.io without axioms 2017-03-22 23:36:05 -07:00
Sebastian Ullrich
421a6d6f01 feat(frontends/lean/interactive,emacs): highlight current tactic parameter 2017-03-17 18:20:44 -07:00
Daniel Selsam
538ac8d187 feat(inductive_compiler): generate injectivity lemmas 2017-03-10 22:27:18 -08:00
Sebastian Ullrich
16558bf082 refactor(library,library): rename pre_monad to has_bind 2017-03-09 20:32:25 -08:00
Sebastian Ullrich
763097dbd2 refactor(library): revise the monadic hierarchy 2017-03-09 20:30:03 -08:00
Leonardo de Moura
4ab0a6d8d2 fix(library): problems with the subtype constructor and field renaming
The problem was not detected by the test suite because of issue #1446
2017-03-08 19:42:12 -08:00
Leonardo de Moura
839645c489 feat(library/system/io): replace io.monad with io.bind, io.return and io.map 2017-03-07 16:10:47 -08:00
Sebastian Ullrich
5d68938a9c feat(frontends/lean): expr literals ```(...) 2017-03-05 08:37:16 -08:00
Sebastian Ullrich
908a7bd9f3 feat(frontends/lean/parser): expr patterns 2017-02-23 01:52:13 +01:00
Leonardo de Moura
19cf5e916b chore(script/gen_constants_cpp): generates a warning if automatically generated C++ function is not used in the source code 2017-02-21 12:05:41 -08:00
Leonardo de Moura
d1d5428808 feat(library): add check_constants.lean validation, cleanup unused names, minor stdlib fixes 2017-02-21 10:45:31 -08:00
Sebastian Ullrich
d15591a2d8 feat(library,frontends/lean): expose parser to Lean and use for parsing tactic parameters 2017-02-17 13:45:56 +01:00
Leonardo de Moura
edd5e97045 feat(frontends/lean/elaborator): coercion from (decidable) Prop to bool
This is a hard coded extra case. It is not an instance of has_coe.
Even if we change has_coe to accomodate this case, it will not be a
satisfactory solution because this coercion depends on the element and
not the type, and the element usually contains metavariables.

We should eventually write a tactic for synthesizing coercions.
2017-02-14 18:41:32 -08:00
Leonardo de Moura
1a698d9065 refactor(library/arith_instance_manager): rename to arith_instance, avoid copy&paste, and add support for norm_num 2017-02-12 19:11:58 -08:00
Rob Lewis
46a46c9ee0 feat(norm_num): handle nat subtraction as a special case 2017-02-12 17:15:08 -08:00
Leonardo de Moura
9210e45da0 feat(frontends/lean): add notation for ';' and '<|>' in the tactic interactive mode 2017-02-10 22:53:30 -08:00
Leonardo de Moura
c8bbb34e2a feat(frontends/lean): add auto_param gadget 2017-02-09 15:49:10 -08:00
Leonardo de Moura
a8c91aa6fc fix(library/compiler/preprocess): expand eq.cases_on
The code generator was failing to erase eq.cases_on.
2017-02-07 21:19:01 -08:00
Leonardo de Moura
55aa2023f4 feat(frontends/lean): add support for monad_fail type class in 'do' blocks 2017-02-05 20:09:08 -08:00
Gabriel Ebner
95068e4e79 feat(library/sorry): make sorry a macro 2017-02-05 14:01:03 +01:00
Leonardo de Moura
6e7929252f feat(frontends/lean, library/init): add 'thunk' gadget
We can now write
   trace "hello" t
instead of
   trace "hello" (fun _, t)
2017-01-31 18:41:59 -08:00
Leonardo de Moura
5da8b205b9 feat(library/type_context, frontends/lean/elaborator): type classes with output parameters 2017-01-30 18:32:54 -08:00
Leonardo de Moura
d34386fef7 perf(frontends/lean/tactic_notation): closes #1345
We can now elaborate
https://gist.github.com/gebner/439273deee592603190d4f8b4447295b
in 1.6 secs and using less than 500Kb of stack space.
It was takins 44 secs and 5Mb before this commit.

Two modifications:
1) Use pre_monad.seq instead of pre_monad.and_then.
They have the same implementation, but seq is not marked as [inline].

2) Modify how we concatenate the tactics in a begin...end block.
Before: (((a_1 ++ a_2) ++ a_3) ++ a_4)
After:  ((a_1 ++ a_2) ++ (a_3 ++ a_4))
2017-01-30 14:13:53 -08:00
Leonardo de Moura
a6f26f0b74 chore(library): poly_unit ==> punit
psum, pprod and punit are used internally.

see #1341
2017-01-30 11:54:00 -08:00
Leonardo de Moura
bf9f7560f7 feat(frontends/lean): (Type u) can't be a proposition
(Type u)  is the old (Type (u+1))
(PType u) is the old (Type u)
Type*     is the old (Type (_+1))
PType*    is the old Type*

The stdlib can be compiled, but we still have > 70 broken tests

See discussion at #1341
2017-01-30 11:54:00 -08:00
Leonardo de Moura
9107439bce feat(frontends/lean/elaborator): default parameter prototype
See #1340
2017-01-27 16:32:22 -08:00
Leonardo de Moura
cce88c6190 refactor(frontends/lean): interactive tactic support
After this commit, new interactice tactic classes can be added without
writing C++ code (see example: tests/lean/run/my_tac_class.lean).

The tactic_evaluator was simplified, and all the complexity has been
moved to tactic_notation, and lean code.

We can now inspect the intermediate states produced by the rewrite
tactic.

The function (@scope_trace _ line col thunk) can be used to position trace
messages produced by thunk. If line/col are not provided (i.e., we
just write (scope_trace thunk)), then line/col are filled with the
position of this term by the elaborator.

We can visualize the intermediate tactic states inside nested blocks
such as (try { ... })

The new infrastructure can be used to implement custom tactic_state
pretty printers.
2017-01-21 22:38:47 -08:00
Leonardo de Moura
e8839cbcdc feat(library/app_builder): add mk_eq_mpr that removes unnecessary propext 2017-01-20 20:27:41 -08:00
Leonardo de Moura
5e3f26ec95 feat(library/tactic/smt/congruence_closure): propagate not_exists 2017-01-06 14:00:36 -08:00
Leonardo de Moura
7ba889b5cf feat(frontends/lean/tactic_notation): try/repeat for smt_tactic in interactive mode 2017-01-05 18:31:57 -08:00
Leonardo de Moura
5f2b247af9 feat(frontends/lean/tactic_evaluator): step-by-step evaluation for 'begin [smt] ... end' blocks 2017-01-04 14:06:44 -08:00
Leonardo de Moura
ca6d3743c7 feat(library/tactic/smt): add mk_eq_true_intro mk_of_eq_true mk_eq_false_intro mk_not_of_eq_false 2017-01-02 13:39:16 -08:00
Leonardo de Moura
5d825483c4 refactor(library/init/meta/interactive): tactic.interactive.types ==> interactive.types
Motivation: we will use auto-quotation for other tactic monads
2016-12-30 18:06:41 -08:00
Leonardo de Moura
bb37b33237 fix(library/tactic/ac_tactics): binary.left_comm ==> left_comm 2016-12-28 21:23:07 -08:00
Leonardo de Moura
b5c1b429e7 feat(library/tactic/ac_tactics): add ac_manager helper class 2016-12-27 17:57:56 -08:00
Leonardo de Moura
9b35adfc8c feat(library/tactic/congruence/congruence_closure): add support for constructor equalities 2016-12-25 12:47:17 -08:00
Leonardo de Moura
3061d8b9a3 feat(library): add mk_int_val_ne_proof 2016-12-24 15:22:31 -08:00
Leonardo de Moura
b1b694a532 fix(library/tactic/congruence/congruence_closure): bugs, and add basic cc tactic 2016-12-23 19:30:45 -08:00
Leonardo de Moura
d431d7274a feat(library/tactic/congruence/congruence_closure): hard code support for ne 2016-12-23 15:37:05 -08:00