Get started
Just want to try it? Open module 1 in the Lean playground and solve it in your browser, no installation needed. Install Lean locally when you want
lake exe check and the full editor experience.Install
- Install elan, the Lean version
manager:
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh - Clone this repository and build it. The first build downloads the Lean
version pinned in
lean-toolchain:
The build succeeds with a warning for eachgit clone https://github.com/ErnestoMFaloh/leanlearn.git leanlearn cd leanlearn lake buildsorryinExercises/. Those are your exercises. - Open the folder in VS Code with the
Lean 4 extension (
leanprover.lean4) and start with module 1.
How to work
You need:
- elan: the Lean version manager (see the README).
- Lean 4 and lake (the compiler and the build tool). elan installs the
right version automatically the first time you run
lake buildin this folder. - VS Code with the Lean 4 extension (
leanprover.lean4).
If lean or lake are not found in a new terminal, add this line to your
~/.bashrc (or ~/.zshrc) and open a new terminal:
source ~/.elan/env
How to work
- Open the project folder in VS Code:
code leanlearn - Open a
.leanfile. The Lean Infoview panel appears on the right; if it doesn't, pressCtrl+Shift+Enter. - Move the cursor through the code. The Infoview shows:
- the result of each
#evaland#check; - inside a proof (
by ...), the remaining goal.
- the result of each
- Errors are underlined in red; each
sorryis underlined in yellow. - To check the whole project from the terminal:
lake build
How to approach each module
- Reading: the book chapters listed for the module.
- Examples: go through the module file, change things and see what happens.
- Exercises: solve every
sorryin the file. - Check: run
lake exe check <Module>(for examplelake exe check Logic). It marks each exercise as ✅ solved, ⏳ pending or ❌ wrong, and says why. - Compare: once an exercise is ✅, open the matching file in
Solutions/. Different proofs can be equally valid; look for tactics or ideas you didn't use. - Wrap-up: commit your work.
When you get stuck
Try for a while first: being stuck is where most of the learning happens. Re-read the examples in the file, check the hints in this guide and look at the goal in the Infoview. If you're still stuck, open the solution, read only the first line or two, and try to finish on your own.
If you keep your solutions in your own fork, commit every time you finish something, even a single exercise:
git add .
git commit -m "Module N: exercise X solved"
git push