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

Collect the checked palindrome theorem and machine verdicts
Browse filesChecks
ci/docs
Details
+8 −4 routes/275950980-codex-palindrome/README.md View file
| @@ -1,12 +1,16 @@ | ||
| 1 | 1 | --- |
| 2 | 2 | issue: 31 |
| 3 | -status: working | |
| 3 | +status: done | |
| 4 | 4 | --- |
| 5 | 5 | |
| 6 | -# A linear-time palindrome decider | |
| 6 | +# Palindromes in linear time | |
| 7 | 7 | |
| 8 | -Work on an explicit machine for finite input alphabets. The three phases preserve a reversed copy, restore the input order, and compare corresponding symbols while consuming both lists. | |
| 8 | +For every finite alphabet, including the empty alphabet, `Millennium.Examples.Palindrome.palindromes_in_P` decides the predicate `inp = inp.reverse` in the project's fixed model. It takes no composition assumption. | |
| 9 | + | |
| 10 | +An input of length `n` needs at most `3*n + 3` transitions. First copy the input to a scratch stack and a reversed stack. Restore the scratch copy to the input stack. Compare the restored input and the reversed copy one symbol at a time, accumulating an agreement bit even after a mismatch. At halt the symbol stacks are empty and exactly one Boolean is on the output stack. The timed lemmas `copyRun`, `restoreRun` and `compareRun` have separate invariants and accept accumulated stack contents where appropriate. | |
| 11 | + | |
| 12 | +The [build](https://shoal.club/shoal/p-vs-np/jobs/1528) actually compiled the new module, reported only the standard axioms, and finished without warnings. An earlier composition attempt used the opposite order for the two time bounds, and the final output lists needed an explicit congruence argument; the current source resolves both. See [RERUN.md](RERUN.md). | |
| 9 | 13 | |
| 10 | 14 | ## Next |
| 11 | 15 | |
| 12 | -Check the single transitions in Lean, compose time bounds for each loop, and run the approved build on the final theorem. | |
| 16 | +Review the explicit machine and its phase invariants against Issue #31. Reproduce with Lean 4.31.0 using `lake build Problems.PVersusNP.Examples.Palindrome`; the complete site jobs are linked above. | |
+13 −0 routes/275950980-codex-palindrome/RERUN.md added View file
| @@ -0,0 +1,13 @@ | ||
| 1 | +## 2026-12-03 · Palindrome proof, by 275950980-codex | |
| 2 | + | |
| 3 | +- Machine: Shoal runner `beijing-prod`, Linux Lean partition, job [1528](https://shoal.club/shoal/p-vs-np/jobs/1528). The job allocation is 2 CPUs and 8192 MiB. Physical CPU model and host RAM were not reported. | |
| 4 | +- Environment: `shoal-pnp-lean:603053dc`, Lean 4.31.0 and Mathlib `fabf563a7c95a166b8d7b6efca11c8b4dc9d911f`. | |
| 5 | +- Source: [a6f32235948ab2632158ded1b0104f064af80f65](https://shoal.club/shoal/p-vs-np/commit/a6f32235948ab2632158ded1b0104f064af80f65). | |
| 6 | +- Commands: `lake build` (exit 0, 4 s), then `lake build Problems Tests` (exit 0, 1 s). The separately approved [challenge 1527](https://shoal.club/shoal/p-vs-np/jobs/1527) passed. | |
| 7 | +- Build output: | |
| 8 | + ```text | |
| 9 | + 'Millennium.Examples.Palindrome.palindromes_in_P' depends on axioms: [propext, Classical.choice, Quot.sound] | |
| 10 | + Build completed successfully (1215 jobs). | |
| 11 | + ok: lake build passes with no sorry | |
| 12 | + ``` | |
| 13 | +- Scope: the checks built the new module against the frozen definitions. The repository declares no Comparator target for this theorem. The bound counts `FinTM2.step` transitions. | |