Stage 04 · Step 17 of 50

Proof by contradiction.

Core Lean8 minutesLean 4.36.0

01The idea

Suppose every attempt to deny a claim leads to a contradiction. Classical reasoning lets you conclude the claim.

Typo · Your guide for this idea
Typo pointing

Lean keeps that classical step explicit here.

02In maths

In classical logic, ¬¬P implies P.

Picture it

Proof by contradiction: suppose not P, and watch two clues clashTop row: the start card has P : Prop and h : not not P, with goal P. The step apply Classical.byContradiction changes the goal to not P implies False. A connector labelled intro hn leads down to the second row. Second row: the card now has P : Prop, h : not not P and hn : not P, with goal False. Then two clues clash: hn says P is false, and h is a machine that turns any proof of not P into False. The step exact h hn feeds hn into h, which produces False, and a green tick shows no goals.STARTP : Proph : ¬¬P⊢ PapplyClassical.byContradictionBY CONTRADICTIONP : Proph : ¬¬P⊢ ¬P → Falseintro hnP : Proph : ¬¬Phn : ¬P⊢ Falsehn : ¬P“P is false”h : ¬¬P“¬P leads to False”exact h hnFalseclash!no goals

Swipe sideways to see the whole picture.

To prove P by contradiction, suppose P is false and show that leads to nonsense. Classical.byContradiction turns the goal into ¬P → False, and intro hn makes the supposition. Now two clues clash: hn says P is false, but h turns any such claim into False. So h hn proves False, and the supposition must have been wrong.

03In Lean

This code comes directly from the file checked by Lean.

E17.leanTry it live (opens official Lean editor)
example (P : Prop) (h : ¬ ¬ P) : P := by
  apply Classical.byContradiction
  intro hn
  exact h hn

Classical logic allows reasoning by excluded middle: a proposition holds or its negation holds.

The theorem Classical.byContradiction turns a proof that not P is impossible into a proof of P.

The tactic apply uses a theorem whose conclusion matches the goal. It leaves the required premises as new goals.

04Step by step

Choose a line to see Lean’s recorded goal state after that line.

After line 1
P : Prop
h : ¬¬P
⊢ P
After line 1: example (P : Prop) (h : ¬ ¬ P) : P := by
P : Prop
h : ¬¬P
⊢ P
After line 2: apply Classical.byContradiction
P : Prop
h : ¬¬P
⊢ ¬P → False
After line 3: intro hn
P : Prop
h : ¬¬P
hn : ¬P
⊢ False
After line 4: exact h hn
no goals

05Lean says

Captured from Lean 4.36.0
no goals

A goal is what remains to prove. The symbol ⊢ points to it. Meet the turnstile.

07Your turn

sorry is a placeholder for unfinished work. Replace it as you solve each task. A finished proof has no placeholders.

  1. Warm-up

    Use Classical.byContradiction directly on the supplied double-negation proof.

  2. A little stretch

    Show that denying P or Q also denies P.

Exercises/E17.leanTry it live (opens official Lean editor)
example (P : Prop) (h : ¬ ¬ P) : P := by
  sorry

example (P Q : Prop) (h : ¬ (P ∨ Q)) : ¬ P := by
  sorry

08A quick check

1. Which additional principle does the worked example use?

Read the answer and explanation

Classical reasoning. Classical.byContradiction is a checked library theorem using Lean’s classical foundation.

2. Must we first construct a proof of P for this method?

Read the answer and explanation

No; we derive False from assuming not P. The contradiction principle discharges the assumption that P is false.

One more idea in your toolkit.

Take your time. Progress is yours to mark.