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
- Example 46: Flip a switch twice
- Example 47: Swap a pair and swap back
- Example 48: Change the values, keep the count
- Example 49: Combine two passes through a list
- 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
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.