∴LeanProofs
Logic

Compose two implications

If P implies Q and Q implies R, then P implies R.

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

If P implies Q and Q implies R, then P implies R.

theorem implication_composition (P Q R : Prop) (hpq : P → Q) (hqr : Q → R) : P → R := by
  intro hp
  exact hqr (hpq hp)

Why these steps?

  1. The target P → R describes a transformation from evidence for P to evidence for R.
  2. After intro hp, the assumption hpq can consume hp and produce evidence for Q.
  3. The assumption hqr consumes that intermediate evidence to produce R. Parentheses show the order in which the two transformations are applied.
  4. Proof composition resembles function composition because implication is represented as a function type. It does not mean Q or R was assumed without proof.

Try a variation

Introduce have hq : Q := hpq hp and finish using hqr hq. Compare the named and nested forms.

A mistake to understand

theorem implication_composition (P Q R : Prop) (hpq : P → Q) (hqr : Q → R) : P → R := by
  intro hp
  exact hpq hp

Expected teaching failure, not recorded compiler output: The produced proof has proposition Q, while the current target is R. The second implication is still needed.

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.