lean4-htt/tests/server_interactive/incrementalInduction.lean
Garmelon a3cb39eac9
chore: migrate more tests to new test suite (#12809)
This PR migrates most remaining tests to the new test suite. It also
completes the migration of directories like `tests/lean/run`, meaning
that PRs trying to add tests to those old directories will now fail.
2026-03-06 16:52:01 +00:00

80 lines
1.7 KiB
Text
Raw Permalink 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.

/-! Incremental reuse in `induction` -/
--set_option trace.Elab.reuse true
theorem basic (n : Nat) : True := by
induction n with
| zero => sorry
| succ =>
dbg_trace "b 0"
dbg_trace "b 1"
dbg_trace "b 2"
--^ sync
--^ insert: ".5"
-- RESET
theorem nonFirst (n : Nat) : True := by
induction n with
| zero =>
dbg_trace "n 0"
dbg_trace "n 1"
--^ sync
--^ insert: ".5"
| succ =>
dbg_trace "n 2"
--^ sync
--^ insert: ".5"
-- RESET
-- currently the pre-tac will be re-executed even if we can reuse a specific branch's tactics
theorem preTac (n : Nat) : True := by
induction n with
dbg_trace "p -1"
| zero => sorry
| succ =>
dbg_trace "p 0"
dbg_trace "p 1"
--^ sync
--^ insert: ".5"
/-! No reuse in cases where branch is run more than once -/
-- RESET
theorem wildcard (n : Nat) : True := by
induction n with
| _ =>
dbg_trace "w 0"
dbg_trace "w 1"
--^ sync
--^ insert: ".5"
-- RESET
theorem preTacMulti (x : Nat × Nat × Nat) : True := by
induction x with
cases x
| mk x =>
dbg_trace "pm 0"
dbg_trace "pm 1"
--^ sync
--^ insert: ".5"
-- RESET
theorem cases (n : Nat) : True := by
cases n with
| zero =>
dbg_trace "c 0"
dbg_trace "c 1"
--^ sync
--^ insert: ".5"
| succ =>
dbg_trace "c 2"
--^ sync
--^ insert: ".5"
-- RESET
/-!
Regression test: make sure the dependent elimination error appears on `cases`
-/
example (f : Nat → Nat) (n : Nat) (h : f n = n) := by
cases h
--^ collectDiagnostics