This PR makes `mvcgen` `mintro` let/have bindings. Closes #9474.
This commit is contained in:
parent
d5e19f9b28
commit
61ea403bfa
4 changed files with 32 additions and 3 deletions
|
|
@ -262,6 +262,8 @@ where
|
|||
let f := T.getAppFn
|
||||
if f.isLambda then
|
||||
return ← onLambda goal name
|
||||
if f.isLet then
|
||||
return ← onLet goal name
|
||||
if f.isConstOf ``SPred.imp then
|
||||
return ← onImp goal name
|
||||
else if f.isConstOf ``PredTrans.apply then
|
||||
|
|
@ -273,6 +275,11 @@ where
|
|||
(·.2) <$> mIntro goal (← `(binderIdent| _)) (fun g =>
|
||||
do return ((), ← onGoal g name))
|
||||
|
||||
onLet goal name : VCGenM Expr := ifOutOfFuel (onFail goal name) do
|
||||
burnOne
|
||||
(·.2) <$> mIntro goal (← `(binderIdent| _)) (fun g =>
|
||||
do return ((), ← onGoal g name))
|
||||
|
||||
onLambda goal name : VCGenM Expr := ifOutOfFuel (onFail goal name) do
|
||||
burnOne
|
||||
(·.2) <$> mIntroForall goal (← `(binderIdent| _)) (fun g =>
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ theorem setZeroHead_spec :
|
|||
setZeroHead
|
||||
⦃⇓ _ => ⌜∃ ns', (#gns).toList = 0 :: ns'⌝⦄ := by
|
||||
mvcgen [setZeroHead]
|
||||
-- We want `mintro`duce the tuple `t` here in order for us not having to repeat its
|
||||
-- We want to see and name the tuple `t` here in order for us not having to repeat its
|
||||
-- definition in t.2.toList.tail below
|
||||
mintro t
|
||||
rename_i t
|
||||
simp
|
||||
exists t.2.toList.tail
|
||||
|
|
|
|||
22
tests/lean/run/9474.lean
Normal file
22
tests/lean/run/9474.lean
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import Std.Tactic.Do
|
||||
|
||||
open Std.Do
|
||||
|
||||
set_option mvcgen.warning false
|
||||
|
||||
abbrev gns : SVal ((List Nat)::[]) (List Nat) := fun s => SVal.pure s
|
||||
|
||||
noncomputable def setZeroHead : StateM (List Nat) Unit := do
|
||||
modify fun _ => [1, 0, 1, 2, 3, 4, 5]
|
||||
pure ()
|
||||
modify fun s => s.tail
|
||||
pure ()
|
||||
|
||||
theorem setZeroHead_spec :
|
||||
⦃⌜True⌝⦄
|
||||
setZeroHead
|
||||
⦃⇓ _ => ⌜∃ ns', #gns = 0 :: ns'⌝⦄ := by
|
||||
mvcgen [setZeroHead] -- should mintro through let/have bindings
|
||||
mleave
|
||||
rename_i t
|
||||
exists t.2.tail
|
||||
|
|
@ -494,7 +494,7 @@ theorem mkFreshNat_spec [Monad m] [WPMonad m sh] :
|
|||
(mkFreshNat : StateT AppState m Nat)
|
||||
⦃⇓ r => ⌜r = n ∧ #fst = n + 1 ∧ #snd = o⌝⦄ := by
|
||||
mvcgen [mkFreshNat]
|
||||
simp_all
|
||||
simp_all +zetaDelta
|
||||
|
||||
theorem erase_unfold [Monad m] [WPMonad m sh] :
|
||||
⦃⌜#fst = n ∧ #snd = o⌝⦄
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue