Proof Hike · Module 10 · Lean 4.36.0

Prove your programs work.

Follow data through switches, pairs, and lists. Finish by checking a scoreboard.

The five steps

  1. Example 46: Flip a switch twice
  2. Example 47: Swap a pair and swap back
  3. Example 48: Change the values, keep the count
  4. Example 49: Combine two passes through a list
  5. Example 50: Capstone: combine two scoreboards

New words

Boolean
A value of type Bool: true or false. These are values, distinct from propositions and their proofs.
Case
One possibility determined by the constructor that built a value. A proof by cases handles every possibility.
Definitional equality
Equality that Lean recognizes using its computation rules, without requiring a separate equality proof.
Type
A classification of terms. It tells Lean what kind of term is required in a position.
Equality
A proposition identifying two expressions of the same type. It may need more than computation to prove.

A checked example

E46.leanTry it live (opens official Lean editor)
example (b : Bool) : (!(!b)) = b := by
  cases b <;> rfl

Before you move on

  • Explain the claim in everyday words.
  • Identify what Lean expects at each step.
  • Complete the warm-up exercises.
  • Read an error and explain its fix.

The full lesson includes the captured Lean output, hints, stretch tasks, and checked solutions.

Use your browser’s Print command. This course stores progress only in the learner’s browser.