Commit graph

3499 commits

Author SHA1 Message Date
Jeremy Avigad
e1c024d4d9 fix(library/init/meta/simp_tactic): fix relabeling of hypotheses in simp_intro_aux 2017-06-04 13:23:26 -07:00
Jeremy Avigad
4160f23847 fix(library/init/meta/interactive): fix printing of description string for locations 2017-06-04 13:23:26 -07:00
Jared Roesch
e63f202aed chore(tests/lean): add tests for rw and simp 2017-06-04 13:23:26 -07:00
Leonardo de Moura
e22ccb4d1f feat(library/tactic/tactic_state): improve error message for unify and is_def_eq tactics
closes #1639
2017-06-03 19:52:22 -07:00
Leonardo de Moura
92a72b238b feat(library/tactic): add tactic::ref
They can be used to store user state in the tactic_state object.

@Armael @jroesch: The new file tests/lean/run/tactic_ref.lean contains a few examples.
2017-06-02 15:19:03 -07:00
Leonardo de Moura
ca5439c698 feat(frontends/lean/tactic_notation): add support for tac ; [tac_1, ..., tac_n] notation in interactive tactic mode
closes #1634

This commit also changes the semantic of `tactic.focus [tac_1, ..., tac_n]`.
It now fails if the number of goals is not `n`.
Before it would only fail if there were more tactics than goals.

@Armael: See tests/lean/run/handthen.lean for examples of the new notation.
2017-06-02 11:38:04 -07:00
Leonardo de Moura
a8173c8194 feat(library/init): heterogeneous andthen type class, and tactic.seq_focus implementation 2017-06-02 10:38:27 -07:00
Leonardo de Moura
81e97de463 feat(library/init/meta/interactive): allow metavars in the show_goal tactic 2017-06-01 19:46:38 -07:00
Leonardo de Moura
d7ab5cd8a1 feat(frontends/lean/tactic_notation): allow show keyword to be used as syntax sugar for the show_goal tactic
@kha @gebner I added the `show_goal` tactic for selecting arbitrary
subgoals. This feature is similar to the one available in Isabelle.
This commit allows us to use the `show` keyword as syntax sugar for
`show_goal`. The test `show_goal.lean` has a small example.
What do you think?

@Armael: you can use `show` to structure your proofs in tactic mode.
See `tests/lean/run/show_goal.lean` for a small example.
2017-06-01 18:52:54 -07:00
Leonardo de Moura
18467bd302 feat(library/init/meta/interactive): add show_goal tactic for structuring proofs in interactive tactic mode 2017-06-01 18:36:50 -07:00
Leonardo de Moura
00aef04b81 feat(library/init/meta/rec_util): add mk_constructors_fresh_names
@Armael @jroesch this commit implements the
`mk_constructors_fresh_names` tactic.
The new test file has a few examples.
2017-06-01 17:04:21 -07:00
Leonardo de Moura
190d792225 feat(library/init/meta/tactic): add default parameter value 2017-06-01 16:24:36 -07:00
Sebastian Ullrich
25152bc80d fix(frontends/lean/structure_cmd): use collect_implicit_locals to catch more context locals
Fixes #1623
2017-06-01 07:38:30 -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
e90bb65c7a fix(frontends/lean/elaborator): make sure coercions from (reflected t) to expr fire when t contains metavariables that can be synthesized by type class resolution 2017-05-31 23:33:48 -07: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
d8fa93b4a2 feat(library/init/meta/tactic): add dependent parameters for empty introv 2017-05-31 15:10:07 -07:00
Leonardo de Moura
1c6e70d170 feat(library/init/meta): introv tactic
@Armael: this commit implements the `introv` tactic.
The implementation uses an auxiliary `intros_dep` that introduces new
hypotheses with forward dependencies.

