lean4-htt/tests/lean/run/grind_cases_tac.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

43 lines
1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
open Lean Meta Grind Elab Tactic in
elab "cases' " e:term : tactic => withMainContext do
let e ← elabTerm e none
setGoals (← Grind.cases (← getMainGoal) e)
inductive Vec (α : Type u) : Nat → Type u
| nil : Vec α 0
| cons : α → Vec α n → Vec α (n+1)
def f (v : Vec α n) : Bool :=
match v with
| .nil => true
| .cons .. => false
/--
trace: n : Nat
v : Vec Nat n
h : f v ≠ false
⊢ n + 1 = 0 → HEq (Vec.cons 10 v) Vec.nil → False
---
trace: n : Nat
v : Vec Nat n
h : f v ≠ false
⊢ ∀ {n_1 : Nat} (a : Nat) (a_1 : Vec Nat n_1), n + 1 = n_1 + 1 → HEq (Vec.cons 10 v) (Vec.cons a a_1) → False
-/
#guard_msgs (trace) in
example (v : Vec Nat n) (h : f v ≠ false) : False := by
cases' (Vec.cons 10 v)
next => trace_state; sorry
next => trace_state; sorry
/--
trace: ⊢ False → False
---
trace: ⊢ True → False
-/
#guard_msgs (trace) in
example : False := by
cases' (Or.inr (a := False) True.intro)
next => trace_state; sorry
next => trace_state; sorry