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 propositions P and Q, P ∨ Q implies Q ∨ P.
theorem or_commutativity (P Q : Prop) : P ∨ Q → Q ∨ P := by
intro h
cases h with
| inl hp => exact Or.inr hp
| inr hq => exact Or.inl hq
Why these steps?
- A proof of P ∨ Q may supply either side. Unlike a conjunction, it does not supply both components.
- cases h opens one branch with hp : P and another with hq : Q. Each branch must separately establish the common target Q ∨ P.
- In the P branch use the right constructor of the new disjunction. In the Q branch use its left constructor.
- The names inl and inr refer to the input cases; the new constructors refer to the order in the output. Confusing these two orders is a common failure.
Try a variation
Write a new theorem taking P ∨ Q to Q ∨ P using a match expression rather than tactic cases.
A mistake to understand
theorem or_commutativity (P Q : Prop) : P ∨ Q → Q ∨ P := by
intro h
exact Or.inl h
Expected teaching failure, not recorded compiler output: The left constructor of Q ∨ P requires a proof of Q. The whole disjunction h cannot be used as evidence for one particular side.
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.