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

55 lines
1.6 KiB
Text

def step (state: Nat): Option Nat :=
if state = 0 then none else some (state - 1)
set_option linter.unusedVariables false
def countdown (state: Nat) :=
match h: step state with
| none => [state]
| some newState => state :: countdown newState
termination_by state
decreasing_by sorry
/--
error: Tactic `split` failed: Could not split an `if` or `match` expression in the goal
state : Nat
p :
(match h : step state with
| none => [state]
| some newState => state :: countdown newState) ≠
[]
⊢ (match h : step state with
| none => [state]
| some newState => state :: countdown newState).head
p =
state
---
trace: [split.failure] `split` tactic failed to generalize discriminant(s) at
match h : step state with
| none => [state]
| some newState => state :: countdown newState
resulting expression was not type correct
possible solution: generalize discriminant(s) manually before using `split`
-/
#guard_msgs in
example (state: Nat) (p : (match h : step state with
| none => [state]
| some newState => state :: countdown newState) ≠
[]): (match h : step state with
| none => [state]
| some newState => state :: countdown newState).head
p =
state := by
set_option trace.split.failure true in
split
example (state: Nat) (p : (match h : step state with
| none => [state]
| some newState => state :: countdown newState) ≠
[]): (match h : step state with
| none => [state]
| some newState => state :: countdown newState).head
p =
state := by
split at p <;> simp