feat(init/meta/interactive): suffices tactic

Just a simple manipulation of the `have` tactic, but it allows the use of `suffices h : T, from p,` in tactic mode.
This commit is contained in:
Mario Carneiro 2017-09-04 13:04:36 -04:00 committed by Leonardo de Moura
parent 19777cf9eb
commit 87f2ec08ad
3 changed files with 17 additions and 0 deletions

View file

@ -644,6 +644,14 @@ match q₁, q₂ with
tactic.define h e
end >> skip
/--
This tactic applies to any goal. `suffices h : T` is the same as `have h : T, tactic.swap`.
It mirrors the `suffices` term in term mode. This tactic can be followed by `from P` to
prove the subgoal.
-/
meta def «suffices» (h : parse ident?) (t : parse (tk ":" *> texpr)?) : tactic unit :=
«have» h t none >> tactic.swap
/--
This tactic displays the current state in the tracing buffer.

View file

@ -44,3 +44,8 @@ example (f : ) : bool :=
begin
have : , by apply f,
end
example (f : ) : bool :=
begin
suffices: → bool, from this 0,
end

View file

@ -8,3 +8,7 @@ keyword_tactics.lean:45:15: error: solve1 tactic failed, focused goal has not be
state:
f :
keyword_tactics.lean:51:0: error: tactic failed, there are unsolved goals
state:
f :
→ bool