lean4-htt/tests/lean/run/reduceCtorIdxSimproc.lean
Joachim Breitner 257c347f9f
feat: reduceCtorIdx simproc (#10440)
This PR adds the `reduceCtorIdx` simproc which recognizes and reduces
`ctorIdx` applications. This is not on by default yet because it does
not use the discrimination tree (yet).
2025-09-18 13:05:14 +00:00

44 lines
931 B
Text

set_option warn.sorry false
axiom P : Nat → Prop
axiom aP n : P n
/-- trace: ⊢ P 0 -/
#guard_msgs in
example : P (Nat.ctorIdx Nat.zero) := by
fail_if_success simp only []
simp only [reduceCtorIdx]
trace_state
exact aP 0
/-- trace: ⊢ P 0 -/
#guard_msgs in
example : P (List.ctorIdx (List.nil : List Int)) := by
fail_if_success simp only []
simp only [reduceCtorIdx]
trace_state
exact aP 0
/-- trace: ⊢ P 1 -/
#guard_msgs in
example : P (List.ctorIdx [1,2,3]) := by
fail_if_success simp only []
simp only [reduceCtorIdx]
trace_state
exact aP 1
/-- trace: ⊢ P 1 -/
#guard_msgs in
example : P (Option.ctorIdx (.some true)) := by
fail_if_success simp only []
simp only [reduceCtorIdx]
trace_state
exact aP 1
/-- trace: ⊢ P 0 -/
#guard_msgs in
example : P (Option.ctorIdx (.none : Option Bool)) := by
fail_if_success simp only []
simp only [reduceCtorIdx]
trace_state
exact aP 0