.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.
Listing environments
First use of a version
If your versions are not listed, the first command you run builds the environment. It takes about five minutes for a Mathlib environment and about a minute for Lean alone, and it is free: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. See Cleaning and caches.
When prebuilt Mathlib is not used
Prebuilt Mathlib applies only when the commit inlake-manifest.json is an
upstream Mathlib commit built for your Lean version. Otherwise Mathlib builds
from source in your workspace, exactly as it would locally. The common causes
are listed under
When versions disagree, and
Troubleshooting
gives a checklist.