Commit graph

326 commits

Author SHA1 Message Date
Leonardo de Moura
77d3a788e8 refactor(init): init/category ==> init.control 2018-04-27 08:33:08 -07:00
Sebastian Ullrich
bcbe5ec9f4 refactor(init/category/functor): merge has_map into functor 2018-03-20 14:58:36 -07:00
Sebastian Ullrich
1c6861528b refactor(init/category): move monad laws into separate type classes defined after the tactic framework 2018-03-20 14:58:35 -07:00
Leonardo de Moura
2889482fe9 fix(library/init/meta/interactive): fixes #1943 2018-03-06 17:36:18 -08:00
Sebastian Ullrich
61b6e26671 fix(init/meta/tactic): make tactic.funext work on non-abstractions 2018-02-28 12:49:22 +01:00
Leonardo de Moura
b72d465835 refactor(library/init/meta): remove tactic_state.mk_empty
The tactic_state object will contain a name_generator for creating fresh
names. `tactic_state.mk_empty` is bad because it does not have sufficient
information to create this name_generator.
Moreover `tactic_state.mk_empty` was only being used to convert
`tactic A` into a `parser A`.
We implement this primitive now in C++. In C++, we will be able
to use the parser name generator to initialize a fresh `tactic_state`.
2018-02-27 14:45:47 -08:00
Leonardo de Moura
c0267727a8 fix(library/init/meta): mk_fresh_name should not be used to create user facing names
The tactic `mk_fresh_name` is used to create internal unique ids.
We should not use them to create (temporary) user facing
names. Reasons:
1- They are "cryptic".
2- They are not very stable. Minor changes in Lean may change the
value returned and may break proofs that rely on these fresh names.
2018-02-26 10:49:53 -08:00
Leonardo de Moura
21812768b0 fix(library/init/meta/interactive): fixes #1889 2018-02-23 12:39:11 -08:00
Leonardo de Moura
24e7a5a339 feat(library/tactic): add frozen_local_instances tactic for retrieving list of frozen local instances 2018-02-23 11:39:38 -08:00
Leonardo de Moura
db4fcac40c feat(library): add tactic unfreeze_local_instances 2018-02-23 11:12:05 -08:00
Scott Morrison
5d094cf835 cleanup(init/meta/tactic) removing obsolete meta constants 2018-02-13 10:45:04 -08:00
Leonardo de Moura
1c61129d40 feat(library/init/meta/tactic): expose approx at unify and is_def_eq tactics 2018-01-25 22:27:18 -08:00
Leonardo de Moura
5bad6d5372 feat(library/init/meta/tactic): subst supports heterogeneous equalities that are actually homogeneous 2018-01-12 14:32:49 -08:00
Leonardo de Moura
587540f11b feat(frontends/lean): add abbreviation command
This command is not just a cosmetic feature.
We need it to defined `id_rhs` before the tactic framework is defined.
We want `id_rhs` to be used in all definitions generated by the equation
compiler. Right now, it is only used in definitions defined after the
tactic framework.
2018-01-05 15:40:59 -08:00
Leonardo de Moura
43d7bac49b feat(library/init/meta): add support for new unify at rw tactic 2018-01-04 13:05:55 -08:00
Leonardo de Moura
040722c7e7 feat(library/init/meta): add unify config option to apply_cfg
This commit also fixes a problem in the `apply` tactic error messages.
2018-01-04 12:51:59 -08:00
Leonardo de Moura
d44996e034 feat(library/init/meta): propagate tag information 2017-12-10 19:15:41 -08:00
Leonardo de Moura
e23db3970a feat(library/init/meta/tactic): apply tactic return parameter name associated with new metavars 2017-12-10 12:11:58 -08:00
Leonardo de Moura
41cfa1bf63 feat(library/init/meta/tactic): induction tactic returns constructor/param names 2017-12-10 09:46:39 -08:00
Leonardo de Moura
f288205cce feat(library/tactic): goal tagging 2017-12-09 16:29:03 -08:00
Leonardo de Moura
a056e87350 fix(library/init/meta/injection_tactic): add support for ginductive datatypes 2017-12-06 09:39:20 -08:00
Leonardo de Moura
b06549bc05 feat(library/init/meta): add guard_names { t } tactical 2017-12-05 16:29:46 -08:00
Leonardo de Moura
c943576e5a feat(library/init): add funext tactic 2017-12-04 14:54:39 -08:00
Leonardo de Moura
53c9737c70 feat(library/init): new repeat tactic 2017-12-04 12:55:53 -08:00
Leonardo de Moura
75aa94b34c refactor(library): rename repeat ==> iterate
Reason: we will implement a new `repeat` tactic.
2017-12-04 12:34:59 -08:00
Leonardo de Moura
47994fe14e chore(library): remove id_locked 2017-11-22 16:29:04 -08:00
Leonardo de Moura
52d6adc19c chore(library): use new structure update notation in the core lib 2017-11-17 16:57:54 -08:00
Leonardo de Moura
3f6d0979ae feat(library/init/meta/tactic): add any_hyp tactic 2017-11-16 14:28:00 -08:00
Gabriel Ebner
32ddac5f40 feat(library/tactic/kabstract): expose kabstract to VM 2017-08-14 11:41:54 +02:00
Gabriel Ebner
5922f71c50 feat(library/init/algebra/order): add default value for lt 2017-08-02 14:41:35 +01:00
Mario Carneiro
26548c956c feat(init/meta/interactive): rw at *, rw at h1 h2 |- support
Now tactics supporting locations can also specify the goal among the locations by using the name `⊢` or `|-`. Also `rw at *` is implemented so that it will rewrite any hypotheses or the goal for which the whole sequence of rewrites succeeds. (This is different from `rw at h1 h2 ... hn |-`, which requires that all rewrites run to completion on each specified target.)
2017-07-28 16:47:02 +01:00
Mario Carneiro
fb2447468b chore(init/category/combinators): remove monad.for
and variations, in favor of monad.map and variations
2017-07-26 11:52:11 +01:00
Gabriel Ebner
d68665f7a2 chore(library/init/meta/tactic): fix copy-paste error in docstring 2017-07-23 09:48:08 +01:00
Leonardo de Moura
af80c2890d chore(library/init/meta/tactic): define focus_aux using is_assigned 2017-07-21 02:39:55 -07:00
Mario Carneiro
97a01d25fd fix(init/meta/tactic): skip solved goals in seq_focus and seq
and all/any_goals. This occurs when solving the first subgoal generated by `tac1; tac2` closes the second goal as well, before the second `tac2` invocation is run. Reported by @jldodds on gitter.
2017-07-21 02:10:48 -07:00
Mario Carneiro
dfbcb72f38 chore(init/meta/tactic): remove superfluous fail clause 2017-07-20 01:28:21 -07:00
Mario Carneiro
4ae2f87bc8 refactor(init/meta/tactic): use dite instead of cases in by_cases
This fixes the issue in PR #1752 by using `dite`, which is essentially nondependent cases, so that the decidable instances are not substituted.
2017-07-20 01:28:21 -07:00
Gabriel Ebner
563c1bcffe chore(library/init/meta/tactic): make first argument of id_locked implicit 2017-07-15 17:47:46 +01:00
Leonardo de Moura
9555a104d6 feat(library/init/meta/tactic): simplify ‹p› notation
@jroesch See the new test :)
2017-07-07 12:05:02 -07:00
Sebastian Ullrich
f024ccd75d refactor(frontends/lean/token_table,library): take ~> assume 2017-07-05 11:20:10 -07:00
Leonardo de Moura
9a41f0f899 fix(library/init/meta/tactic): by_cases tactic
Before this commit, the `by_cases p` tactic would synthesize
`inst : decidable p` type class resolution, and then use the
`cases` tactic (dependent elimination). This would create
problems since occurrences of `inst` would be replaced with
`decidable.is_true h` in one branch, and `decidable.is_false h` in the
other. Where `h`s (we have two of them, one for each branch) are
fresh hypotheses introduced by the `cases` tactic.
For example, assume we have the term in our goal.

        `@ite p inst A a b`

This term would become

        `@ite p (decidable.is_true h) A a b` (in the first branch where `h : p`)

and
        `@ite p (decidable.is_false h) A a b` (in the second where `h : not p`)

Now, suppose we try to executed the following tactic in the first branch

        `rw [if_pos h]`

it will fail since `if_pos h` is actually `@if_pos p inst h`, and
we will not be able to unify

        `@ite p (decidable.is_true h) A a b =?= @ite p inst ?A ?a ?b`

This commit workarounds this problem by applying cases on
`@decidable.em p inst : p or not p` instead of `inst : decidable p`.
Thus, the term `inst` is not replaced with `decidable.is_true h` and
`decidable.is_false h`.

The new test `tests/lean/run/simp_dif.lean` demonstrates the problem above.
2017-07-02 21:34:10 -07:00
Leonardo de Moura
3422c8816e feat(library/init/meta/simp_tactic): improved simp_all tactic
It now performs self simplification, and the performance is slightly
better. As described at issue #1675, only non dependent propositions
are considered.

@Armael: this tactic may be useful for you
2017-07-01 20:26:29 -07:00
Leonardo de Moura
f7fe2a775c feat(library/init/meta/rewrite_tactic): improve rewrite tactic
`rewrite` tactic improvements
- Add support for `auto_param` and `opt_param`
- Order new goals using the same strategies available for `apply`
- Allow user to set configuration object in interactive mode.

@Armael This commit should address the issue you raised about the order
of new goals in the `rewrite` tactic.
See new test tests/lean/run/rw1.lean for examples.
2017-06-30 12:03:27 -07:00
Leonardo de Moura
fe51bebab3 refactor(library/init/meta/converter): new conv monad implementation 2017-06-29 16:37:22 -07:00
Leonardo de Moura
103b5d09b3 feat(library/init/meta/tactic): add option for not creating new subgoals at to_expr 2017-06-28 16:46:29 -07:00
Leonardo de Moura
73b6facd1e refactor(library/init/meta): move replace_hyp to tactic.lean 2017-06-28 14:27:32 -07:00
Leonardo de Moura
6ba425da6a feat(library/init/meta/interactive): add apply_with interactive tactic
The new tactic allows us to set apply_cfg in interactive mode.
2017-06-27 18:37:13 -07:00
Leonardo de Moura
e971acabb0 feat(library/init/meta): handle auto_params and opt_params at apply tactic 2017-06-27 18:17:48 -07:00
Leonardo de Moura
9b03309d83 fix(library/equations_compiler): performance problem reported by @dselsam 2017-06-27 15:24:12 -07:00
Leonardo de Moura
9fdb1c4a4d chore(library/init/meta/tactic): mark id_locked as [inline] 2017-06-27 13:43:24 -07:00