This PR fixes `mconstructor`, `mleft`, and `mright` failing inside `mhave` blocks (#13691), and `mspecialize` failing after a `mrevert; mintro` round trip. Both cases stem from hypothesis-naming `Expr.mdata` leaking from hypothesis-conjunction leaves into non-leaf positions (an inner target, or the antecedent of an `SPred.imp` target), where downstream pattern matches did not see through it. Fixed by stripping the mdata at the offending non-leaf positions in `elabMHave`, `elabMReplace`, and `mRevert`.
41 lines
927 B
Text
41 lines
927 B
Text
import Std.Do
|
||
import Std.Tactic.Do
|
||
|
||
/-!
|
||
Regression test for #13691: tactics that pattern-match on `MGoal.target`
|
||
(`mconstructor`, `mleft`, `mright`) failed inside `mhave` because the inner
|
||
goal's target carried hypothesis-naming metadata. The related round trip
|
||
`mrevert h; mintro h; mspecialize h` failed for the symmetric reason inside
|
||
`Revert`.
|
||
-/
|
||
|
||
open Std.Do
|
||
|
||
example (P : SPred [Int]) : P ⊢ₛ P ∧ P := by
|
||
mintro hp
|
||
mhave h : spred(P ∧ P) := by
|
||
mconstructor
|
||
· mexact hp
|
||
· mexact hp
|
||
mexact h
|
||
|
||
example (P : SPred [Int]) : P ⊢ₛ P ∨ P := by
|
||
mintro hp
|
||
mhave h : spred(P ∨ P) := by
|
||
mleft
|
||
mexact hp
|
||
mexact h
|
||
|
||
example (P : SPred [Int]) : P ⊢ₛ P ∨ P := by
|
||
mintro hp
|
||
mhave h : spred(P ∨ P) := by
|
||
mright
|
||
mexact hp
|
||
mexact h
|
||
|
||
example (P Q : SPred [Int]) : P ⊢ₛ (P → Q) → Q := by
|
||
mintro HP HPQ
|
||
mrevert HPQ
|
||
mintro HPQ
|
||
mspecialize HPQ HP
|
||
mexact HPQ
|