∴LeanProofs
Induction

Read an induction proof of addition

For natural numbers n and m, n + m = m + n.

Compiled with official native Lean 4.33.1 on 25 November 2026, core library only. The browser checker uses a separately identified experimental fork. Intended-statement comparison, independent axiom audit and mathematical review are pending.

The statement

For natural numbers n and m, n + m = m + n.

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 =>
      simp only [Nat.succ_add, Nat.add_succ, ih]

Why these steps?

  1. Induction is on n with m fixed. The zero branch asks for 0 + m = m + 0; the two named zero identities reduce both sides to m.
  2. In the successor branch n is the predecessor and ih is the already established equality n + m = m + n.
  3. Nat.succ_add and Nat.add_succ move successor through the two sums. Rewriting with ih then makes the remaining expressions agree.
  4. This example exposes the induction structure rather than calling Nat.add_comm. It still uses named basic arithmetic lemmas; it is not a derivation from an empty logical environment.

Try a variation

Explain in your own words why ih concerns n and not Nat.succ n. Then remove ih from the successor simplification and inspect the unresolved equality using a local compiler.

A mistake to understand

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 =>
      exact ih

Expected teaching failure, not recorded compiler output: ih proves the predecessor equality. The successor target contains successors and requires an additional equality transformation.

Sources & reuse

Native compilation evidence (JSON)

Code and explanation: original LeanProofs teaching content, CC0-1.0. Linked references retain their own licenses. Editorial date: 24 November 2026; independent mathematical review pending.