This file is a concatenation of README.md and CONTRIBUTING.md.
Lean Pool sits between mathlib and merely-true, preserving Lean 4 formalizations that don't fit mathlib's scope. Instead of mathlib's high-bar human review, it relies on deterministic linters and LLM judgment, so it can grow faster while staying sorry-free and pinned to the latest Mathlib. Tau Ceti is also a pinned Lake dependency; import its modules directly instead of vendoring projects already in Tau Ceti or Mathlib. See MOTIVATION.md for the why, browse the API docs at https://leanpool.github.io/lean-pool/, and explore each project's dependency graph and declarations in the exposition site.
Semantic search is also available via the API.
Explore compile costs in the LeanPool source profile, from projects and files down to declarations and source lines.
475 formalization projects · 24,476,671 lines of Lean
(stats above are refreshed daily by the Daily documentation workflow — edit python/lean_pool/stats.py, not the numbers)
So far, projects have been added by hand: each is a suitable, permissively licensed (Apache-2.0 or MIT) Lean repository, bumped to the latest Lean and Mathlib, made to pass CI — it builds warning-free and clears Mathlib's linters, the style checker, and the repository quality gates (no sorry/admit, no axioms beyond Classical.choice/propext/Quot.sound, no unsafe/partial, file headers, size limits) — and an LLM review of fit and significance, then merged.
Requires Lean (via elan, with the toolchain pinned in lean-toolchain) and Python 3.13+ with uv.
make setup # pull Mathlib oleans, build the whole pool (~1.5h), install Python toolingTo work on a single project you don't need the whole pool built — see the
fast per-project build in CONTRIBUTING.md.
Add Lean Pool to your lakefile.toml at a fixed commit, and use that commit's lean-toolchain:
[[require]]
name = "lean-pool"
git = "https://github.com/LeanPool/lean-pool"
rev = "<commit>"Run lake update, then import the project you need, for example import LeanPool.RowlandPrimes.Imports. If a release matches your Lean version, you can pin its tag instead of a commit.
- Dependencies. Lake takes Mathlib, Tau Ceti and their dependencies at the revisions in Lean Pool's manifest, the ones CI checked the pool against.
lake updatealso downloads Mathlib's prebuilt cache. - Build. Lake compiles only the pool modules you import, plus the pool's small linter plugin. Pool modules have no prebuilt cache.
- Your own Mathlib pin. If your project also requires Mathlib directly, Lake uses your revision for the whole workspace. Pool modules are then compiled against a Mathlib they were not checked with. They treat every warning as an error, so a newer Mathlib can break them.
- Module system. Pool files use Lean's module system. Lake prints a warning for an importing file that does not start with
module.
See CONTRIBUTING.md.
Every PR, including drafts, gets an advisory compile-cost comment, refreshed
after pushes. PRs without added or modified Lean files get a no-files report.
The PR author or a maintainer can also comment /profile to rerun it.
Failed or zero-phase timed runs show unavailable timing
and are excluded from totals; errors and any successfully measured heartbeat
counts remain visible.
Accepted PRs enter GitHub’s merge queue. CI checks the combined changes against
current main without repeatedly updating authors’ branches. Each project owns
its YAML card and public Imports.lean; there is no shared import list to edit.
Conflicts in the same proof files still require a manual repair.
Created as part of the UW Lean Hackathon by Vasily Ilin and Justin Asher.
Tau Ceti is another approach to solve the same problem. The differences are:
- Lean Pool accepts human-written projects, not just AI projects.
- Lean Pool is not a unified library like mathlib. Most projects are independent of each other.
- Lean Pool only accepts completed formalization projects.
Palomar Registry is also similar to Lean Pool. The differences are:
- Lean Pool maintains accepted projects.
- Lean Pool provides tools like search and documentation.
- Palomar is a registry, not a unified repository.
Projects accepted to the Palomar Registry may be submitted to Lean Pool, and priority will be given to them.
To cite Lean Pool, use the paper:
@misc{ilin2026leanpool,
title = {{Lean Pool}: An {AI}-Maintained Archive of Formalized Mathematics},
author = {Vasily Ilin},
year = {2026},
eprint = {2609.25199},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
doi = {10.48550/arXiv.2609.25199},
url = {https://arxiv.org/abs/2609.25199}
}Lean Pool welcomes serious, medium- to large-scale formalizations of mathematics and related disciplines (see MOTIVATION.md). Browse LeanPool/ for examples and candidates/CRITERIA.txt for what we include.
If you would like to withdraw your project from Lean Pool, open an issue.
Do not vendor projects that are already in TauCeti or Mathlib. Both are Lake dependencies: reuse their modules directly, and submit independent formalizations or substantive extensions instead. Novelty review compares against Mathlib, Tau Ceti, and the pool.
There are two paths:
- Propose a repo. Open an issue with the GitHub URL and a maintainer can import it. Repos that Reservoir does not index can be added to
candidates/manual.txt. - Open a content PR. Add your project under
LeanPool/<YourProject>/, register it inLeanPool/projects/<slug>.yaml— the card must declareprovenance(human,AI, ormix; see below) — and regenerate the indexes withlake exe mk_all. CommitLeanPool/<YourProject>/Imports.lean, which publicly imports every project source. Lake discovers all pool modules automatically; keepLeanPool.leanunchanged. To use a project, importLeanPool.<YourProject>.Imports.
Either way the result must pass CI (build, linters, and quality checks — see Linting and testing) and an LLM review of fit and significance. Accepted projects must be sorry-free, introduce no axioms beyond Classical.choice/propext/Quot.sound, and avoid unsafe/partial. Each project card must also declare its provenance — who wrote the Lean proofs — as human (written by people), AI (mostly produced by an AI system), or mix (both contributed substantially). (Every PR gets an automatic proof-profile comment, refreshed after pushes and available on demand via /profile. It is informational, not a gate: added files get an absolute profile, while modified files get a base→head compile-cost comparison — useful for checking that a refactor doesn't regress compile time.)
Requires Lean (via elan, with the toolchain pinned in lean-toolchain) and Python 3.13+ with uv.
make setup # pull Mathlib oleans, build the whole pool (~1.5h), install Python tooling
cd python && uv sync # Python tooling only; add `--group test` for pytestmake setup builds every project in the pool, which takes about 1.5 hours from cold. You almost never need that. The projects are independent — none imports another — so to work on one project you only need Mathlib's prebuilt oleans plus your own project:
lake exe cache get # prebuilt Mathlib oleans (fast)
lake build LeanPool.YourProject # builds only your project — minutes, not hours
# or: make build-project P=YourProjectThe whole-library checks (lake exe runLinter LeanPool, lake exe lint-style LeanPool, the quality checker) do need the full pool built, but CI runs them on your PR — you don't have to reproduce them locally.
- Don't mix content and non-content changes. A content PR may modify only
LeanPool/**/*.leanandLeanPool/projects/<slug>.yaml. Infra / CI / tooling / doc changes may touch other files, but must not be bundled with content. This is enforced bycontent-pr-guard.yml. - Never change the checks or gates. Do not modify
.github/workflows/,.github/CODE_QUALITY.md,python/lean_pool/quality.py,scripts/nolints-style.txt, the[leanOptions]/lint settings inlakefile.toml, or any other CI step or linter config — and do not add a waiver of any kind (asize-limit-okcomment, anolints-style.txtentry,set_option linter.X false, etc.) — unless explicitly asked. If a check fails, fix the code, not the check. This applies to everyone, and especially to AI agents. - Branches.
yourname/descriptionfor solo work;feature//fix/prefixes when shared. Open PRs early (draft +WIPis fine) and useCloses #123to link issues. - Stale PRs. A PR open for 7 days is labelled
stale; one open for 21 days (and labelled for at least 7) is closed automatically bystale.yml. Thepinnedlabel exempts a PR.
Lean. CI runs lake exe mk_all --check, lake build LeanPool, lake exe runLinter and lake exe lint-style on LeanPool, the quality checker (see lean_action_ci.yml). Conventions live in .github/CODE_QUALITY.md.
Warnings are not allowed. lakefile.toml sets warningAsError = true, so any warning (an unused variable, a deprecated lemma, a linter hit) fails lake build on your machine just as it does in CI. Fix the code; suppressing the warning is not allowed either.
Every file has a build-time budget. Any file you add or modify must build in under 600 seconds on CI, and CI stops any single Lean process after 60 minutes. Split slow files or make their proofs cheaper; the advisory /profile report shows where the time goes.
Every new file also has a memory budget. CI compiles four files at once on a 16 GB runner, so it stops the compiler of any file your PR adds once it holds more than 3 GiB of memory. If the runner still runs short, CI stops the compiler holding the most and names the files that were compiling. Split such a file, or make its proofs or certificates cheaper to check. To measure a file yourself, read RssAnon in /proc/<pid>/status while lean compiles it.
Python. From python/: uv run ruff check, uv run ruff format, and uv run --group test pytest.
- Naming. Full words, not abbreviations (
configuration, notconfig). - Comments. Only when the why is non-obvious; don't restate what the code does.
- Functions. Keep bodies under ~40 lines; write self-documenting code.
- Logging. Use loggers in library code; CLI entry points may print user-facing output.
- Python. Absolute imports at the top of the file; modern type hints (
|, built-inlist/dict); module-level and Google-style function docstrings. - Lean. See
.github/CODE_QUALITY.md.
