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

25 lines
793 B
Text

def f' (n : Nat) : Option { r : Nat // r ≤ n } :=
match n with
| 0 => some ⟨0, Nat.le_refl _⟩
| n+1 => match f' n with
| some ⟨m, h₁⟩ =>
have : m < n+1 := Nat.lt_of_le_of_lt h₁ (Nat.lt_succ_self _)
match f' m with
| some ⟨r, h₂⟩ => some ⟨r, Nat.le_trans h₂ (Nat.le_trans h₁ (Nat.le_succ _))⟩
| none => none
| none => none
theorem f'_ne_none (n : Nat) : f' n ≠ none := by
match n with
| 0 => simp (config := { decide := false }) [f']; done
| n+1 =>
simp [f']
have ih₁ := f'_ne_none n
split
next m h₁ he =>
have : m < n+1 := Nat.lt_of_le_of_lt h₁ (Nat.lt_succ_self _)
have ih₂ := f'_ne_none m
split
next => simp
next h => contradiction
next => contradiction