Stage 09 · Step 45 of 50
Test a claim with one witness.
01The idea
A tester says every level of a game loads correctly. You have one level that fails.
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
Swipe sideways to see the whole picture.
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.
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.
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
no goals
A goal is what remains to prove. The symbol ⊢ points to it. Meet the turnstile.
06A common slip
Lean is telling us something useful here.
example (Pass : Nat → Prop) (allPass : ∀ n, Pass n) : Pass 7 := by
exact allPass
Type mismatch allPass has type ∀ (n : Nat), Pass n but is expected to have type Pass 7
The universal claim is a function waiting for a level number. The goal is the result for level seven.
The fix: Apply allPass to 7 to get a proof about that specific level.
07Your turn
sorry is a placeholder for unfinished work. Replace it as you solve each task. A finished proof has no placeholders.
- Warm-up
Use level seven as a known counterexample.
Show a hint
Assume every level passes.
One more hint
Specialize the universal claim at 7 and give that result to fails.
- A little stretch
Disprove a rule that every P-level also passes Q, using a level with P but without Q.
Show a hint
Unpack the witness and both clues.
One more hint
At that same level, apply the proposed rule and contradict the missing Q.
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
Compare with the checked solutions
There are often several valid proofs. These solutions were compiled with the same pinned Lean version.
example (Pass : Nat → Prop) (fails : ¬ Pass 7) : ¬ (∀ n, Pass n) := by
intro allPass
exact fails (allPass 7)
example (P Q : Nat → Prop) (clue : ∃ n, P n ∧ ¬ Q n) : ¬ (∀ n, P n → Q n) := by
intro rule
obtain ⟨n, p, nq⟩ := clue
exact nq (rule n p)
no goals
08A quick check
09New words & tools
Take your time. Progress is yours to mark.