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 a, b and c, if a = b and b = c, then a = c.
theorem equality_rewrite (a b c : Nat) (hab : a = b) (hbc : b = c) : a = c := by
rw [hab]
exact hbc
Why these steps?
- The variables a, b and c are natural numbers. The names hab and hbc refer to proofs of the two assumptions, rather than more natural numbers.
- The target a = c says exactly which equality remains to be established. Rewriting with hab replaces a by b in that target.
- After this substitution the paper target is b = c. The assumption hbc already proves it, so exact hbc supplies the remaining proof.
- This is a static explanation of the displayed example. Editing the statement can change every subsequent goal; only a connected Lean process can report the new goals.
Try a variation
Keep the statement unchanged. Replace the two tactic lines with exact hab.trans hbc, then compare the proof idea. This alternative has not been checked here.
A mistake to understand
theorem equality_rewrite (a b c : Nat) (hab : a = b) (hbc : b = c) : a = c := by
exact hab
Expected teaching failure, not recorded compiler output: hab proves a = b, whereas the target is a = c. Use hbc to bridge the missing equality rather than changing the target.
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.