lean4-htt/tests/lean/run/9581.lean
Sebastian Graf c6df4a4a89
fix: delegate to exact in mvcgen using invariants to avoid MVar mishaps (#9939)
This PR expands `mvcgen using invariants | $n => $t` to `mvcgen; case
inv<$n> => exact $t` to avoid MVar instantiation mishaps observable in
the test case for #9581.

Closes #9581.
2025-08-16 09:40:42 +00:00

38 lines
826 B
Text

import Std.Tactic.Do
open Std.Do
set_option mvcgen.warning false
structure MyException where
def F : EStateM MyException Unit Unit := do
for _ in [0:5] do
pure ()
theorem F_spec :
⦃⌜True⌝⦄
F
⦃⇓ _ => ⌜1 < 2⌝⦄ := by
mvcgen [F]
case inv1 => exact ⇓ _ => ⌜1 < 2⌝
-- it would be nice if we had a tactic wrapper around `case inv => exact ...` that does `mleave`
-- on all subgoals afterwards.
· mleave
omega
· mleave
omega
-- Goal that could be discharged completely automatically:
-- case post.except
-- ⊢ (⇓x => ⌜1 < 2⌝).snd ⊢ₑ (⇓x => ⌜1 < 2⌝).snd
· assumption
· mleave
theorem F_spec_using_with :
⦃⌜True⌝⦄
F
⦃⇓ _ => ⌜1 < 2⌝⦄ := by
mvcgen [F]
using invariants | 1 => ⇓ _ => ⌜1 < 2⌝
with omega