# Collection of AI-checked math and CS formalizations in Lean 4

> Source: <https://github.com/google-deepmind/formal-papers>
> Published: 2026-12-05 18:38:28+00:00

**Key takeaway:** PaperLib's @[megatheorem] declarations let formalizations cite unproved literature results as tagged private axioms that `lake exe axioms` and `#print axioms` trace per paper, and downstream theorems automatically drop the dependency once the axiom is discharged.

**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](https://github.com/leanprover-community/mathlib4), [TauCeti](https://github.com/TauCetiProject/TauCeti), [cslib](https://github.com/leanprover/cslib), and [cslib-frontier](https://github.com/cslib-community/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.

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](https://github.com/google-deepmind/formal-papers/issues).

**Prerequisites:** `git` (`>= 2.25`), `curl`, and [` elan`](https://github.com/leanprover/elan):

```
curl https://elan.lean-lang.org/elan-init.sh -sSf | sh
```

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`](https://github.com/google-deepmind/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
```

## Optional axiom, linter, and module-system checks

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

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
```

See [`CONTRIBUTING.md`](https://github.com/google-deepmind/formal-papers/blob/main/CONTRIBUTING.md).

This repo ([formal-papers](https://github.com/google-deepmind/formal-papers)): The shared Lean 4 library (`PaperLib/`) and its bibliographic annotations (` annotations/PaperLib/`, using [literature-links](https://github.com/mathlib-initiative/literature-links)).

## Separate repositories by publication period containing the formalized works.

Each work is a standalone Lake package with its own [`formalization.yaml`](https://github.com/mathlib-initiative/formalization.yaml).

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`](https://github.com/google-deepmind/formal-papers/issues/new?template=discrepancy-report.yml) if you are unsure where it belongs.
- **`PaperLib`, tooling, build/cache bugs, or general feedback:** open an issue in[`formal-papers`](https://github.com/google-deepmind/formal-papers/issues) .

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`](https://github.com/google-deepmind/formal-papers/blob/main/CONTRIBUTING.md).

All code and documentation in `formal-papers` and `formal-papers-<period>` are licensed under the [Apache License, Version 2.0](https://github.com/google-deepmind/formal-papers/blob/main/LICENSE). 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.
