Documentation
lev, a small companion to Lake
Lake builds large Lean developments well. lev covers four jobs around those builds: it explains why Lake rebuilt what it rebuilt, checks every module with external kernels and rechecks only what an edit changed, keeps lev's and Lake's caches from growing without bound, and reports the tools a build or check depends on.
Why lev exists
A one-line edit low in Mathlib can rebuild thousands of modules. The reasons are in Lake's .trace files, but nothing reads them back to you. lev inspect build does.
lake check replays the whole environment through the kernel on every run: Init, Std, every dependency and the project. For Mathlib that is a 7 minute export and a 53 minute single-threaded kernel run, no matter how small the edit. lev check checks each module as its own slice, caches every verdict by the slice's content, and after a typical Mathlib commit rechecks a handful of slices in about 20 seconds of checking.
Lake's artifact cache only grows, and lake cache clean is the one way to shrink it. lev cache gc --lake removes what no registered project references.
Commands
| Command | What it does |
|---|---|
lev inspect build | Runs lake --verbose build once and reports, for every module whose trace changed, the inputs that changed. Inspection |
lev check | Exports every module with lev-export, checks one slice per module with the official kernel, leanchecker-paranoid or nanoda, reuses cached verdicts, and checks that the per-module results compose. Checking |
lev cache status, lev cache gc | Inventory lev's cache, the check caches and the Lake caches of registered projects, and remove unreferenced or unused entries older than an age gate. Cache |
lev doctor | Reports elan, Lean, Lake, Git, bwrap, the kernels in the toolchain, what lev check has built for it, and where Lake's artifact cache lives. Getting started |
Where lev stops
- Lake owns packages, builds and caches, and Lean owns elaboration. lev runs Lean and Lake through elan the way a plain
lake buildin the project would, and never changes Lake's environment. - lev writes only to its own cache directory. The one exception is
lev cache gc --lake --apply, which deletes the Lake cache entries it listed. lev checkis not a replacement for the trust model oflake check. Its slices are checked by the same kernels, but whether the slices compose is decided by lev's own small linker, not by a proved theorem. Checking says what that means.lev inspect buildexplains the build it ran. Lake overwrites its traces, so an earlier build cannot be explained after the fact.
Guides
| Page | Covers |
|---|---|
| Getting started | Installing lev and a first run of each command. |
| Inspection | How lev inspect build reads Lake's traces, and how to read its report. |
| Checking | Slices, views, the composition check, the kernels, measured numbers on Mathlib, and the limits. |
| Cache | What lev keeps, what lev cache gc removes, and what protects an entry. |
| Command reference | Options, exit status, JSON schemas and environment variables. |