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 and_commutativity (P Q : Prop) : P ∧ Q → Q ∧ P := by
intro h
constructor
· exact h.right
· exact h.left
Why these steps?
- An implication is proved by assuming its input. intro h introduces one proof h of P ∧ Q.
- The target Q ∧ P requires two proofs in a particular order. constructor splits this target into Q and P.
- The right component of h proves Q, so h.right fills the first branch. Its left component proves P, filling the second.
- Exchanging the order is part of the theorem. Repeating the same component does not prove both propositions.
Try a variation
Prove the reverse direction Q ∧ P → P ∧ Q in a separate theorem. Do not change the displayed exercise while comparing results.
A mistake to understand
theorem and_commutativity (P Q : Prop) : P ∧ Q → Q ∧ P := by
intro h
constructor
· exact h.left
· exact h.right
Expected teaching failure, not recorded compiler output: The first branch needs Q, but h.left proves P. The two branches must match the order of 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.