Induction separates a natural-number statement into a base case and a step. The step is not permission to assume the final theorem: its hypothesis applies only to the predecessor n. In the displayed proof, the zero identities settle the base. The successor identities expose the predecessor equality, where ih can be used. The simp only list makes the selected rewriting facts explicit. This example does not call Nat.add_comm, although it uses smaller basic library identities. The worked proof has native Lean 4.33.1 compilation evidence and was also compiled in the separately versioned browser fork. Completing this exercise still requires checking your own edited source.
Your task
Complete the successor case using Nat.succ_add, Nat.add_succ and ih. Explain which occurrence is transformed by each fact.
theorem nat_add_comm (n m : Nat) : n + m = m + n := by
induction n with
| zero =>
simp only [Nat.zero_add, Nat.add_zero]
| succ n ih =>
sorry
Show hints
- First express each successor sum as a successor of a smaller sum.
- The remaining sums are n + m and m + n; ih relates them.
- Reference idea: simp only [Nat.succ_add, Nat.add_succ, ih].
When you get stuck
Read the expected type, compare it with your term, and change one line. The experimental browser checker provides actual diagnostics. Goal information is available at the checked cursor when the runtime supports it; it is a source snapshot, not a live language server. Independent exercise verification is not available.
Use the error repair guide