Proofs
Proof by induction
Prove a property for all natural numbers using a base case and a successor case.
Open Induction.lean in editortheorem zero_add (n : Nat) : 0 + n = n := by
induction n with
| zero => rfl
| succ n ih =>
simp only [Nat.add_succ, ih]
#check zero_add
Explanation
induction n with
Splits a proof into zero and successor cases, following Nat’s constructors.
ih
The induction hypothesis: the property is already known for the smaller n.
simp only [ … ]
Simplifies using the listed lemmas and built-in reductions, without the default simp lemma set.
Expected output
Reference only. Run the file to check its actual result.
zero_add (n : Nat) : 0 + n = n
Exercise
Inspect the successor case and explain where the induction hypothesis is used.