lean4-htt/tests/elab/2199.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

44 lines
1.1 KiB
Text

/-!
# Make sure local instance detection can handle metavariables and other reductions
-/
/-!
Reported in https://github.com/leanprover/lean4/issues/2199
The `inferInstance` was failing due to metavariables introduced by `cases`.
-/
theorem exists_foo : ∃ T : Type, Nonempty T := ⟨Unit, ⟨()⟩⟩
example : True := by
cases exists_foo
rename_i T hT
have : Nonempty T := inferInstance
trivial
/-!
The `let` would inhibit `inst` from being seen as a local `Decidable` instance.
Two tests: one where `let` starts a telescope, and another where it's at the end.
(Having `let`s in the middle of a forall telescope always worked.)
-/
axiom p : Nat → Prop
axiom inst : let n := 5; Decidable (p n)
example : True := by
have := inst
have : Decidable (p 5) := inferInstance
trivial
axiom inst' : ∀ k, let n := k; Decidable (p n)
example : True := by
have := inst'
have : Decidable (p 5) := inferInstance
trivial
/-!
This worked before, but here's an extra test that abbreviations are correctly handled.
-/
abbrev D (p : Prop) := Decidable p
example (p : Prop) [D p] : (if p then True else False) ↔ p := by
split <;> simp_all