Proof by contradiction

Assume the negation of the goal, derive False, and see why that step is classical.

11 minBeginnerproof by contradictionClassical.byContradictionnegation versus contradiction
0/10 completed in this course

The contrapositive lesson went in one direction: from P → Q, derive ¬Q → ¬P. That direction is constructive. Going back, from ¬Q → ¬P to P → Q, is not: nothing in the hypothesis produces a proof of Q directly.

Proof by contradiction fills the gap. To prove Q, assume ¬Q and derive False. In Lean the principle is Classical.byContradiction : (¬Q → False) → Q. apply Classical.byContradiction turns the goal Q into ¬Q → False, and intro takes the assumption. Mathlib has a by_contra tactic that does both steps at once; in core Lean you use the lemma.

Compare this with proving a negation. To prove ¬P you assume P and derive False, which is simply what ¬P means, and it is constructive. Proof by contradiction assumes the negation of the goal instead. The two look alike on paper; the difference between them is exactly the classical step.

In the exercise, after intro hp and the contradiction step you hold hp : P, hnq : ¬Q and h : ¬Q → ¬P. Then h hnq is a proof of ¬P, and applying it to hp gives False.

Worked example

example (P : Prop) (h : ¬¬P) : P := by
  apply Classical.byContradiction
  intro hnp
  exact h hnp

The example removes a double negation: assume ¬P, and h turns that into False. Your exercise first introduces P, then argues by contradiction about Q.

Takeaway

To prove a statement by contradiction, assume its negation and derive False with Classical.byContradiction. Proving a negation needs no such step.

Your exercise

Prove the converse of the contrapositive: from h : ¬Q → ¬P, conclude P → Q.

Suggested steps
  1. Introduce the premise P
  2. Argue by contradiction
  3. Derive False from h

These marks only recognize text. Another correct proof may use different steps; Lean checks whether it works.

Exercise.lean
1theorem exercise (P Q : Prop) (h : ¬Q → ¬P) : P → Q := by
given
Loading editor…

Where you start. Everything above ⊢ may be assumed; the line below it is what you must prove.

P Q:Prop
h:¬Q → ¬P
P → Q
ReadyLn 1, Col 1Lean 4
Draft saved in this browser
Stuck?
Recall and apply

Knowledge check

Answer without looking back, then check your reasoning.

0of 3
correct
Question 1 of 3After apply Classical.byContradiction, the goal Q becomes:
Question 2 of 3Which of these needs classical reasoning?
Question 3 of 3What does proving ¬P require?