# P vs NP: the Lean theory around Cook's Clay statement
Stephen Cook's official description of P vs NP for the Clay Mathematics Institute, as
lean-dojo/LeanMillenniumPrizeProblems states it in Lean, and the library of results proved about it here, with no
`sorry`. The statement stays fixed; the library grows. Nothing here settles P vs NP, and nothing merged here is a step
towards either answer.
## Where it stands (as of 2026-12-02)
P vs NP is open: Clay's page for it says "Unsolved" (, read 2026-12-02),
and no claim to have settled it has survived a reading. In this project's own Lean statement, even the easy inclusion
P ⊆ NP still rests on an unproved hypothesis, closure of polynomial time under composition.
The claims of 2026 that bear on this statement or stand next to it, and how far each has been checked. Four statuses:
**Lean-checked, statement read** (a Lean proof passes the kernel, and a named person outside its authors has said in
public that its statement says what is claimed); **Lean-checked, statement unread** (the proof passes; nobody outside
its authors has said that of the statement); **written argument, unread** (a paper or note no reader outside its
authors has said they checked); **refuted** (shown wrong, with the source). Nothing in the table has been rerun in this
project yet: the pieces named beside each row are how that changes.
| Date | Claim | Who, where | Status |
|---|---|---|---|
| 2026-06-03 | "Lean 4 Verified P = NP" | TiruArt/Pedigree-Polytopes-Lean4 | refuted: its issue #1 (2026-06-03), "Main theorem currently proves `True`, not `P = NP`" (V-17) |
| 2026-09-25 | P ⊆ NP for formal-conjectures' definitions (not this statement's) | AItoBit/p-subset-np, linked from formal-conjectures #6589 | Lean-checked, statement unread |
| 2026-10-05 | Composition closure and Cook–Levin proved against this very statement, at this project's Lean and Mathlib, so P ⊆ NP with no hypothesis | Joshua Tan, github.com/JoshuaTan42/millennium-cook-levin at 879c4835 (upstream issue #10, no reply) | Lean-checked, statement unread: by its author's report; written by Claude Code under his direction (V-7, V-8, S-1, S-5) |
| 2026-10-02, 2026-11-30 | `TM2ComputableInPolyTime.comp`, the same fact in Mathlib's words | Mathlib pull requests #44441 and #46794, open, no review | Lean-checked, statement unread (V-10) |
| 2026-10-19, 2026-11-03 | An explicit function in P needs Boolean circuits of 4n − O(log n) gates (3.5n − o(n) in the first version; 3.1n − o(n) before) | Mishra and Santhanam, ECCC TR26-260 | written argument, unread: a preprint whose proof, its authors say, "was elicited from AI tools" (R-4) |
| 2026-10-26 | The exponential time hypothesis is false: k-CNF counting in 2^{n/(log n)^{1/2+o(1)}} | OpenAI, openai/math family 378 | Lean-checked, statement unread: the Lean proves a weaker bound than the paper; the group of Impagliazzo, Paturi and Williams examining it has posted no verdict (V-2) |
| 2026-10-26 | The exponential time hypothesis is false: #3-SAT in 2^{O(n log log n/√log n)} | Anthropic, anthropics/formal-math `eth/` | Lean-checked, statement unread (V-1) |
| 2026-11-23 | VP ≠ VNP over every field | Anthropic, anthropics/formal-math `vp-vnp/`; rebuilt by Kim Morrison, 2026-11-24 | Lean-checked, statement read: Sébastien Tavenas and Shreyas Srinivas on the Lean Zulip, 2026-11-24; of the proof its README says "no human mathematician has checked the proof" (V-1, V-3) |
| 2026-11-23 | VP and VNP are different (border circuits) | OpenAI, openai/math; family 379 on 2026-11-24 | Lean-checked, statement unread (V-2, V-3) |
| 2026-11-23 | This statement is equivalent to cslib-frontier's P = NP; a 24-row reading of it against Cook's text | Will Binns, github.com/wbnns/monteverde v1.1.1 (upstream issue #12) | Lean-checked, statement unread; the reading is a written argument, unread, reviewed only by its AI author (V-9, V-11 to V-14) |
| 2026-11-25 | A human-written alternative proof that ETH is false | Mazor and Pass, ECCC TR26-347 | written argument, unread |
| 2026-11-26 | "A machine-checked proof that `P = NP`" | FibonacciAi/pnp-lean | refuted: a custom axiom and a `sorry`, its issue #4 (2026-11-26) (V-17) |
None of these is a result about P vs NP, and the papers say so in their own words: OpenAI's ETH result "does not imply
that general NP problems admit subexponential time algorithms", Anthropic's "does not bear on the P vs NP question
directly", and its VP ≠ VNP "does not apply to Boolean circuits". The maintainer agent keeps this table (piece L-1 is
everyone's way to correct it).
**What the Lean here shows.** That Cook's definitions, as lean-dojo wrote them in Mathlib's two-stack machines, compile
together with the tests that keep them from being degenerate, and that every result merged here follows from them with
no `sorry` and only Lean's three standard axioms. **What it does not show.** That the statement is Cook's (a reading,
V-11 to V-14; the step from Mathlib's machines to Cook's one-tape machine is proved nowhere), or anything about which of
P = NP and P ≠ NP holds.
## What this project is for
The project started from lean-dojo's P vs NP files at `603053dc267cf3efe422f438eb78098c0ececd6f` (2026-09-10) on
2026-12-02, and it is its own main line from then on: the Lean work is done here, and nobody re-pins it to a newer
upstream. Three kinds of work, most of it Lean:
- **Bring in and rerun what is claimed against this statement.** Tan's composition closure and Cook–Levin are public and
nobody else has rerun them: rerun them (V-7), read their SAT (V-8), port them file by file (S-1, S-5), so that
P ⊆ NP and the statement's 23 conditional theorems stand here with no hypothesis (S-6 to S-8). Rerun the year's other
Lean claims (V-1, V-2, V-9).
- **Prove what nobody has, in this model**: closure of P and NP (S-2, S-3, S-12), the first levels of the polynomial
hierarchy (S-4), first machines of one's own (S-9 to S-11), more NP-complete problems (S-13 to S-17), one alphabet is
enough (S-18), Cook's one-tape machine decides the same P (S-19), a standard CNF encoding (S-20), the comparison with
formal-conjectures' P ≠ NP in Lean (S-22). Several of these take days and are hard; their issues say so.
- **Read and record**: the statement against Cook's text, clause by clause (V-11 to V-14), the hierarchy file against a
textbook (V-16), the table above (L-1). These need no build: they are a share of the work, not its centre.
## How to take part
1. Read this page and [`AGENTS.md`](AGENTS.md). Its "First session" takes a few minutes and needs no Lean.
2. Pick one piece from the project's issues (titles start with a letter and a number: P, S, M, V, R, L). The goal issue
says where to start by what you have: reading only, a laptop with elan, or a large machine and days.
3. Claim it with a branch and a note in `routes//README.md` (AGENTS.md shows how), so that two people do
not take the same piece. Then one change, one pull request.
4. A rerun is a dated record in `routes//RERUN.md`, in the one template AGENTS.md gives: machine, image,
commit, command, what it printed, what was not checked.
## How work is judged, and when
- **Two checks on every push**, both needed for a merge, their code `checks/` at the approved version: `challenge`, in
seconds (`Millennium.lean` and `Sanity.lean` as approved, the build configuration too, no `sorry`, `admit`, `axiom`,
`native_decide`, `implemented_by` or `extern`); `build`, in minutes, in the project's Lean image with no network
(`lake build` of `Problems` and `Tests` ends without error, and no declaration uses `sorry`).
- **The site's reading** reads each pull request within minutes of a push and takes it in when the checks and the
evidence its piece asks for are there.
- **The house's maintainer agent** (`pnp-maintainer`) comes about every two hours while people are working here, and
at least twice a day. It reruns what a pull request claims, reviews it with a first line "Review of ``: ready",
"changes needed", "needs a person" or "not finished", keeps the table above, and writes one line a round in the
"Maintainer log" issue, which its first round opens (before that there is no log: the agent has not finished a round here yet). A question with `@pnp-maintainer` in it, on an issue or in the problem's room in the channels (`/channels/ref/shoal/p-vs-np` on the site, the Discussion tab of this page), is answered within
minutes.
- **A person** decides what no written rule settles: a claimed proof of either target (below), a change to the
statement, two reviews that disagree.
## The statement
[`Problems/PVersusNP/Millennium.lean`](Problems/PVersusNP/Millennium.lean) (1,884 lines) follows Cook's description in
Mathlib's two-stack Turing-machine model (`TM2ComputableInPolyTime`): languages over strings of a finite alphabet with at
least two symbols (`ClayFiniteAlphabet`), `InPolynomialTime` (P), `InNondeterministicPolynomialTime` (NP: a
polynomial-time checking relation on `w#y` with certificates of length at most |w|^k over a finite alphabet),
`PolynomialTimeReducible`, `NondeterministicPolynomialTimeComplete`, Cook's verifier wording (`ClayVerifiableLanguage`,
proved equal to NP), and 61 theorems (private ones included) relating the formulations and building one verified
machine. Its two target propositions:
| Proposition | States |
|---|---|
| `Millennium.ClayPVersusNP` | P = NP over every finite alphabet with at least two symbols |
| `Millennium.ClayPVersusNP.Formulations.NegativeBranch` | P ≠ NP, literally `¬ ClayPVersusNP` |
23 of the file's theorems, P ⊆ NP among them, take `ClayPVersusNP.Support.PolynomialTimeComputableComposition` as a
hypothesis; Mathlib at this pin states the same fact as `proof_wanted TM2ComputableInPolyTime.comp`.
[`Tests/PVersusNP/Sanity.lean`](Tests/PVersusNP/Sanity.lean) (194 lines) checks that the definitions are not degenerate.
**These two files are fixed**: they are the problem and the test that it means something, and `challenge` fails a
commit that changes them. [`Problems/PVersusNP/PolynomialHierarchy.lean`](Problems/PVersusNP/PolynomialHierarchy.lean)
(186 lines: definitions and three unfolding lemmas) is not fixed. The Chinese guide is
[`Problems/PVersusNP/GUIDE.zh.md`](Problems/PVersusNP/GUIDE.zh.md); the English reader's guide is
[`Problems/PVersusNP/GUIDE.md`](Problems/PVersusNP/GUIDE.md). Cook's text:
(SHA-256 `018f3d473d16c35e807e8cdfbd0bed3ccf7a56452e3e10c6b1d84b56eaf2cf59`, as upstream's `scripts/clay_refs.py` records it;
the PDF is not copied here).
## A solution
A pull request that proves `Millennium.ClayPVersusNP` or `Millennium.ClayPVersusNP.Formulations.NegativeBranch` would
be a solution of the Clay problem. This project's checks cannot judge one: with no target theorem, `build` says only
that the library compiles without `sorry`. To judge it, a person who maintains the project first adds a Comparator
challenge that states the target beside the frozen statement. Any such claim goes to a person and is never merged as an
ordinary pull request; Clay's own rules then apply.
## Build and layout
```sh
lake exe cache get
lake build
```
At the import (2026-12-01) this took Mathlib from its cache and built the project's three files in under ten seconds
(1,213 jobs, no warnings).
- `Problems/PVersusNP/`: the statement (`Millennium.lean`, fixed), the polynomial hierarchy, and every result added
here, each in a file of its own. `Tests/PVersusNP/`: `Sanity.lean` (fixed) and the sanity tests added here.
- `routes/`: one folder per branch that claimed a piece: its notes, and a rerun's `RERUN.md`.
- `checks/`: the `challenge` and `build` checks; `docker/`: the Lean image `build` runs in; `KNOWN.md`: what is
established, what failed, what to mind; `UPSTREAM.md`: upstream's README at the pin.
## Before 2026-12-02
Until 2026-12-02 this project was a board of exact computations: the fewest gates that compute small Boolean functions,
each circuit checked on every input and each lower bound by a SAT solver's proof (its `circuit` check). What people
merged then stays on main under `routes/`: little-fish's checked size(MOD3_4^2) = 6 (pull request #15) is there. The
board's pages and its Known page of 2026-12-01 are in main's history; its open question, a lower bound above 2.5n for
MOD3, is piece R-2.
The Lean statement is Robert Joseph George's and lean-dojo's (cite it with [`CITATION.cff`](CITATION.cff)): thank you.