Stage 09 · Step 45 of 50

Test a claim with one witness.

Core Lean14 minutesLean 4.36.0

01The idea

A tester says every level of a game loads correctly. You have one level that fails.

Goalie · Your guide for this idea
Goalie pointing

That level is enough to challenge the claim, even if you never test the other levels.

02In maths

If at least one n fails a test, it is false that every n passes.

Picture it

One failing level is enough to sink “every level passes”Top: a dashed banner allPass : for all (n : Nat), Pass n, introduced by intro allPass as a supposition that every level passes. Middle: a row of level tiles 0, 1, 2, 3, then dots, then a red tile n. The tiles 0 to 3 are never tested, and that is fine. An arrow from the banner to tile n is labelled allPass n : Pass n, the claim that it passes. Bottom: the clue counter : there exists n with not Pass n is unpacked by obtain ⟨n, fails⟩ := counter, and an arrow labelled fails : not Pass n points to the same tile n. The two clash at tile n, giving False, so the claim is refuted.intro allPass: suppose every level passesallPass : ∀ (n : Nat), Pass n0123…never tested, and that’s finenallPass n : Pass ncounter : ∃ n, ¬Pass nobtain ⟨n, fails⟩ := counterfails : ¬Pass nFalseclaimrefuted

Swipe sideways to see the whole picture.

To refute “every level passes”, suppose it as allPass. The clue counter hands you one failing level n and its evidence fails. Ask the big claim about that same level: allPass n says it passes, fails says it doesn’t, and that clash is False. You never need to test any other level.

03In Lean

This code comes directly from the file checked by Lean.

E45.leanTry it live (opens official Lean editor)
example (Pass : Nat → Prop) (counter : ∃ n, ¬ Pass n) : ¬ (∀ n, Pass n) := by
  intro allPass
  obtain ⟨n, fails⟩ := counter
  exact fails (allPass n)

obtain ⟨n, fails⟩ := counter gives names to the failing level and its evidence. You need both pieces.

Assuming the big claim gives allPass : ∀ n, Pass n. Ask it about that very level. The answer allPass n conflicts with fails.

04Step by step

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

After line 2
Pass : Nat → Prop
counter : ∃ n, ¬Pass n
allPass : ∀ (n : Nat), Pass n
⊢ False
After line 2: intro allPass
Pass : Nat → Prop
counter : ∃ n, ¬Pass n
allPass : ∀ (n : Nat), Pass n
⊢ False
After line 3: obtain ⟨n, fails⟩ := counter
Pass : Nat → Prop
allPass : ∀ (n : Nat), Pass n
n : Nat
fails : ¬Pass n
⊢ False
After line 4: exact fails (allPass n)
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 level seven as a known counterexample.

  2. A little stretch

    Disprove a rule that every P-level also passes Q, using a level with P but without Q.

Exercises/E45.leanTry it live (opens official Lean editor)
example (Pass : Nat → Prop) (fails : ¬ Pass 7) : ¬ (∀ n, Pass n) := by
  sorry

example (P Q : Nat → Prop) (clue : ∃ n, P n ∧ ¬ Q n) : ¬ (∀ n, P n → Q n) := by
  sorry

08A quick check

1. What does counter provide?

Read the answer and explanation

A number and evidence that it fails. An existential supplies a particular witness together with its property.

2. Why apply allPass at n specifically?

Read the answer and explanation

fails concerns that same witness. Using the same index makes the claimed success and the recorded failure contradict.

One more idea in your toolkit.

Take your time. Progress is yours to mark.