∴LeanProofs
Learn Lean 4

Use the induction hypothesis

Connect the successor case to an already proved predecessor case.

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
Exercise not verified. The target is a teaching task; changing it cannot earn a pass. A trusted fixed-challenge verifier is required before passes can be issued.
Show hints
  1. First express each successor sum as a successor of a smaller sum.
  2. The remaining sums are n + m and m + n; ih relates them.
  3. Reference idea: simp only [Nat.succ_add, Nat.add_succ, ih].

The repository’s six reference answers have a separate native type-and-axiom audit. This does not check or certify your edited answer. Read the reference audit (JSON)

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