# Google DeepMind formal-papers: Lean 4 PaperLib and Megatheorems

> Source: <https://explainx.ai/blog/google-deepmind-formal-papers-paperlib-lean-december-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog>
> Published: 2026-12-05 00:00:00+00:00

**Key takeaway:** DeepMind's formal-papers ships executable Lean 4 with megatheorems declared as private axioms visible to Lean's kernel, and `lake exe axioms --root Papers` reports them so downstream theorems automatically drop the axiom once the megatheorem is proved.

**Google DeepMind published [formal-papers on GitHub](https://github.com/google-deepmind/formal-papers?ref=explainx)**, an **open Lean 4 collection** of **machine-checked mathematical and computer science formalizations** built on **PaperLib**, a **shared library** atop **[Mathlib](https://github.com/leanprover-community/mathlib4?ref=explainx)**, **TauCeti**, **cslib**, and **cslib-frontier**. The **[README](https://github.com/google-deepmind/formal-papers/blob/main/README.md?ref=explainx)** says content was **AI generated**, warns readers to **expect mistakes**, and documents **megatheorems**: **unproved but statement-visible axioms** when missing theory would otherwise block formalization.

## Why PaperLib exists

Formalizing a **research paper** often needs **lemma infrastructure** absent from **Mathlib**. DeepMind centralizes that backlog in **PaperLib**, then splits **finished papers** into **`formal-papers-YYYY`** repositories (2026 back through historical buckets, plus **pre-1500**).

PaperLib is **broader and less curated** than upstream libraries. Maintainers plan to **delete PaperLib modules** when **Mathlib** absorbs them.

## Megatheorems and axiom honesty

Formal verification seal: puzzle pieces fitting with a green check

When a paper needs a **famous theorem** whose proof requires **large missing libraries**, PaperLib can declare a **megatheorem**: a **tagged statement** backed by a **private axiom** visible to **Lean's kernel**. Dependents pick up **megatheorem_corollary** tags.

Tools:

- `lake exe axioms --root Papers`
- `lake exe axioms --module Papers.arxiv_2407_14091.MainTheorem`
- `#print axioms` via`lake env lean --stdin`

Each paper package records dependencies in **`formalization.yaml`**. When someone **later proves** the megatheorem, the **axiom drops** automatically for **downstream theorems**.

That design matters after **[Opus Lean CPython bugs post](https://explainx.ai/blog/opus-5-5-cpython-lean-formalization-418-bugs-2026)** and **[AlphaProof Signal verification](https://explainx.ai/blog/google-deepmind-alphaproof-code-signal-protocol-formal-verification-2026)** taught readers to ask **what exactly was checked**.

## Expect mistakes: README guardrails

DeepMind repeats four cautions:

1. **Kernel-checked proofs** do not stop**wrong statements** .
2. **Megatheorem misformulations** slip past proof checking.
3. **Per-paper README notes** document**translation discrepancies** ; they are not accusations against original authors.
4. **Formalized version** may not be the**latest arXiv v** .

Treat artifacts as **experimental research**, not **homework answers**.

## Quickstart commands

Math proof chalkboard: node chain ending in a green check

Prerequisites: **git 2.25+**, **curl**, **elan**.

Example from README for **arXiv:2407.14091** in **formal-papers-2024**:

- `git clone --filter=blob:none --sparse https://github.com/google-deepmind/formal-papers-2024`
- `git sparse-checkout set arxiv/2407.14091`
- `lake exe cache get`
- `lake build`

Optional **linters**: `lake exe runLinter`, `lake exe module-system`.

For **PaperLib search**, clone **formal-papers**, run `bash scripts/bootstrap.sh`, then `python3 scripts/search_paper_lib.py --topics Analysis`.

## Relation to OpenAI's December topology drop

OpenAI's **[exotic four-spheres preprint](https://explainx.ai/blog/openai-exotic-four-spheres-khovanov-smooth-poincare-december-2026)** ships **PDF plus LaTeX**. DeepMind's release ships **executable Lean** with **axiom reports**. Teams building **AI-for-science** pipelines should plan for **both modalities** in review queues.

## Relation to prior DeepMind formal posts

explainx.ai already covered **[AlphaProof code verification](https://explainx.ai/blog/google-deepmind-alphaproof-code-signal-protocol-formal-verification-2026)** and **[Hadwiger Gemini Lean proof](https://explainx.ai/blog/google-hadwiger-conjecture-gemini-4-lean-proof-december-2026)**. **formal-papers** is the **library layer** those efforts can **feed**, similar in spirit to **[Anthropic lattice Lean papers](https://explainx.ai/blog/anthropic-lattice-papers-lean-formal-math-github-november-2026)**.

## Repository layout and year-split packages

The **main repo** holds **PaperLib/** lemmas and **annotations/** metadata using **literature-links** conventions. **Per-year repos** (`formal-papers-2026`, `formal-papers-2025`, down to **historical buckets**) host **individual Lake packages** so you **sparse-checkout** only what you need.

That split keeps **git clone** sizes manageable when **Mathlib cache** already consumes **gigabytes**. It mirrors how **[Left to Solve](https://explainx.ai/blog/left-to-solve-ai-agents-open-math-lean-erdos-november-2026)** ships **challenge lists** separate from **proof attempts**.

## Tooling beyond `lake build`

README documents:

- **`lake exe runLinter`** for**style and sorry checks** configured strict
- **`lake exe module-system`** for**Lean 4 module graph hygiene**
- **`scripts/search_paper_lib.py`** for**topic and carrier grep**

For **CI**, you can wire **`lake exe axioms`** into **GitHub Actions** and **fail** when **unexpected axioms** appear in **new PRs**. That pattern helped **[Certik TensorLean](https://explainx.ai/blog/certik-tensorlean-66-gpu-kernel-bugs-flashattention-deepgemm-december-2026)** cultures adapt to **kernel verification**; formal math benefits similarly.

## AGENTS.md and contributor workflow

**CONTRIBUTING.md** plus **`.agents/skills/formalize`** hint DeepMind expects **agent-assisted** formalization with **human review**. If you contribute:

1. Pick a **permissively licensed** paper.
2. Open a **discrepancy issue** when**informal statements** do not match**Lean** .
3. Prefer **proving megatheorems** over**adding invisible axioms** when**Mathlib** catches up.

## Risk disclosure for downstream ML papers

Teams citing **PaperLib lemmas** in **NeurIPS-style proofs** should attach **`formalization.yaml` axiom lists** as **supplementary material**, the same way **[CLIP benchmarks](https://explainx.ai/blog/fantasticml-benchmark-48-tasks-agents-beat-human-sota-fable-5-2-opus-5-5-december-2026)** attach **eval scripts**.

## What to run before you cite a lemma

1. **Sparse-checkout** only the**arXiv ID** you need.
2. Run **`lake exe axioms`** and store the output beside your**internal memo** .
3. Read the **paper README discrepancy** section before you tweet**theorem X formalized** .
4. File **GitHub issues** using the**Report Discrepancy** template if you find**statement bugs** .

## Example workflow for one arXiv paper

Suppose you care about **arXiv:2407.14091** (README quickstart example).

1. **Sparse clone**`formal-papers-2024` and** checkout** only that directory.
2. Run **`lake exe cache get`** to pull**Mathlib** artifacts.
3. **`lake build`** the package; capture**warnings** as**errors** because**sorry** is disallowed.
4. **`lake exe axioms --module`** on the**main theorem** file; save output in your**paper notes** .
5. Read **paper README discrepancies** before citing**lemma names** in**slides** .

If **axioms** include **megatheorem** tags, **link** the **formalization.yaml** hash in your **internal wiki** so teammates know **which literature results** were **assumed**.

## How PaperLib relates to Mathlib growth

Mathlib maintainers **merge** community lemmas on **schedules** DeepMind does **not control**. **PaperLib** is an **incubator**: faster **AI formalization**, **higher mistake rate**, **eventually** **upstreamed** or **deleted**.

That mirrors **industry data lakes** beside **warehouses**. Teach **interns** the difference so they **do not** treat **PaperLib** as **Mathlib** quality **by default**.

## Comparison with Opus CPython formalization

**Anthropic Opus** **[CPython Lean project](https://explainx.ai/blog/opus-5-5-cpython-lean-formalization-418-bugs-2026)** found **hundreds** of **implementation bugs** because **code** was **messy** but **executable**. **PaperLib** targets **published math**, where **mistakes** are **logical misstatements**, not **off-by-one C bugs**.

Both show **formal methods** returning **value** when **automation** scales **review bandwidth**.

## Licensing and what is not redistributed

README repeats: **only permissively licensed works** are formalized; **PDFs** stay with **publishers**. **Lawyers** should confirm **your institution** can **run Lean** on **derivative formalizations** before **shipping product features** that **embed theorem text**.

## Failure modes the README foreshadows

| Failure | Symptom | Mitigation | 
|---|---|---|
| Misstated definition | Kernel proves wrong theorem | Read discrepancy notes | 
| Megatheorem drift | Hidden axiom in corollary chain | `lake exe axioms` | 
| Wrong paper version | Formalized v1 not v3 arXiv | Check README version note | 
| Overclaimed correctness | Press says proved | Quote README **Expect Mistakes** | 

Teaching **junior engineers** to read **failure tables** before **tweet threads** is part of **[formal methods literacy](https://explainx.ai/blog/certik-tensorlean-66-gpu-kernel-bugs-flashattention-deepgemm-december-2026)** now that **labs ship math** like **models**.

## Why DeepMind open-sourced now

**Top labs** compete on **trust** as much as **benchmarks**. After **[Gemini Cohen-Lenstra](https://explainx.ai/blog/google-deepmind-gemini-4-cohen-lenstra-cogentic-december-2026)** and **[cell biology models](https://explainx.ai/blog/google-cellgemma-open-cancer-car-t-prediction-december-2026)**, **PaperLib** signals **long-horizon investment** in **checkable science**, not **one-off demos**.

**Stars** on **day one** are **noise**; **watch** **issue tracker** velocity and **Mathlib PRs** **cherry-picking** **PaperLib lemmas**.

## Bootstrap and Python search script

The README **`scripts/bootstrap.sh`** prepares **local tooling**; **` search_paper_lib.py --carriers`** helps when you **forgot Mathlib module paths**. Require **Python 3.10+** in **CI images** alongside **elan**.

If **`lake exe cache get`** fails behind **corporate proxies**, mirror **cache** tarballs per **Lean community docs** before **blocking** **formal-papers** pilots on **IT tickets**.

## Formal-papers versus formal-papers-2026

The **year repos** will accumulate **December** uploads faster than **this overview post** updates. Subscribe to **GitHub releases** on **`formal-papers-2026`** if you **formalize current arXiv** work; stay on **` formal-papers` root** if you **extend PaperLib** itself.

## Annotating PaperLib with literature-links

The **annotations/PaperLib/** tree uses **literature-links** metadata so **formalized lemmas** trace to **DOI** and **arXiv** records. When you **browse** a **carrier** (for example **LeibnizAlgebra** in the README search example), you are **navigating** both **Lean names** and **bibliographic graph edges**.

**Product managers** building **citation widgets** can **mirror** that **separation**: **human-readable reference**, **machine-checked artifact**, **explicit axiom debt**.

## When to fork versus upstream

If your **company formalizes** **trade-secret** **algorithms**, **do not** open **PaperLib PRs** with **proprietary lemmas**. **Fork privately**, run the **same tooling**, and **contribute** only **sanitized** **megatheorems** after **legal review**.

Public **formal-papers** is for **published science**, not **unreleased model architectures**.

## Deep dive on megatheorem_corollary tagging

Dependents marked **megatheorem_corollary** inherit **visibility** into **which literature results** were **assumed**. When **Mathlib** eventually **proves** the **parent megatheorem**, **Lean** **rebuilds** **corollaries** without **manual grep** across **hundreds** of files.

That is **technical debt tracking** **mathematicians** understand as **conditional results**, automated the way **software teams** track **open work items linked to issues**.

## githooks and CI hints

The repo ships **`.githooks`** and **`.github`** workflow stubs so **contributors** run **axiom audits** before **push**. If you **vendor** **PaperLib** lemmas into a **product**, **vendor** the **same hooks** or **reimplement** them in **your monorepo** **lint** stage.

**Lake** **`warn.sorry = true`** with **` warningAsError`** means **partial proofs** **fail CI**, aligning **formal-papers** with **production** **strictness** rather than **notebook** **culture**.

## Reading list for new formal engineers

1. **Lean 4 theorem proving** basics on**leanprover community** pages.
2. **Mathlib style guide** for**naming** .
3. **This README****Expect Mistakes** section.
4. explainx **[Opus CPython bugs](https://explainx.ai/blog/opus-5-5-cpython-lean-formalization-418-bugs-2026)** for**scale reference** .
5. **[Left to Solve](https://explainx.ai/blog/left-to-solve-ai-agents-open-math-lean-erdos-november-2026)** for**agent loops** .

**Apache-2.0** licensing lets you **experiment commercially** with **PaperLib** code, but **theorem text** is **not** a **patent grant** on **underlying math**. Keep **lawyers** in the loop when **shipping** **formal verification** features to **paying customers**. Document **axiom debt** in **SOC2** packets the same way you document **third-party OSS** licenses. **Security reviewers** increasingly ask **what you proved** versus **what you assumed** when **AI writes proofs**.

**Issue templates** on **GitHub** separate **PaperLib bugs** from **paper-specific discrepancies** so triage stays **fast**. When you file, paste **`lake exe axioms` output** and the **`formalization.yaml` hash** if present. Screenshots without **axiom lists** slow maintainers down. **Good bug reports** read like **compiler output**, not **marketing blurbs**. Attach **Lean version** from **lean-toolchain** too.
