Where to Find Official Lean 4 Resources
Halfway through learning, when you want to look something up, the most common frustration isn't "no materials" but not knowing which website to go to. Official Lean resources are spread across several places: the language itself, the math library, the online playground, the search engine for finding theorems—each has its own URL.
First, say what you want to do, and we'll tell you exactly where to go:
Look it upI want to...
Click one to see.
What You'll Be Able to Do After This Lesson
- Know which official website to check when you run into problems
- Use
lake newto create a new Lean project and build it successfully - Know how to create a project that depends on Mathlib
Official Websites at a Glance
All of these are listed in the navigation and footer of lean-lang.org (descriptions taken from each site's own introduction):
| Name | URL | What it's for |
|---|---|---|
| Install | lean-lang.org/install | Official installation instructions; recommends VS Code with the Lean 4 extension |
| Learn | lean-lang.org/learn | Official learning entry point |
| Language Reference | lean-lang.org/doc/reference/latest/ | The authoritative description of syntax and semantics |
| Lean API | lean-lang.org/doc/api/ | Documentation for every definition in the standard library |
| Playground | live.lean-lang.org | Write Lean directly in the browser |
| Mathlib | leanprover-community.github.io | The community-maintained math library |
| Reservoir | reservoir.lean-lang.org | Lake's package registry |
| Loogle | loogle.lean-lang.org | Search definitions and theorems in Lean and Mathlib |
| FAQ | lean-lang.org/faq | Official frequently asked questions |
- I've bookmarked this table, or memorized the URLs of the Playground and the language reference
Creating a New Lean Project
The official guidance is: all Lean code should live inside a Lean project. A project is a folder containing a git repository, a lakefile.lean or lakefile.toml describing dependencies, and other necessary files. Generate one with a single lake command:
lake new MyLeanProject
cd MyLeanProject && lake buildYou should see: the last line is Build completed successfully. The folder contains files such as lakefile.toml, lean-toolchain, and Main.lean. We actually ran these two commands on Lean 4.35.0.
Then open this folder with VS Code (type code . in the terminal), and choose "Trust authors" when prompted.
$lake new MyLeanProject
$cd MyLeanProject && lake build
Build completed successfully (8 jobs).
- My project
lake buildpassed
Creating a Project That Depends on Mathlib
To use the math library, choose the Mathlib template directly when creating a new project (the command from the official manual installation instructions):
lake +leanprover-community/mathlib4:lean-toolchain new MyMathlibProject mathThe first time you create this kind of project, Mathlib has to be downloaded, so it takes quite a while.
After cloning someone else's project that depends on Mathlib, first run this command in the project folder to download the prebuilt cache and avoid compiling from scratch yourself:
lake exe cache getTo upgrade Mathlib in a project, the official approach is:
curl -L https://raw.githubusercontent.com/leanprover-community/mathlib4/master/lean-toolchain -o lean-toolchain
lake updateAfter upgrading, it's recommended to check again that all files still compile:
lake exe mk_all && lake build- I know which command to use for creating a Mathlib project and for downloading the cache after cloning
FAQ
Where is the official Lean 4 documentation?
For the language itself, see the language reference at lean-lang.org/doc/reference/latest/; to look up a specific function, see the API docs at lean-lang.org/doc/api/. The entry point for systematic learning is lean-lang.org/learn.
How do I install Lean 4 on Windows?
The officially recommended setup is VS Code with the Lean 4 extension, which walks you through the remaining setup. If you only want the command line, you can install elan in PowerShell; the command is in Installing Lean 4.
Can I try Lean 4 online without installing anything?
Yes. The official online version is at live.lean-lang.org. It's good for trying things out before installing and for running small snippets; for big projects you should still install locally.
What if it says lake is an unknown command?
The official instructions say to first run source ~/.profile or source ~/.bash_profile so the newly installed command takes effect, then retry.
Checkpoints
- I know where the language reference, API docs, Playground, and Mathlib each are
- I created a project with
lake newandlake buildpassed - I know how to create a project that depends on Mathlib and which command to run first after cloning
Next Section
With tools and resources ready, start learning reasoning: If... Then....