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

| issue | 32 |
|---|---|
| status | done |
Timed programs on finite-alphabet words
Machines/WordStacks.lean supplies reusable machine entry points and timed witnesses. For input length n, gatherRun reverses a source onto the destination in at most n+1 transitions. copyThrough uses an initially empty scratch stack, restores the source, and prepends an order-preserving copy above an arbitrary destination suffix in at most 2*n+2. compareWords drains both words and pushes the accumulated agreement bit in at most max(m,n)+1, including unequal lengths. The finite alphabet can be empty.
Machines/ExtraStacks.lean translates an arbitrary FinTM2 into a machine with stack index K ⊕ E for any finite index type E. The host starts with arbitrary contents in the additional stacks. liftRun preserves the actual transition count as well as its upper bound; the stack values on the extra indices are the initial values at every matched configuration, including a halted endpoint.
The existing palindrome module uses the extracted program while preserving its theorem and its 3*n+3 bound. Regression witnesses cover a nonempty destination, an initialized host stack, and rejection when a matched prefix is shorter than the other word. The implementation uses the project's merged palindrome proof and one-step helper. The embedding is written directly for disjoint-sum stacks.
Next
A client needing word operations can enter at the gather, distribute, restore, or compare labels. To run the same program with additional preserved storage, apply ExtraStacks.liftRun. The dated test and build record is in RERUN.md.