formal-math: Anthropic formalizes frontier mathematics in Lean 4
A collection turning frontier mathematics papers into checkable Lean 4 proofs, with a pinned toolchain per subproject.
GitHub anthropics/formal-math Updated 2026-12-05 Branch main Stars 1.9K Forks 248
Lean 4 Formalized mathematics Mathlib Palomar Lake

🧭 Decision Guide

Try it if you

  • You want to reproduce theorems from zeta23, eth, or vp-vnp in Lean 4/Mathlib
    The README project table lists these directories, their mathematical statements, and their toolchains
  • You need a Palomar-style Challenge.lean, Solution.lean, and comparator.json layout
    The README states that each project follows the Palomar submission template
  • You want CI to check lake build, the absence of sorry, and nanoda comparator acceptance
    The README CI section explicitly describes the verify job's pass conditions

Skip it if you

  • You need a stable software package with published releases; this repository currently has no releases
    Project metadata reports 0 releases and the latest version as No releases
  • You expect every project to participate in automatic CI; lattices is verified only through workflow_dispatch
    The README project table states that lattices is verified only in a manual run
  • Your Lean environment cannot match v4.33.0-rc2, v4.33.1, or v4.34.1
    The README lists these Lean/Mathlib versions for different subprojects

Requirements

  • Lean 4 and the toolchain pin declared by the target subproject
  • The corresponding Mathlib version or commit, such as v4.33.1, 0df444a, or d13f23b7
  • Build from inside the target subdirectory; the README says “build from inside the subdirectory”
  • Lake is required for project builds; CI's pass condition includes “lake build succeeds on its pinned toolchain”
  • Comparator checks require toolchain-matched lean4export, the nanoda kernel, and the landrun sandbox

First step (verbatim from README)

lake build

Watch out

  • Changing only the README or .github documentation does not trigger project verification
    The README CI section says documentation or CI configuration changes verify nothing by default
  • lattices has no formalization.yaml and cannot follow the same Palomar submission flow as the other projects
    The README explicitly says lattices has no formalization.yaml
  • The pass condition allows sorry in trusted comparator statement files such as Challenge.lean and Challenge/.lean
    The README CI section requires no sorry outside trusted comparator statement files

Alternatives

  • Palomar Registry:Use it when you need to browse or submit projects following the Palomar template rather than maintain the formal-math repository directly
    README正文 and the Palomar link

Not stated in the README

  • The README does not provide complete installation commands or dependency acquisition steps for each subproject
  • The README does not state build times or minimum hardware requirements for zeta23, 3sum-apsp, or lattices
  • The README does not identify which projects are maintained by each of the 10 contributors
  • The README does not provide test coverage or the number of verified theorems for each project
  • The README does not explain whether 0 releases means the project is not ready for a stable release
  • The README does not explain why GitHub Trending shows 0 new stars today despite 1,916 total stars

💡 Deep Analysis

6
Yes I am preparing to submit a Lean 4 paper proof to Palomar and require CI to check `Challenge.lean`, `Solution.lean`, `comparator.json`, and `formalization.yaml`. Is this repository's project template a suitable starting point?
For: A formal-mathematics engineer preparing to submit a Lean 4 paper proof to Palomar and needing to provide Challenge.lean, Solution.lean, comparator.json, and formalization.yaml

Yes. The repository’s top-level README directly specifies the Palomar layout, build requirements, and comparator acceptance flow, making it a suitable starting template.

  • Every top-level subdirectory is an independent Lake project with its own toolchain, README, and build configuration, giving each submission a reproducible version boundary.
  • The README requires Challenge.lean, Solution.lean, comparator.json, and formalization.yaml at the project root; Challenge states the headline theorems and Solution proves them from the library.
  • A new project must also provide lakefile.toml or lakefile.lean, lean-toolchain, and lake-manifest.json, with a Mathlib-only Challenge module.
  • CI passes only when lake build succeeds, disallowed sorry is absent from the formal proof, and every declared comparator configuration prints Your solution is okay!.

The README does not explain how to design Challenge interfaces for difficult theorems or provide a complete comparator configuration example.

  • README: each subdirectory is a self-contained Lake project
  • README: Palomar submission template (`Challenge.lean` / `Solution.lean` / `comparator.json` / `formalization.yaml`)
  • README: project-addition requirements for `lakefile`, `lean-toolchain`, `lake-manifest.json`, and a Mathlib-only Challenge
  • README CI: `Your solution is okay!`; `lake build`; no `sorry`
lake build
Not stated in the README:The README does not provide a complete copyable Palomar project example from scratch.;It does not document the semantics of comparator fields, the permitted proof-dependency scope, or failure-diagnostic formats.
No I mainly use Python and want to run the repository's mathematical algorithms directly or use it as a production mathematics package. With 71,448,132 bytes of Lean code, is this project suitable for me?
For: An application developer familiar mainly with Python who wants to quickly run mathematical algorithms or use the repository as a production math package

