P vs NP: the Lean theory around Cook's Clay statement
Cook's Clay statement of P vs NP in Lean, fixed: prove the results around it, rerun what others claim, and read it against Cook's text

AGENTS.md
Read README.md first, then KNOWN.md. P vs NP is open, and this project does not claim to move it.
main holds Cook's Clay statement in Lean and the results proved about it; what we want is more of those results,
proved in this model with no sorry, and a statement a reader can follow. Never describe a change here as progress on
P vs NP itself: the statement is fixed, and a result about it is not a step towards either answer.
First session
In your clone of this project, with Python 3 and no Lean:
python3 checks/challenge.py . # last line: ok: 2 challenge files and the build configuration as approved; …
git fetch origin issues && git show origin/issues:BOARD.md # the pieces, and who works on what
sed -n 77,100p Problems/PVersusNP/Millennium.lean # languages and P (InPolynomialTime)
sed -n 269,340p Problems/PVersusNP/Millennium.lean # NP, ≤ₚ, the composition hypothesis, NP-complete
Then pick one piece nobody holds. Each issue says what to do, what it needs (reading only, compiling one file, or a full build on a large machine), when it closes and what it does not show. By what you have:
- No Lean, reading only: V-11 or V-13 (the statement against Cook's text, a few rows each), V-8 (the SAT of the claimed Cook–Levin), V-17 (two false "P = NP" repositories), P-1 (a reader's guide), L-1 (one row of the table).
- A laptop with elan (the project compiles in seconds once Mathlib's cache is there): V-6 (rebuild, and record it), then S-9 (parity is in P: a first machine of your own), P-2, S-2.
- A large machine, or days: V-7 (rerun Tan's 11,600 lines), S-1 and S-5 (bring them in), S-13 to S-20.
Reruns and readings
A rerun of anything (this project, a claim made elsewhere) is a dated record in routes/<your-branch>/RERUN.md, one
section per run, never replaced: a later run is a new section. The one template:
## 2026-12-02: <what was rerun>, by <who> (<which agent, if one ran it>)
- Machine: <CPU model, cores, RAM, OS>; <your own machine, or the site's job number>
- Image: <the image tag and id, or `lean --version` and the Mathlib commit>
- Commit: <repository URL and the full commit that was rerun>
- Command: <each command as typed, with its exit code and wall time>
- What it printed: <the lines that carry the verdict, copied, not paraphrased>
- What was not checked: <every part of the claim this run does not cover; "none" is almost never true>
A reading (a statement against Cook's text, a claim's SAT, a paper) is a note in the path its piece names, each verdict with the page and line it rests on. Both close when a second party (someone else's agent, or the house's maintainer agent) has checked them and said so in a review. A rerun says what ran; it never says a claim is true beyond what ran.
Claim an issue
Work on a branch of your own, and say what you take in its notes:
git switch -c my-change origin/main
mkdir -p routes/my-change
cat > routes/my-change/README.md <<'EOF'
---
issue: 3
status: working
---
# my-change
Which files, and what I prove or change in them.
## Next
The first concrete step.
EOF
A push keeps the claim alive. If you stop, leave ## Next so whoever continues knows where you stopped. Your change
itself is in the Lean files; the notes say what it is.
Changes we want
- A result about the statement's definitions, proved in a new file under
Problems/PVersusNP/that importsProblems.PVersusNP.Millennium: P ⊆ NP without hypotheses, closure of P and NP under complement, union and intersection, facts about reductions and NP-completeness, the polynomial hierarchy, and in time Cook–Levin. - A proof of
ClayPVersusNP.Support.PolynomialTimeComputableComposition, or of another hypothesis the statement's theorems take, followed by unconditional versions of the theorems that took it, in a new file. - Explicit two-stack machines with their time bounds, written once as reusable lemmas, as
Sanity.lean'sconstFalseDeciderand the statement'sleft_projection_machineare. - Improving
PolynomialHierarchy.lean: docstrings that say what is defined, and lemmas about its levels. - Moving a general fact about Mathlib's Turing machines (not about P vs NP) to a file that could go to Mathlib, and offering it there.
- A sanity test in a new file under
Tests/PVersusNP/that shows a definition is not degenerate.
Changes we don't want
- Any change to
Problems/PVersusNP/Millennium.leanorTests/PVersusNP/Sanity.lean, even a docstring or a typo: they are the problem, andchallengefails a commit that changes them. Make a reader's aid a separate file. If you think the statement is wrong, open an issue titled "Ruling: …" and say why. - A proof of
Millennium.ClayPVersusNPorNegativeBranchas an ordinary pull request. Say it in an issue with the whole argument; a person decides how it is judged (README, "A solution"). - New definitions of P or NP that compete with the statement's. A different model goes in a file of its own, with a theorem relating it to the statement's.
- A result that takes a new unproved hypothesis without saying so in its name or docstring.
sorry,admit,axiom,native_decide,implemented_byorexternanywhere:challengefails them.- Any change to
checks/,docker/, or tolakefile.tomlbeyond arequire'srev,leanOptions,defaultTargets,lean_exeor[cache]; a dependency outside leanprover and leanprover-community, alakefile.lean, or files under.lake/.
Pull requests
Keep each pull request to one result or one change. Compile it if you can (lake exe cache get, then lake build);
if you cannot, push and let the build check say. Either way, open the pull request, and don't write in it that it
builds: build says that. Titles follow
Mathlib's convention. In the description, name the
issue it answers (Closes #3), state the main theorem in one line, and name every hypothesis it takes. Keep the title
and description in step with the diff when you push more commits.
If you want to make the same kind of change in many places, open one pull request first and wait for the maintainer to say we want it before you open the others.
CI
Two checks run on every push, and both gate the merge. Their code is checks/ at the approved version, so editing it
on your branch changes nothing about your verdict. They differ from a project with a proved theorem: P vs NP is open,
so there is no theorem to check and no Comparator run.
challenge, seconds: the statement (Millennium.lean) and its sanity tests (Sanity.lean) are as approved, the build configuration is too, and the source has nosorry,admit,axiom,native_decide,implemented_byorextern. Run it yourself:python3 checks/challenge.py .build, minutes: in the project's Lean image with no network,lake buildofProblemsandTestsends without error, and no module reports a declaration that usessorry. Its last line isok: lake build passes with no sorry, or what failed. If you can build, the same before you push:lake exe cache get && lake build; if you cannot, push and letbuildsay.
A toolchain or Mathlib bump passes challenge, but build needs a new image first (docker/README.md): open an issue
for a person who maintains the project rather than a pull request that cannot pass.
For the maintainer
The house's maintainer agent (pnp-maintainer) comes about every two hours while people work here, at least twice a
day, and within minutes when written to. It reviews (first line **Review of `<commit>`: <verdict>**), does not
merge, logs each round on the issue "Maintainer log", and opens Ruling: … issues (needs-person) for what only a
person decides. Here, as an open problem:
- Claims rerun (skill
verify-claim): what a pull request claims is rebuilt in the project's Lean image with the approved checks,#print axiomsof each new theorem is read, and the result is a datedRERUN.mdon a route of the agent's own, in the template above. - The ledger of claims (skill
ledger) in "Where it stands": each claim about P vs NP made here or elsewhere, with one of the README's four statuses and who reproduced it. A claim of P = NP or P ≠ NP stays "written argument, unread" and goes to a person. - Sources watched:
lean-dojo/LeanMillenniumPrizeProblems(the upstream) and new arXiv preprints in cs.CC that state a result about the fixed statement; one this workspace can rerun becomes a "Reproduce …" issue.
P vs NP is open. Judge every pull request against the two lists above: is it a sound result about the fixed statement, stated honestly and readable.
- Merge a change we want once
challengeandbuildhave passed on its head, the description states the main theorem and every hypothesis it takes, and the code says the same. - Request changes when the description and the diff disagree, when it is two changes in one, when it is on the second list (say which item), or when a hypothesis is hidden.
- Request changes when
challengeorbuildfailed: quote the check's last line. - Escalate, never merge, a pull request or issue that claims to prove
Millennium.ClayPVersusNPorMillennium.ClayPVersusNP.Formulations.NegativeBranch, or P = NP or P ≠ NP in any form: the checks cannot judge it, and a person adds a Comparator challenge first. Escalate also a change to the statement files, tochecks/ordocker/, tolakefile.toml's libraries or dependencies, a "Ruling:" issue, or two reviews that disagree: say in one sentence what a person must decide. - Close a repeat of a change already merged or open, pointing to it, and a mass change opened before the first of its kind was wanted.
Never merge on the author's word that it builds: only build on its head says so. Never describe a merged result as
progress on P vs NP. After a merge, add to KNOWN.md the theorem proved and the hypotheses it takes.