Commit graph

3288 commits

Author SHA1 Message Date
Leonardo de Moura
a28d6a94fd feat(library/init/meta): add any_goals tactic 2017-02-06 16:23:29 -08:00
Gabriel Ebner
572c9a0de0 chore(tests/lean): fix tests after error-recovery 2017-02-06 15:15:47 +01:00
Gabriel Ebner
7946b15511 feat(frontends/lean/elaborator): recover from most errors using sorry 2017-02-06 15:15:44 +01:00
Gabriel Ebner
98f41d9b15 feat(interactive/test_single): colorized diff 2017-02-06 15:08:45 +01: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
Leonardo de Moura
8b662d19ac feat(library/init/category/monad_fail): add monad_fail type class 2017-02-05 18:46:29 -08:00
Leonardo de Moura
797b26f402 fix(frontends/lean/tactic_notation): trace messages in nested blocks were not being displayed in the correct place 2017-02-05 18:20:10 -08:00
Leonardo de Moura
30a1876fc8 feat(library/init/meta): add add_aux_decl and abstract tactics 2017-02-05 16:00:47 -08:00
Leonardo de Moura
323db5a530 feat(frontends/lean/pp): pretty print structure instances and field projections 2017-02-05 14:01:53 -08:00
Gabriel Ebner
6910f3f2b9 feat(frontends/lean/print_cmd): show sorry macro as axiom 2017-02-05 14:01:08 +01:00
Gabriel Ebner
95068e4e79 feat(library/sorry): make sorry a macro 2017-02-05 14:01:03 +01:00
Gabriel Ebner
252931a470 feat(tests/lean/test_single): show unified diffs with color 2017-02-05 13:44:21 +01:00
Leonardo de Moura
84188c5aa1 feat(frontends/lean/elaborator): add pattern validator in the elaborator
@johoelzl We now produce a better message for your example:

   inductive R : ℕ → Prop
   | pos : ∀p n, R (p + n)

   lemma R_id : ∀n, R n → R n
   | (.p + .n) (R.pos p n) := R.pos p n

The new error is:

file.lean:5:2: error: invalid function application in pattern, it cannot be reduced to a constructor (possible solution, mark term as inaccessible using '.( )')
  .p + .n
2017-02-04 19:00:20 -08:00
Leonardo de Moura
9869ed1026 feat(library/equations_compiler/util): make sure "inaccessible annotations" do not leak into the type of automatically generated equational lemmas 2017-02-04 17:19:42 -08:00
Leonardo de Moura
dbb36f5412 feat(library/type_context): improve offset trick in the unifier 2017-02-04 17:15:05 -08:00
Leonardo de Moura
6d9c9b3f9a feat(library/type_context): avoid auxiliary definitions introduced by the equation compiler from being used in the type class resolution procedure
This can only happen in meta definitions, but the user may be confused
by this behavior.
2017-02-04 15:56:54 -08:00
Leonardo de Moura
e4a27a2328 chore(tests/lean/interactive): fix test output 2017-02-04 15:53:01 -08:00
Leonardo de Moura
45eb64add0 chore(tests/lean/run/listex3): we don't need the unit trick anymore 2017-02-04 13:55:51 -08:00
Leonardo de Moura
9e42f7ea30 test(tests/lean/run): add test for meta recursive definition wo recursive equation 2017-02-04 13:53:12 -08:00
Leonardo de Moura
aff5a2dd37 fix(library/init/meta): bug introduced 9bee8ce36d 2017-02-03 17:01:46 -08:00
Leonardo de Moura
2640d3085b fix(library/init/meta/interactive): name resolution problems in parametric sections 2017-02-03 14:04:59 -08:00
Leonardo de Moura
ab94e71e37 feat(library/type_context): do not fail on universe constraints of the form ?u =?= max ?u v
We solve them by creating a fresh metavariable ?w

         ?u := max ?w v

Remark: this is a precise solution.
2017-02-02 22:30:30 -08:00
Leonardo de Moura
b2968f450c fix(frontends/lean/elaborator): use expected type when elaborating application for the form (c^.fn a)
For example, the following definition did not work before this commit:

  protected meta def map {α β} (f : α → β) : lazy_tactic α → lazy_tactic β
  | t s := (t s)^.for (λ ⟨a, new_s⟩, (f a, new_s))