No. This repository delivers machine-checked Lean 4 formalization assets, not a Python-facing algorithm library or production application package.

  • Lean is the main language, with about 71,448,132 bytes of Lean versus about 46,010 bytes of Python; the repository is organized around proof sources.
  • The README describes machine-checked formalizations of results on the Riemann zeta function, 3SUM/APSP, ETH, VP/VNP, lattice cryptography, and Hilbert spaces, not executable application APIs.
  • Each project must be built inside its own subdirectory with its own pinned Lean toolchain, Mathlib manifest, and Lake configuration; it is not a single installable Python package.
  • The project insights explicitly state that it is not a mathematical calculator, algorithm library, or directly deployable application. Users also need Lean 4, type theory, Mathlib APIs, Lake, and relevant mathematical background.

The README does not specify a Python API, release package, stable application interface, or runtime performance for executing algorithms, so it cannot support a Python-integration plan by itself.

  • Project data: main language Lean; Lean `71448132`, Python `46010`
  • README project table: machine-checked Lean 4 formalizations covering zeta, 3SUM/APSP, ETH, VP/VNP, lattices, and Hilbert spaces
  • README: each subdirectory is a self-contained Lake project and must be built from inside that subdirectory
  • Project insights, usage limitations: not a mathematical calculator, algorithm library, or directly deployable application
Not stated in the README:The README does not state whether any stable Python, command-line, or runtime API exists.;It does not provide a path for exporting the formal proofs into executable algorithms, services, or production packages.
It depends I am studying integral- and module-lattice algorithms for quantum word RAM programs with Lean 4.34.1 and Mathlib d13f23b7. Is this project suitable if I require Palomar's automated acceptance checks?
For: A lattice-cryptography researcher maintaining Lean 4.34.1 with Mathlib d13f23b7 and needing to verify lattice theorems for quantum word RAM programs

It depends. lattices/ matches your Lean and Mathlib versions, but it currently cannot provide Palomar acceptance in the same automated way as the other projects.

  • The README describes major theorems from four lattice-problem and lattice-cryptography papers, including galactic quasi-polynomial quantum algorithms for integral and module lattices.
  • Its pins are leanprover/lean4:v4.34.1 and Mathlib d13f23b7, matching your stated environment.
  • However, the README explicitly says that lattices/ has no formalization.yaml and is not currently submitted to Palomar.
  • CI verifies it only through a manual workflow_dispatch run with projects = lattices, using its own pins in .github/pins/lattices.env.

Thus it is suitable as version-matched formalization research material, but not if Palomar automation is your current delivery gate. The README also does not say whether the manual path runs exactly the same independent-kernel checks as other projects.

  • README project table: `lattices/`; “galactic quasi-polynomial quantum algorithms for integral and module lattices”
  • README project table: `leanprover/lean4:v4.34.1` / Mathlib `d13f23b7`
  • README: “`lattices/` is not submitted to Palomar for now. It has no `formalization.yaml`”
  • README CI: manual run (`workflow_dispatch`, projects = `lattices`)
lake build
Not stated in the README:The README does not state whether manual CI for `lattices/` runs all independent acceptance steps involving `nanoda`, `landrun`, and the comparator.;It does not state the formalization coverage for each of the four papers.
Yes I maintain a repository containing `zeta23`, `3sum-apsp`, `eth`, `vp-vnp`, and `isp-hilbert-spaces`, and want pull requests to rebuild only changed projects. Does this CI design support that?
For: A CI engineer maintaining a Lean research repository containing zeta23, 3sum-apsp, eth, vp-vnp, and isp-hilbert-spaces, who wants to rebuild only affected projects

Yes. The README explicitly designs CI to select projects by changed paths while retaining clean full-build paths for merges and manual runs.

  • Pull requests and pushes to main verify only project folders with file changes; ordinary documentation or .github/ changes do not verify projects by default.
  • Pull-request runs reuse the previous Lake build for the same toolchain and manifest and rebuild only changed modules; merges to main and manual runs build from scratch.
  • Projects with SPLIT_JOBS=1 separate the build job from each comparator configuration, which isolates build and acceptance failures.
  • Projects with MANUAL_ONLY=1 are verified only through manual runs; the README explicitly identifies lattices as such a project.

This fits incremental validation for a research repository, but the README does not provide actual build times, cache-hit rates, or runner costs per project.

  • README CI: PRs and `main` pushes run “on each project folder whose files changed, and only on those”
  • README CI: PR runs reuse the previous Lake build; merges and manual runs build from scratch
  • README CI: `SPLIT_JOBS=1` splits build and comparator jobs
  • README CI: `MANUAL_ONLY=1` is manual-only; `lattices` is the stated example
