> ## Documentation Index
> Fetch the complete documentation index at: https://docs.proofpod.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Prebuilt environments

> Shared, fully built Lean and Mathlib installations, and how your project uses them.

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.

## Listing environments

```console theme={null}
$ pp envs
LEAN     MATHLIB  COMMIT
v4.36.0  v4.36.0  fc4f59e577fe
v4.36.0  none
```

The output also names the service default, which is used when no Lean version
can be found anywhere else. See
[How versions are chosen](https://docs.proofpod.dev/guide/versions.md#how-versions-are-chosen).

## 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:

```console theme={null}
$ pp lake build
proofpod: Preparing Lean v4.35.0 + Mathlib v4.35.0 for the first time. This takes a few minutes and only happens once per version.
```

## 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 get` in 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 clean` cannot make you rebuild Mathlib. See
  [Cleaning and caches](https://docs.proofpod.dev/guide/clean.md).

## When prebuilt Mathlib is not used

Prebuilt Mathlib applies only when the commit in `lake-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](https://docs.proofpod.dev/guide/versions.md#when-versions-disagree), and
[Troubleshooting](https://docs.proofpod.dev/guide/troubleshooting.md#mathlib-is-being-compiled-from-source)
gives a checklist.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.