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

59 lines
1.8 KiB
Text

/-!
If the recursive call is passed to the `case` tactic, it
gets duplicate fairly often, and into different contexts
(see below)
So let us construct proofs that depend on that context,
to check that the proofs are not confused.
A work-around is
```
let r := foo n
cases r
```
-/
-- set_option trace.Elab.definition.wf true
def foo : (n : Nat) → ∃ m, m > n
| 0 => ⟨1, Nat.zero_lt_one⟩
| n+1 => by
cases foo n
case _ m hm => exact ⟨m+1, Nat.succ_lt_succ hm⟩
decreasing_by
-- trace_state
solve
| have this_is_in_the_context : ∃ m, m > n := by assumption
cases this_is_in_the_context
exact Nat.lt_succ_self _
| exact Nat.lt_succ_self _
/-
[Elab.definition.wf] replaceRecApps:
match n with
| 0 => Exists.intro 1 Nat.zero_lt_one
| Nat.succ n =>
Exists.casesOn (motive := fun t => foo n = t → ∃ m, m > n + 1) (foo n)
(fun w h h_1 => Exists.intro (w + 1) (Nat.succ_lt_succ h)) (Eq.refl (foo n))
-/
/-
Contexts
n: Nat
x✝: ∀ (y : Nat), (invImage (fun a => sizeOf a) instWellFoundedRelation).1 y (Nat.succ n) → ∃ m, m > y
t✝: ∃ m, m > n
⊢ (invImage (fun a => sizeOf a) instWellFoundedRelation).1 n (Nat.succ n)
n: Nat
x✝: ∀ (y : Nat), (invImage (fun a => sizeOf a) instWellFoundedRelation).1 y (Nat.succ n) → ∃ m, m > y
⊢ (invImage (fun a => sizeOf a) instWellFoundedRelation).1 n (Nat.succ n)
n: Nat
x✝: ∀ (y : Nat), (invImage (fun a => sizeOf a) instWellFoundedRelation).1 y (Nat.succ n) → ∃ m, m > y
w✝: Nat
h✝: w✝ > n
⊢ (invImage (fun a => sizeOf a) instWellFoundedRelation).1 n (Nat.succ n)
n: Nat
x✝: ∀ (y : Nat), (invImage (fun a => sizeOf a) instWellFoundedRelation).1 y (Nat.succ n) → ∃ m, m > y
⊢ (invImage (fun a => sizeOf a) instWellFoundedRelation).1 n (Nat.succ n)
-/