Not stated in the README:The README does not state the actual hit rate or invalidation conditions for GitHub Actions caching.;It does not provide average build times for each project on `ubuntu-latest` or a 16-core runner.
No I am studying the invariant subspace problem on separable complex Hilbert space with Lean 4.34.1 and Mathlib v4.34.1. Can this project directly replace reading the paper and reviewing its mathematical assumptions?
For: A formal-mathematics researcher studying the invariant subspace problem and using Lean 4.34.1 with Mathlib v4.34.1

No. It should not directly replace reading the paper and reviewing its assumptions; it checks precisely encoded claims, not every statement in the paper.

  • The README says isp-hilbert-spaces/ proves that a bounded operator on ℓ² has only {0} and ℓ² as closed invariant subspaces, yielding a negative answer for the problem on separable complex Hilbert space.
  • The project pins Lean 4.34.1 and Mathlib v4.34.1 and must pass lake build, so the encoded theorem and proof can be checked.
  • The layout separates the proposition in Challenge.lean from the proof in Solution.lean, meaning the directly verified object is an explicitly encoded theorem rather than the entire paper.
  • The project insights state that formalized results generally verify precisely defined mathematical propositions and do not automatically establish every informal claim, experiment, or engineering detail in a paper.

The README does not provide the complete definition set, assumption mapping, or a theorem-by-theorem correspondence with the paper.

  • README project table: `isp-hilbert-spaces/`; “There is a bounded operator on ℓ²...”
  • README project table: `leanprover/lean4:v4.34.1` / Mathlib `v4.34.1`
  • README: Palomar layout with `Challenge.lean` / `Solution.lean`
  • Project insights, usage limitations: formalized results do not automatically prove all informal claims, experiments, or engineering details
lake build
Not stated in the README:The README does not provide the complete Lean definitions of separability, complex Hilbert space, or closed invariant subspace used by the project.;It does not map the formal theorem to every assumption, lemma, and main theorem in the paper.
Yes I am formalizing the 3SUM, (min,+)-product, and APSP complexity results with Lean 4.33.1 and Mathlib v4.33.1. Can I use this project as a reproducible proof benchmark?
For: A theoretical computer science researcher using Lean 4.33.1 and Mathlib v4.33.1 to reproduce complexity-theory results and verify paper theorems item by item

Yes. 3sum-apsp/ is suitable as a reproducible formal-proof benchmark because it packages these complexity results as an independently buildable Lean project, but it is not an executable algorithm benchmark.

  • The README lists the O(n^1.9992) 3SUM result and the O(n^2.99942) APSP result, along with Exact Triangle and Zero-Weight k-Clique results.
  • The project pins leanprover/lean4:v4.33.1 and Mathlib v4.33.1, reducing dependency drift.
  • CI requires lake build to succeed and disallows sorry outside the permitted statement files.
  • Acceptance also uses the Palomar comparator, toolchain-matched lean4export, the independent nanoda kernel, and the landrun sandbox, so validation goes beyond ordinary compilation.

The README does not specify the exact formalization boundary for every theorem, proof size, or build time.

  • README project table: `3sum-apsp/`; “3SUM in O(n^1.9992) ... APSP in O(n^2.99942) steps”
  • README project table: `leanprover/lean4:v4.33.1` / Mathlib `v4.33.1`
  • README CI: `lake build` succeeds; no `sorry`
  • README CI: `lean4export`, independent `nanoda` kernel, and `landrun` sandbox
lake build
Not stated in the README:The README does not state which assumptions and theorem boundaries of the paper are formalized for each 3SUM, APSP, or related result.;It does not provide full build times, memory requirements, or proof sizes by module.

✨ Highlights

  • Covers the Riemann zeta problem, ETH, and VP≠VNP theorems
  • Each subproject pins its own Lean 4 and Mathlib toolchain
  • CI validates with lake build and the independent nanoda kernel
  • Among 6 projects, lattices is verified only through manual CI

🔧 Engineering

  • Organizes verifiable theorems with Challenge.lean and Solution.lean
  • Provides independent Lake projects including zeta23, 3sum-apsp, and eth
  • The Palomar comparator checks every declared configuration

⚠️ Risks

  • Projects require exact toolchains; zeta23 uses v4.33.0-rc2
  • The README requires building inside each subdirectory, not from the repository root
  • lattices lacks formalization.yaml and is not submitted to Palomar

👥 For who?

  • Researchers who need to verify mathematical papers with Lean 4 and Mathlib
  • Lean developers maintaining Palomar Challenge/Solution projects
  • Teams working on formalization of zeta, complexity, or lattice cryptography results