Meet the five Trail Guides
- LemmiWhat’s a proof?
A proof gives reasons why a math claim must be true.
- TactoWhat’s Lean 4?
Lean is a language for writing math. It checks each proof.
- GoalieHow does it help?
After each step, Lean shows what’s left to prove.
- TypoWhat if I get stuck?
Read what Lean expected. Use that clue to try another step.
- IndyWhere do I start?
Begin with numbers you know. Build up to bigger proofs.
Learn Lean 4, one checkpoint at a time
How do you know it’s true?
A proof is a reason that works every single time. Lean 4 is a tool that checks those reasons, step by step. Warm up at base camp, then climb from your first calculation to a proof that a program works.
How the hike works
- Step 0Base Camp GymWhat a proof is, a short history, where Lean came from, and how to read it.
- Steps 1–50The trail: 10 checkpointsEach lesson is one small, checked step: an idea, a Lean proof, a common slip, and your turn.
- The summitProve a program worksFinish by proving facts about real code, checked by Lean, not just tested.
Big idea 1
What is a math proof?
A proof is an argument that shows a claim must be true, in every case, with no exceptions. Not “probably”. Not “it worked when I tried it”. Every case.
The claimAdd two even numbers and the answer is always even.
Good evidence, not a proof. There are infinitely many even numbers. You can never finish checking them.
A proof. “Even” means the dots split into pairs. Join two piles of pairs and you still have only pairs. That reason never mentions 6 or 10, so it works for every size.
a = 2r and b = 2s, then a + b = 2r + 2s = 2(r + s), which is twice a whole number. You will check exactly this proof with Lean at Step 36.Big idea 2
What is Lean?
Lean is a programming language that can also check proofs. You write a claim and the steps of your argument. Lean checks every step against the rules of logic. It never gets tired, never skips a line, and never says “looks fine to me” when it isn’t.
Three tiny examples
These lines come straight from the course’s checked Lean files. The grey boxes show what Lean actually printed.
- 1
Lean as a calculator
#eval 2 + 3 * 4Lean says14#evalmeans “work this out”. Lean multiplies first, just like you would: 3 × 4 = 12, then 2 + 12 = 14. Step 1 - 2
A claim with a proof
example : 2 + 2 = 4 := by rflLean saysno goals“No goals” means nothing is left to prove. The proof is complete and checked. Step 6
- 3
A false claim gets caught
example : 2 + 2 = 5 := by rflLean saysTactic `rfl` failed: The left-hand side 2 + 2 is not definitionally equal to the right-hand side 5 ⊢ 2 + 2 = 5Lean works out 2 + 2 and gets 4, which is not 5. You can’t sneak a false claim past it.
How to read example 2
example“Here comes a claim.” (A named claim uses theorem instead; see Step 8.): 2 + 2 = 4The claim itself. Read the colon as “the statement is”.:= by“…and here is why.” The word by means “I’ll prove it step by step, with tactics.”rflA tactic: one proof move. rfl means “both sides work out to the same thing”.
Steps 1–50 · The hike
Then climb the ten checkpoints
Follow the numbers on the map. Each checkpoint has five short lessons and earns one item for its Trail Guide.
- Lean as a calculatorSteps 1–5 · Lemmi
- Your first proofsSteps 6–10 · Tacto
- Logic, part oneSteps 11–15 · Goalie
- Logic, part twoSteps 16–20 · Typo
- Numbers & inductionSteps 21–25 · Indy
- Algebra with MathlibSteps 26–30 · Tacto
- Data & functionsSteps 31–35 · Lemmi
- Real mathematicsSteps 36–40 · Indy
- Logic puzzlesSteps 41–45 · Goalie
- Prove your programs workSteps 46–50 · Typo