fix(init/meta/interactive): whnf in assume tactic
This commit is contained in:
parent
b68fe0d645
commit
c3d4c468e6
4 changed files with 9 additions and 9 deletions
|
|
@ -523,6 +523,7 @@ meta def «assume» (p : parse parse_binders) : tactic unit :=
|
|||
list.mfor' p $ λ b,
|
||||
do t ← target,
|
||||
when (not $ t.is_pi ∨ t.is_let) whnf_target,
|
||||
t ← target,
|
||||
when (not $ t.is_pi ∨ t.is_let) $
|
||||
fail "assume tactic failed, Pi/let expression expected",
|
||||
ty ← i_to_expr b.local_type,
|
||||
|
|
|
|||
|
|
@ -78,14 +78,7 @@ meta def exact (q : parse texpr) : smt_tactic unit :=
|
|||
tactic.interactive.exact q
|
||||
|
||||
meta def «assume» (p : parse parse_binders) : smt_tactic unit :=
|
||||
list.mfor' p $ λ b,
|
||||
do t ← tactic.target,
|
||||
when (not $ t.is_pi ∨ t.is_let) tactic.whnf_target,
|
||||
when (not $ t.is_pi ∨ t.is_let) $
|
||||
fail "assume tactic failed, Pi/let expression expected",
|
||||
ty ← tactic.i_to_expr b.local_type,
|
||||
tactic.unify ty t.binding_domain,
|
||||
smt_tactic.intro_lst [b.local_pp_name]
|
||||
tactic.interactive.assume p
|
||||
|
||||
meta def «suppose» (h : parse ident?) (q : parse (tk ":" *> texpr)?) : smt_tactic unit :=
|
||||
let h := h.get_or_else `this in
|
||||
|
|
|
|||
|
|
@ -10,6 +10,12 @@ begin
|
|||
apply n
|
||||
end
|
||||
|
||||
example : ¬false :=
|
||||
begin
|
||||
assume contr,
|
||||
apply contr
|
||||
end
|
||||
|
||||
example : ℕ → ℕ → ℕ :=
|
||||
begin
|
||||
assume n m : bool,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
keyword_tactics.lean:15:2: error: unify tactic failed, failed to unify
|
||||
keyword_tactics.lean:21:2: error: unify tactic failed, failed to unify
|
||||
bool : Type
|
||||
and
|
||||
ℕ : Type
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue