Step 0 · Before the hike
Base Camp Gym
Every good climb starts with a warm-up. Work through six short stations, about 20 minutes in all. Then the trail makes sense from the very first step.
No installs and no accounts. Just read, look and think.
Station 1
Where math came from
People did mathematics for thousands of years before anyone wrote a proof. Here is the whole story on one page.
- ~20,000 years agoTally marksNotches cut into bones, like the Ishango bone from central Africa, are some of the oldest signs of counting.
- ~1800 BCE · BabylonClay tabletsStudents practised multiplication tables and square roots. One tablet lists the sides of right triangles.
- ~1550 BCE · EgyptThe Rhind papyrusWorked problems on sharing bread, measuring fields and building pyramids. These are recipes: “do this, then this.”
- ~600–300 BCE · GreeceThe first proofsThales, and later Euclid, ask a new question: why must this be true? Euclid’s Elements builds geometry from a few starting rules, with a proof for every fact.
- 628 CE · IndiaRules for zeroBrahmagupta writes down how to add, subtract and multiply with zero and negative numbers.
- ~820 CE · BaghdadAlgebraAl-Khwārizmī’s book gives us the word algebra. His name gives us the word algorithm.
- 1600s–1900sCalculus, then logicCoordinates and calculus arrive. Later, mathematicians study logic itself, the rules that proofs follow.
- 1976 → todayComputers join inA computer helps prove the four color theorem. Programs that check proofs line by line grow from a research idea into everyday tools. That is where Lean fits.
The big shift: for a long time, math was mostly recipes that worked. The Greek idea was to accept a fact only when it follows from earlier facts, through reasons anyone can check.
Station 2
What a proof really is
A proof is a chain of small steps. Each step must follow from something already accepted: a definition, a basic rule, or a theorem proved earlier. The last step is the claim. Picture crossing a river on stepping stones.
Swipe sideways to see the whole picture.
Six words you will keep meeting
- Claim
- A sentence that is either true or false. “7 is odd.” Also called a statement or proposition.
- Definition
- The agreed meaning of a word. “Even means twice some whole number.”
- Axiom
- A starting rule we accept without proof, like “every number has a next number.”
- Theorem
- A claim that has been proved. Once proved, it can be used in later proofs.
- Proof
- The chain of steps showing a claim follows from definitions, axioms and theorems.
- Counterexample
- One case where a claim fails. One is enough to show an “always” claim is false.
Why examples are not enough
Put points on a circle and join every pair with a straight line. Count the pieces the circle is cut into.
Swipe sideways to see all six circles.
A proof you can see
Add up odd numbers: 1, then 1 + 3, then 1 + 3 + 5… You always get a square number. Here is why.
Remember: examples help you guess. A proof explains why, for every case. A single counterexample can sink an “always” claim. You will use one in Step 45.
Station 3
Why mathematicians want a checker
Proofs are written by people, and people make mistakes. Usually other experts read a proof carefully to check it. That works most of the time. Here are three times it was hard.
Four colors for any map
1879 → 1890 → 1976 → 2005Alfred Kempe published a proof that four colors are enough for any map. Experts accepted it for 11 years, until Percy Heawood found a mistake. A correct proof in 1976 needed a computer to check many cases. In 2005, the whole proof was checked by a proof assistant.
Fermat’s Last Theorem
1637 → 1993 → 1995Fermat claimed a proof that “didn’t fit in the margin.” More than 350 years later, Andrew Wiles announced a proof. Checking found a gap. Wiles, with Richard Taylor, fixed it a year later. A team led by Kevin Buzzard is now checking it in Lean.
Stacking oranges
1611 → 1998 → 2014Kepler guessed the grocer’s pyramid is the tightest way to stack balls. Thomas Hales’s 1998 proof was so long that, after years, the reviewers said they were “99% certain.” So Hales led a team that had computers check every step, finished in 2014.
The idea: a proof assistant is software that checks every step of a proof. Then nobody has to just trust that a long argument is right. Lean is a proof assistant.
Station 4
Where Lean came from
The dream of checking math by computer is old. In 1967, N. G. de Bruijn built Automath, one of the first proof checkers. Others followed, such as Mizar, Isabelle and Coq (now called Rocq). Lean builds on these ideas.
In 2013, Leonardo de Moura, a computer scientist at Microsoft Research, started Lean. He wanted a checker that was both trustworthy and pleasant to use. It has been rebuilt three times since.
Swipe sideways to see every version.
- 2017Mathlib beginsMathematicians start a shared library of checked definitions and theorems. Anyone can contribute.
- 2020–2022A test from the frontierFields Medal winner Peter Scholze asked whether Lean could check a hard new result of his. The Lean community did it. This was the Liquid Tensor Experiment.
- 2023Lean 4 grows upLean 4.0.0 is released and Mathlib moves to Lean 4. The Lean FRO, a non-profit organization, is set up to look after Lean.
- 2023Three weeksTerence Tao and a team check a brand-new proof in Lean in about three weeks.
- 2024AI writes LeanGoogle DeepMind’s AlphaProof writes Lean proofs for International Mathematical Olympiad problems. Lean checks them, so nobody has to trust the AI.
What is inside Lean 4
Station 5
How to read Lean 4
You don’t need to write Lean yet. Learn to read it. Here are four ideas that cover almost everything on the trail.
A A claim, then its proof
This proof from Step 10 says: “if you already have a proof of P, then P is true.” Read it piece by piece.
(P : Prop)“Let P be any claim at all.” Prop is the type of claims.(h : P)“…and suppose we already have h, a proof of P.” This is a hypothesis: a fact you may use.: P“Then P is true.” This is the claim to prove.exact h“The proof is exactly h.” exact hands Lean something that matches the goal.
B The goal: what you have, and what you need
While you write a proof, Lean shows a goal state. It is your map on the trail. This is the real goal state Lean shows at the start of the proof above.
C Tactics are moves
A tactic is one move in a proof. Each move changes the goal, usually making it simpler. When no goals are left, the proof is finished. These are the real before-and-after states Lean recorded.
Swipe sideways to see before and after.
D Everything has a type
In Lean, every value has a type: what kind of thing it is. Write 42 : Nat and read it as “42 has type Nat.” Lean checks types the way a lock checks a key: the wrong kind of thing simply doesn’t fit.
Swipe sideways to see all four types.
Prop. A false claim like 2 + 2 = 5 is still a claim. You just can’t prove it. And proofs have types: h : P means “h is a proof of P.” Meet types at Step 2.Symbols you will meet
Lean writes logic with a few symbols. You type each one with a backslash shortcut, like \to for →.
| Symbol | Say it as | Type it | First used |
|---|---|---|---|
| ⊢ | goal: still to prove | \vdash | Step 6 |
| → | implies / if … then | \to | Step 11 |
| ∧ | and | \and | Step 12 |
| ∨ | or | \or | Step 14 |
| ¬ | not | \not | Step 16 |
| ↔ | if and only if | \iff | Step 18 |
| ∀ | for every | \forall | Step 19 |
| ∃ | there exists | \exists | Step 20 |
All symbols are on the symbols page. To run Lean yourself, every lesson has a “Try it live” link, or see Get set up.
Station 6
Warm-up check
Three quick questions. They’re not graded, just a stretch before you start.
You’re ready for the trail.
Every lesson follows the same eight parts, so you always know where you are.
- The ideaan everyday picture
- In mathsthe exact claim
- In Leanchecked code
- Step by stepgoal after each line
- Lean saysthe real output
- A common slipa real error, explained
- Your turntwo tasks + hints
- Quick check2–3 questions