Stage 09 · Step 41 of 50

Reason from a missing badge.

Core Lean8 minutesLean 4.36.0

01The idea

A school rule says every club member has a badge. If Jo has no badge, could Jo be a member?

Goalie · Your guide for this idea
Goalie pointing

Assume membership for a moment and the rule produces exactly the badge that is missing.

02In maths

If P implies Q and Q is impossible, then P is impossible.

Picture it

Suppose P, follow the rule to Q, and crash into the missing QTop: a chain of three boxes. A dashed box hp : P, labelled suppose Jo is a member. The rule carries it to a box Q, labelled the rule gives Jo a badge. Then missing carries Q to a red box False, labelled but Jo has no badge. Under the boxes the Lean terms grow from the inside out: hp, then rule hp, then missing (rule hp). A sentence says the supposition led to False, so Jo is not a member, which is not P. Bottom: goal cards. The goal not P becomes False after intro hp, and exact missing (rule hp) leaves no goals.Suppose Jo is a member……the rule gives a badge……but Jo has no badge!hp : PruleQmissingFalsehprule hpmissing (rule hp)The supposition leads to False, so it was wrong: Jo is not a member (¬P).⊢ ¬Pintro hp⊢ Falseexact missing (rule hp)no goals

Swipe sideways to see the whole picture.

The rule rule : P → Q says every member gets a badge. To show Jo is not a member, suppose Jo is, and watch the rule produce the very badge that is missing. missing : ¬Q turns that badge into False. A road from P to False is exactly what ¬P means.

03In Lean

This code comes directly from the file checked by Lean.

E41.leanTry it live (opens official Lean editor)
example (P Q : Prop) (rule : P → Q) (missing : ¬ Q) : ¬ P := by
  intro hp
  exact missing (rule hp)

Read ¬ P as a request for a function from P to False. The line intro hp gives the assumed membership a name.

Evaluate the last line from the inside out. First rule hp supplies Q. Then missing uses that proof to produce the contradiction.

04Step by step

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

After line 1
P Q : Prop
rule : P → Q
missing : ¬Q
⊢ ¬P
After line 1: example (P Q : Prop) (rule : P → Q) (missing : ¬ Q) : ¬ P := by
P Q : Prop
rule : P → Q
missing : ¬Q
⊢ ¬P
After line 2: intro hp
P Q : Prop
rule : P → Q
missing : ¬Q
hp : P
⊢ False
After line 3: exact missing (rule hp)
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 a rule and its starting fact to reach the conclusion.

  2. A little stretch

    Two rules lead from P to Q to R. Show that ruling out R rules out P.

Exercises/E41.leanTry it live (opens official Lean editor)
example (P Q : Prop) (rule : P → Q) (hp : P) : Q := by
  sorry

example (P Q R : Prop) (f : P → Q) (g : Q → R) (hr : ¬ R) : ¬ P := by
  sorry

08A quick check

1. What does rule hp give you?

Read the answer and explanation

A proof of Q. The rule accepts P and returns Q.

2. Why does the missing badge settle the membership question?

Read the answer and explanation

Membership would produce a contradiction. Under the membership assumption, the rule supplies a badge, while the hypothesis rules it out.

One more idea in your toolkit.

Take your time. Progress is yours to mark.