2017-02-02 19:56:50 -08:00
Leonardo de Moura
9bee8ce36d fix(frontends/lean/elaborator): thunk gadget should not be considered in patterns
The new test demonstrates the problem.
2017-02-02 17:28:03 -08:00
Johannes Hölzl
3be8deb2d2 fix(library/tactic/generalize_tactic): instantiate mvars before calling kabstract 2017-02-01 18:48:10 -08:00
Leonardo de Moura
a9821f6437 fix(library/type_context): bug in revert method
We should not assume that the arguments at to_revert are sorted by idx.
This commit fixes the bug reported at:
https://groups.google.com/forum/#!topic/lean-user/x4Zwpou3le0
2017-02-01 10:51:24 -08: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
7cc31835e4 refactor(library/init/meta/fun_info): cleanup fun_info API 2017-01-31 18:01:54 -08:00
Leonardo de Moura
49a0d13c50 feat(library/init/coe): add coercion from A to (option A)
A little hack is used to make sure type class resolution will not enter
in an infinite loop.
2017-01-31 17:45:41 -08:00
Leonardo de Moura
920e845b84 refactor(library/init/meta/congr_lemma): cleanup congr_lemma API 2017-01-31 16:46:13 -08:00
Leonardo de Moura
2874a783e0 test(tests/lean/run/defaul_param3): more tests for default param values 2017-01-31 15:28:06 -08:00
Leonardo de Moura
be6ca7c244 feat(frontends/lean): allow default parameter values in constant decls 2017-01-31 15:19:47 -08:00
Leonardo de Moura
3a4ef00f66 feat(frontends/lean): allow constructor parameters to be declared before ':' 2017-01-31 15:11:39 -08:00
Leonardo de Moura
d315e424ff feat(library/congr_lemma, library/fun_info): make sure opt_param gadget do not confuse the simplifier, fun_info, congr_lemma, etc
A definition such as

  def f (a : nat) (b : nat := a) (c : nat := a) :=
  a + b + c

should *not* be treated as a dependent function.
2017-01-30 20:23:45 -08:00
Leonardo de Moura
d3db3661af refactor(library/init/core): simpler has_sep type class with out_param 2017-01-30 18:54:56 -08:00
Leonardo de Moura
04a8518104 refactor(library/init/core): simpler has_insert type class with out_param 2017-01-30 18:50:21 -08:00
Leonardo de Moura
f176c272b4 refactor(library/init/core): simpler has_mem type class with out_param 2017-01-30 18:43:05 -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
4d3ff955d3 feat(frontends/lean): nicer syntax for default parameter values
See #1340
2017-01-30 15:54:26 -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
41bf46dbba chore(library/init): adjust Sort vs Type in definitions 2017-01-30 12:50:18 -08:00
Leonardo de Moura
4fe73d3f87 fix(frontends/lean/elaborator, kernel/error_msgs): (re-)activate distinguishing_pp_options 2017-01-30 11:54:00 -08:00
Leonardo de Moura
e21afb045f chore(tests/lean): fix tests
see #1341
2017-01-30 11:54:00 -08:00
Leonardo de Moura
3b38f71f11 fix(library,tests/lean): fix run/interactive tests, and problems in the standard library due to the new interpretation for Type
We had to change subtype to use Sort since the axiom
strong_indefinite_description uses it.

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
0e3a8758dc fix(library/equations_compiler/structural_rec): bug when synthesizing equational lemmas 2017-01-30 11:51:07 -08:00
Gabriel Ebner
e839080834 feat(init/meta/async_tactic): add tactic to prove subgoals in a different task 2017-01-28 08:27:23 +01:00
Gabriel Ebner
5fdc737dfc feat(library/tactic): store name of current declaration in tactic_state 2017-01-28 08:27:19 +01:00
Leonardo de Moura
6c0ee899ad chore(tests/lean/interactive): fix tests 2017-01-27 16:32:22 -08:00
Leonardo de Moura
9107439bce feat(frontends/lean/elaborator): default parameter prototype
See #1340
2017-01-27 16:32:22 -08:00