# AGENTS.md Read [README.md](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: ```bash 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//RERUN.md`, one section per run, never replaced: a later run is a new section. The one template: ```markdown ## 2026-12-02: , by () - Machine: ; - Image: - Commit: - Command: - What it printed: - What was not checked: ``` 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: ```bash 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 imports `Problems.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`'s `constFalseDecider` and the statement's `left_projection_machine` are. - 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.lean` or `Tests/PVersusNP/Sanity.lean`, even a docstring or a typo: they are the problem, and `challenge` fails 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.ClayPVersusNP` or `NegativeBranch` as 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_by` or `extern` anywhere: `challenge` fails them. - Any change to `checks/`, `docker/`, or to `lakefile.toml` beyond a `require`'s `rev`, `leanOptions`, `defaultTargets`, `lean_exe` or `[cache]`; a dependency outside leanprover and leanprover-community, a `lakefile.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 Lean is not installed, don't install it for this: 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](https://leanprover-community.github.io/contribute/commit.html). 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 no `sorry`, `admit`, `axiom`, `native_decide`, `implemented_by` or `extern`. Run it yourself: `python3 checks/challenge.py .` - **`build`**, minutes: in the project's Lean image with no network, `lake build` of `Problems` and `Tests` ends without error, and no module reports a declaration that uses `sorry`. Its last line is `ok: 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 let `build` say. 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 ``: **``), 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 axioms` of each new theorem is read, and the result is a dated `RERUN.md` on 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 `challenge` and `build` have 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 `challenge` or `build` failed: quote the check's last line. - **Escalate**, never merge, a pull request or issue that claims to prove `Millennium.ClayPVersusNP` or `Millennium.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, to `checks/` or `docker/`, to `lakefile.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.