Formal Papers & PaperLib
Formal Papers is an open collection of machine-checked mathematical and computer science formalizations in Lean 4, built on PaperLib, a shared library of reusable definitions, structures, and theorems.
Formalizing a research paper often requires developing background theory not yet available in Mathlib or other shared libraries. We are sharing these AI-generated formalizations and PaperLib to reduce that burden. PaperLib builds on Mathlib, TauCeti, cslib, and cslib-frontier: it is broader and less curated. Over time, we will remove material from PaperLib as the upstream libraries expand to cover it.
When a paper invokes a well-known theorem whose proof would require substantial missing theory, PaperLib states it as a megatheorem: a tagged declaration backed by a private Lean axiom (@[megatheorem], with transitive PaperLib dependents tagged @[megatheorem_corollary]). Because the backing axiom is visible to Lean's kernel, lake exe axioms and #print axioms track exact dependencies per paper (recorded automatically in formalization.yaml). When a megatheorem is later proved, its axiom is discharged and downstream theorems automatically drop the dependency.
Expect Mistakes
The Lean formalizations, documentation, and per-paper notes in this project were generated autonomously by AI systems, and we expect there to be mistakes:
- Although proofs are checked by the Lean 4 kernel (without sorry), definitions and theorem statements can still misstate, oversimplify, specialize, or otherwise diverge from the intended informal mathematics.
- Megatheorem declarations are unproved formal statements of results from the literature, so any misformulation in a megatheorem statement is not caught by proof checking and could affect downstream results that depend on it.
- Formalization notes in each paper's README.md record discrepancies encountered when translating a paper's informal statements into Lean 4. These frequently stem from omitted standing conventions, implicit domain assumptions, or informal-to-formal translation mistakes by the AI, and should not be read as claims of errors in the source papers.
- If a work exists in multiple versions, we may not have formalized the most up-to-date version.
Please treat all contents of these repositories as experimental research artifacts, and verify definitions, statements, and axiom dependencies carefully before relying on them. If you see mistakes or have any suggestions, please file an issue.
Quickstart
Prerequisites: git (>= 2.25), curl, and elan:
curl https://elan.lean-lang.org/elan-init.sh -sSf | sh
1. Build and check a single formalized paper
You do not need to clone formal-papers. Sparse-checkout just the paper you want from its year/period repository (for example, arXiv:2407.14091 in formal-papers-2024):
git clone --filter=blob:none --sparse https://github.com/google-deepmind/formal-papers-2024
cd formal-papers-2024
git sparse-checkout set arxiv/2407.14091
cd arxiv/2407.14091
# Download prebuilt Mathlib, TauCeti, and PaperLib caches, then compile
# (`lakefile.toml` enables `warn.sorry = true` and `warningAsError = true`)
lake exe cache get
lake build
# Audit duplicate declarations & axioms across the paper (verified PaperLib megatheorems allowed)
lake exe axioms --root Papers
lake exe axioms --module Papers.arxiv_2407_14091.MainTheorem
# Inspect a single theorem's axioms directly
printf 'import Papers.arxiv_2407_14091.MainTheorem\n#print axioms Papers.arxiv_2407_14091.minDegreeAt_le_choose_of_sized_intersecting\n' | lake env lean --stdin
# Run Lean linters and `module` opt-in check
lake exe runLinter --no-build Papers.arxiv_2407_14091.MainTheorem
lake exe module-system Papers.arxiv_2407_14091.MainTheorem
2. Browse or search PaperLib
Clone this repository if you want to search PaperLib or build a library module (python3 >= 3.10 required for the search script):
git clone --filter=blob:none https://github.com/google-deepmind/formal-papers
cd formal-papers && bash scripts/bootstrap.sh
# Optional: `lake exe cache get` also downloads the prebuilt PaperLib cache
python3 scripts/search_paper_lib.py --carriers LeibnizAlgebra
python3 scripts/search_paper_lib.py --topics Analysis
lake build --no-ansi -q PaperLib.Analysis.SpecialFunctions.AbelIteration.Basic
3. Formalize a paper or contribute
See CONTRIBUTING.md.
Organization of this repository
This repository (formal-papers) is a single Lake package defining the shared PaperLib library (it does not contain the formalized papers themselves):
- PaperLib/: Shared, source-agnostic Lean 4 modules, configured by the root lakefile.toml.
- annotations/PaperLib/: Bibliographic annotations paired 1-to-1 with PaperLib/ modules (using literature-links).
- scripts/: Utilities for searching PaperLib, fetching prebuilt caches, and scaffolding or checking formalizations.
Organization of downstream formal-papers-* repositories
Formalized works live in separate repositories sharded by publication period. Unlike this repository, a formal-papers-<period> repository has no root lakefile.toml: instead, each work is an independent, standalone Lake package in its own subdirectory, pinning a revision of PaperLib from this repository.
- Single-year repositories (formal-papers-2000 onward): works live under {arxiv,journals,books,other}/<id-or-slug>/ (for example, arxiv/2407.14091/).
- Multi-year repositories (formal-papers-1990s and earlier): works live under <year>/{arxiv,journals,books,other}/<id-or-slug>/ (for example, 1954/journals/hoffman-taussky-normal-matrices-1954/ or bce300/books/euclid-elements-ix-20/).
Each work directory contains its own lakefile.toml, formalization.yaml, and Lean files under Papers/<mod_id>/.
- formal-papers-2026
- formal-papers-2025
- formal-papers-2024
- formal-papers-2023
- formal-papers-2022
- formal-papers-2021
- formal-papers-2020
- formal-papers-2019
- formal-papers-2018
- formal-papers-2017
- formal-papers-2016
- formal-papers-2015
- formal-papers-2014
- formal-papers-2013
- formal-papers-2012
- formal-papers-2011
- formal-papers-2010
- formal-papers-2009
- formal-papers-2008
- formal-papers-2007
- formal-papers-2006
- formal-papers-2005
- formal-papers-2004
- formal-papers-2003
- formal-papers-2002
- formal-papers-2001
- formal-papers-2000
- formal-papers-1990s
- formal-papers-1980s
- formal-papers-1970s
- formal-papers-1960s
- formal-papers-1950s
- formal-papers-1940s
- formal-papers-1930s
- formal-papers-1920s
- formal-papers-1910s
- formal-papers-1900s
- formal-papers-1800s
- formal-papers-1700s
- formal-papers-1600s
- formal-papers-1500s
- formal-papers-pre1500
Reporting Issues
If you find a bug, formalization discrepancy, misformulated megatheorem, citation or attribution error, or outdated paper version, or if you have author feedback or suggestions, please open a GitHub issue:
- Paper-specific discrepancies and author notes: file an issue in that work's formal-papers-<period> repository using its Report Discrepancy / Author Note issue template, or open a discrepancy report in formal-papers if you are unsure where it belongs.
- PaperLib, tooling, build/cache bugs, or general feedback: open an issue in formal-papers.
Including the source work (arXiv ID or DOI), repository path, and affected Lean module or declaration name helps us triage quickly. Pull requests fixing issues are also welcome; see CONTRIBUTING.md.
License
All code and documentation in formal-papers and formal-papers-<period> are licensed under the Apache License, Version 2.0. We only publish formalizations of permissively licensed works (such as CC BY, CC0, MIT, Apache-2.0, or public domain), and do not redistribute the works themselves.
This is not an officially supported Google product.