∴LeanProofs
Logic

Read a contrapositive

For propositions P and Q, (P → Q) implies (¬Q → ¬P).

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 contrapositive (P Q : Prop) (h : P → Q) : ¬Q → ¬P := by
  intro hnq
  intro hp
  exact hnq (h hp)

Why these steps?

  1. Negation ¬P means that a proof of P would give False. The theorem starts from the implication h, not from its converse.
  2. Assume hnq : ¬Q, then assume hp : P. To prove ¬P it now suffices to reach False under these assumptions.
  3. Applying h to hp produces a proof of Q. Applying hnq to that proof produces False.
  4. No classical case split is needed. This argument does not establish the converse implication Q → P.

Try a variation

Write the final proof as two named intermediate steps using have hq : Q := h hp. Keep the same assumptions and conclusion.

A mistake to understand

theorem contrapositive (P Q : Prop) (h : P → Q) : ¬Q → ¬P := by
  intro hnq hp
  exact h hp

Expected teaching failure, not recorded compiler output: h hp proves Q, while the remaining target is False. Apply hnq to it to complete the contradiction.

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.