The `tactic.introv` tactic implemented at library/init/meta/tactic.lean
is the main implementation, but it is not nice for interactive use since
users would have to write
```
tactic.introv [`h1, `h2]
```
To make it more conveninent to use, we define another
```
meta def introv (ns : parse ident_*) : tactic unit :=
tactic.introv ns >> return ()
```
This one is in the namespace `tactic.interactive`, and
uses parser extensions. The argument `parse ident_*` instructs
the parser to parse 0 or more identifiers and create a term
of type `list name` containing these identifiers.
2017-05-31 14:09:25 -07:00
Leonardo de Moura
71ef240817 feat(library/init/meta/interactive): add nary existsi
@Armael, this commit implements the nary existsi.
We can now write
a) existsi t
b) existsi [t_1, t_2, t_3]
2017-05-31 13:41:25 -07:00
Jared Roesch
0a6a6d8676 chore(*): remove mini_crush 2017-05-31 10:10:47 -07:00
Jared Roesch
b33af82bc9 chore(*): remove super 2017-05-31 10:10:47 -07:00
Leonardo de Moura
d3298d518c fix(library/equations_compiler/elim_match): whnf_pattern 2017-05-31 10:02:59 -07:00
Gabriel Ebner
b1e417805e fix(frontends/lean/scanner): do not treat 0xFF as end-of-file
Fixes #1624.  We just replace 0xFF by 0x00 when reading a new input
byte.  This shows up as an unexpected token error.
2017-05-31 16:54:04 +02:00
Sebastian Ullrich
834375a042 fix(library/eval_helper): evaluating tactics 2017-05-31 16:18:15 +02:00
Leonardo de Moura
00b4d4bdf6 test(tests/lean/run/psum_wf_rec): add example used on Slack to test suite 2017-05-30 16:59:35 -07:00
Leonardo de Moura
72134a7bbd feat(library/equations_compiler/wf_rec): provide recursive equations to rel_tac
rel_tac is a tactic used for synthesizing a well founded relation.
The default implementation just uses type class resolution.
More sophisticated strategies may need to access the set of recursive
equations. This commit addresses this need.
2017-05-30 16:55:37 -07:00
Leonardo de Moura
d0eb7d2ed3 chore(tests/lean/run/252): fix test 2017-05-30 13:11:59 -07:00
Sebastian Ullrich
4eab11ec3d fix(frontends/lean/structure_cmd): even less error recovery 2017-05-30 19:02:25 +02:00
Gabriel Ebner
b14a248dcd fix(frontends/lean/structure_cmd): segfault 2017-05-29 07:37:50 +02:00
Leonardo de Moura
d10a799b79 chore(tests/lean/interactive/complete_field): fix test 2017-05-27 10:18:44 -07:00
Leonardo de Moura
1ee1e01f8c feat(library/tactic/smt/congruence_closure): add builtin support for (@ne A a b)
This is needed when using cc in the standard tactic monad.

closes #1608
2017-05-26 17:06:22 -07:00
Leonardo de Moura
82e51ddad5 fix(library/constructions/injective): fixes #1609
@dselsam You have assumed that the left-hand-side (t) and
right-hand-side (s) of (t = s) and (t == s) are the last two arguments.
This is a reasonable assumption, and it is correct for eq, but it is
incorrect for heq.
The type of heq is
```
Π {α : Sort u_1}, α → Π {β : Sort u_1}, β → Prop
```
Do you recall other places where we may have made this assumption?
2017-05-26 16:39:38 -07:00
Leonardo de Moura
a31e3a95ae feat(library/equations_compiler/wf_rec): improve error message for failed decreasing proofs 2017-05-26 13:55:29 -07:00
Leonardo de Moura
4bdb2da1b6 fix(library/equations_compiler): improve pull_nested_rec_fn, and make sure it communicates local propositions to the well founded recursion module
The bin_tree and num_consts examples can now be encoded more naturally.
2017-05-26 10:45:39 -07:00
Leonardo de Moura
62c24f9bb5 chore(*): remove pos_num and num from stdlib 2017-05-25 18:24:16 -07:00
Leonardo de Moura
7ffd7fea3d feat(kernel): store depth of composite terms and use it in the hash code computation
closes #1589
2017-05-25 16:51:02 -07:00
Leonardo de Moura
438ce08748 feat(library/equations_compiler/util): cleanup equation rhs
The idea is to remove hints used to define a function by well founded
recursion. See new div_eqn.lean test for an example.
2017-05-25 13:09:13 -07:00
Leonardo de Moura
9b12559239 fix(library/tactic/dsimplify): fixes #1603 2017-05-25 11:21:06 -07:00
Leonardo de Moura
0bf51e63e8 fix(library/init/meta/constructor_tactic): fixes #1598 2017-05-25 09:57:15 -07:00
Leonardo de Moura
5604835672 test(tests/lean/tree_map): closes #1457 2017-05-24 17:15:12 -07:00
Leonardo de Moura
7b98484002 test(tests/lean/run/term_app2): another well founded recursion example 2017-05-24 15:58:18 -07:00
Leonardo de Moura
c396e4519a fix(library/equations_compiler/util): missing case at prove_eq_rec_invertible
@dselsam You have used a function similar to prove_eq_rec_invertible in
the inductive compiler.
I'm wondering if this bug (missing case) may also occur in the inductive
compiler.
2017-05-24 14:34:54 -07:00
Leonardo de Moura
39b850fb10 fix(tests/lean/eqn_hole): test output 2017-05-24 14:34:54 -07:00
Leonardo de Moura
e3249dfdb9 test(tests/lean/run/term_app): add test for nested inductive type 2017-05-24 14:34:54 -07:00
Leonardo de Moura
9e9ebe9edd test(tests/lean/run/even_odd): use default decreasing tactic for defining even and odd 2017-05-24 14:34:54 -07:00
Leonardo de Moura
6ad9e3ed1e feat(library/init/meta/well_founded_tactics): add simple tactic for discharging decreasing proofs 2017-05-23 22:07:46 -07:00
Leonardo de Moura
18c7f5f1b7 refactor(library/init/data/sigma/lex): define psigma.lex
We actually use psigma instead of sigma in the equation compiler.
2017-05-23 20:39:09 -07:00
Leonardo de Moura
229b730c15 feat(library/equations_compiler): invoke tactics for building well founded relation, and proving recursive calls are "decreasing" 2017-05-23 16:04:55 -07:00
Leonardo de Moura
4fbb65d9f1 feat(frontends/lean,library/equations_compiler): store tactics for generating well founded relation and decreasing proofs 2017-05-23 15:00:29 -07:00