lean4-htt/tests/elab/grind_mvar_hyps.lean
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

47 lines
1.2 KiB
Text

/-!
# Issue #12242: grind fails when hypotheses contain metavariables
When `refine` introduces metavariables that appear in both hypotheses and the target,
`grind` should be able to close the goal. Previously, `abstractMVars` only abstracted
metavariables in the target, creating a disconnect between the target (using an fvar)
and hypotheses (still using the mvar).
-/
-- Original example from the issue
theorem grind_mvar_fail_2 (a res : Int) :
∃ x : Int,
(a = x) →
(x = res) →
(x = res) := by
refine ⟨?_, ?_⟩
rotate_left
intro h h2
grind
repeat constructor
-- Simpler version: mvar in hypothesis directly proves goal
theorem grind_mvar_simple (a : Nat) :
∃ x : Nat, (x = a) → (x = a) := by
refine ⟨?_, ?_⟩
rotate_left
intro h
grind
exact a
-- Multiple hypotheses sharing the same mvar
theorem grind_mvar_chain (a b c : Nat) :
∃ x : Nat, (a = x) → (x = b) → (a = b) := by
refine ⟨?_, ?_⟩
rotate_left
intro h1 h2
grind
exact a
-- Mvar in a more complex expression
theorem grind_mvar_complex (a b : Int) :
∃ x : Int, (a = x) → (x = b) → (a = b) := by
refine ⟨?_, ?_⟩
rotate_left
intro h1 h2
grind
exact a