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

35 lines
894 B
Text

inductive P : Option Nat → Prop
| none : P .none
| somePos : x > 0 → P (some x)
theorem aux (x? : Option Nat) (h₁ : P x?) (h₂ : x?.isSome) : x?.get h₂ > 0 := by
cases h₁ with
| none => contradiction
| somePos h => exact h
def f (x? : Option Nat) (hp : P x?) : { r? : Option Nat // P r? } :=
if h₁ : x?.isSome then
let x := x?.get h₁
have : x > 0 := by
cases h₂ : x with
| zero => have := aux x? hp h₁; simp [x] at h₂; simp [h₂] at this; done
| succ x' => simp +arith
⟨some x, .somePos this⟩
else
⟨none, .none⟩
def f₁ (x : Nat) : Nat :=
let y := x + 1
by cases y with
| zero => exact 2
| succ y' => exact 1
example : f₁ x = 1 := rfl
noncomputable def f₂ (x : Nat) : Nat :=
let y := x + 1
by induction y with
| zero => exact 2
| succ y' => exact 1
example : f₂ x = 1 := rfl