lean4-htt/tests/lean/run/4390.lean
Joachim Breitner 0e49576fe4
feat: guard_msgs to treat trace messages separate (#8267)
This PR makes `#guard_msgs` to treat `trace` messages separate from
`info`, `warning` and `error`. It also introduce the ability to say
`#guard_msgs (pass info`, like `(drop info)` so far, and also adds
`(check info)` as the explicit form of `(info)`, for completeness.

Fixes #8266
2025-05-09 05:44:34 +00:00

54 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, consider using `set_option trace.split.failure true`
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