How versions are chosen
Lean, first match wins:--lean VERSIONon the command line (orPROOFPOD_LEAN, orleaninproofpod.toml).- elan’s prefix on the command itself:
pp lake +v4.35.0 build. - The project’s
lean-toolchainfile. - Outside a project: the toolchain your local
leanresolves to. - If none of those exist: the service default (
pp envsshows it).
--mathlib REV(orPROOFPOD_MATHLIB, ormathlibinproofpod.toml).- The commit pinned for
mathlibin the project’slake-manifest.json. - If there is no manifest yet: the revision named in the lakefile, if any.
pp status shows what was detected and where it came from:
VERSION accepts 4.36.0, v4.36.0, a release candidate such as
v4.37.0-rc1, a dated nightly such as nightly-2026-11-20, or a full elan
toolchain name such as leanprover/lean4:v4.36.0. Moving channels (nightly,
beta) are rejected because the result would not be reproducible.
REV accepts a tag (v4.36.0), a branch (master) or a full commit hash.
Environments
An environment is a Lean toolchain plus, optionally, a complete Mathlib checkout with every.olean already built. Environments are identified by the
exact toolchain and the exact Mathlib commit, and they are shared: the first
person to need a pair pays the build time, everyone after starts instantly.
How prebuilt Mathlib reaches your project
Lake expects dependencies under.lake/packages/. Before your command runs,
ProofPod compares each package pinned in your lake-manifest.json with what the
environment has built. Where the commit matches exactly, the package directory
in your cloud workspace becomes a link to the prebuilt copy. Lake then finds a
checkout at the right commit with up-to-date build outputs and has nothing to
fetch or compile.
Mathlib and the packages it depends on (Batteries, Aesop, Qq, ProofWidgets,
Plausible, ImportGraph, LeanSearchClient, Cli) are handled this way. Any other
dependency is cloned and built by Lake into your workspace the first time, then
cached there.
This is why:
- you never need
lake exe cache getin the cloud (running it is harmless and reports there is nothing to download); - a project that imports all of Mathlib leaves only its own build outputs in its workspace, around 19 MB for a small project;
pp lake cleancannot make you rebuild Mathlib.
When versions disagree
A Mathlib commit is built for exactly one Lean version.Overriding versions
Try a project against another Mathlib
.lake/package-overrides.json that points Lake at the requested Mathlib and
its dependencies, and removes it again when you stop passing --mathlib. Your
lake-manifest.json and lean-toolchain stay as they are.
To make the change permanent, edit your lakefile and run pp lake update,
which updates the manifest and toolchain file on your machine.
Try another Lean
Without a project
Outside a Lake project,pp lean File.lean uploads just the files you name and
runs in a scratch workspace. Add --mathlib to make Mathlib importable:
Projects without a manifest
A new project that has never been built has nolake-manifest.json, so there is
no exact Mathlib commit to match. Run this once: