theorem_proving_in_lean4
theorem_proving_in_lean4 copied to clipboard
recursion depth problem in chapter 7 examples
These examples in Chapter 7, Inductive Types raise recursion depth errors:
namespace Hidden
theorem add_zero (n : Nat) : n + 0 = n := Nat.add_zero n
open Nat
theorem zero_add (n : Nat) : 0 + n = n := by
induction n <;> simp [*, add_zero, add_succ]
theorem succ_add (m n : Nat) : succ m + n = succ (m + n) := by
induction n <;> simp [*, add_zero, add_succ]
theorem add_comm (m n : Nat) : m + n = n + m := by
induction n <;> simp [*, add_zero, add_succ, succ_add, zero_add]
theorem add_assoc (m n k : Nat) : m + n + k = m + (n + k) := by
induction k <;> simp [*, add_zero, add_succ]
end Hidden
As suggested, I tried set_option maxRecDepth 10000 (which I pulled out of thin air) which didn't help. So I set it to 1000000, at which point we get a "stack overflow detected" message.