{"repo":"pvsnp","rev":"989456136115376209fd6a56be8e8c3f89c3d9d4","commit":"989456136115376209fd6a56be8e8c3f89c3d9d4","path":"","entries":[{"name":"Audit","path":"Audit","kind":"dir","oid":"48824350e9666cdad3265a83f313ba73d42ce3d4","size":null,"mode":16384},{"name":"PvsNP","path":"PvsNP","kind":"dir","oid":"a4516d988373b9a4eaebf4c6e2c88c3472a05e52","size":null,"mode":16384},{"name":".gitignore","path":".gitignore","kind":"file","oid":"4080d07dfc31f2b8ff0a971431e329a34ae3674c","size":8,"mode":33188},{"name":"Audit.lean","path":"Audit.lean","kind":"file","oid":"9fb539ff7ed1a1d89d2f87956172db528affb4d3","size":20,"mode":33188},{"name":"lake-manifest.json","path":"lake-manifest.json","kind":"file","oid":"92f39fa50a4bda3fb3e05ab5ef82420edf229331","size":137,"mode":33188},{"name":"lakefile.toml","path":"lakefile.toml","kind":"file","oid":"2c50400581116a763c091441f0b0353906b5d6ed","size":211,"mode":33188},{"name":"lean-toolchain","path":"lean-toolchain","kind":"file","oid":"00f848359b1cdaf7c12cd6b7acc5b4364752e154","size":25,"mode":33188},{"name":"LICENSE","path":"LICENSE","kind":"file","oid":"d645695673349e3947e8e5ae42332d0ac3164cd7","size":11358,"mode":33188},{"name":"PvsNP.lean","path":"PvsNP.lean","kind":"file","oid":"a0fbc60f70440a197fe67386266f060ca36fd519","size":486,"mode":33188},{"name":"README.md","path":"README.md","kind":"file","oid":"168b14c901b5437df1b6f967ab4a0ad3970cbf8b","size":7525,"mode":33188},{"name":"ROADMAP.md","path":"ROADMAP.md","kind":"file","oid":"d04c1bee6626764ed879fb5375673831db1d62d8","size":3012,"mode":33188}],"truncated":false,"last_commit":{"oid":"989456136115376209fd6a56be8e8c3f89c3d9d4","tree":"ca8994abe1794dcd69238e28dcf7ef2dc0dc6964","parents":["118eb9c9aec819f90f93b9ba0ecefa9f0d2d3b6a"],"author":{"name":"Claude","email":"noreply@anthropic.com","time_ms":1795945510000},"committer":{"name":"Claude","email":"noreply@anthropic.com","time_ms":1795945510000},"subject":"Correct the stated reasons for finiteness and the scope of NP","message":"Correct the stated reasons for finiteness and the scope of NP\n\nReview findings: an infinite state set would not decide everything in\none step, as the docs claimed; it would let a machine read its input\ninto its state and then apply any predicate. Say that, and say why the\nalphabet must be finite too.\n\nNote that certificates use the input alphabet, so InNP is the usual NP\nfor two or more symbols but not over a one-symbol alphabet.\n\nCo-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\n"},"readme":{"path":"README.md","content":"# pvsnp — P versus NP in Lean 4\n\nA from-scratch formalization of the basic theory behind the **P versus NP** question, in Lean 4 with\nno dependencies beyond Lean core.\n\n> **Status: P ≠ NP is open, and this project does not solve it.** The statement is written down as a\n> definition (`PvsNP.PNeNP : Prop`). Nothing here proves it or its negation, and no axiom assumes\n> either. Every theorem below has a complete proof, and the build checks that none of them depends on\n> `sorry` or on any axiom beyond Lean's standard three.\n\n## What is here\n\nThe definitions, all in [`PvsNP/`](PvsNP):\n\n- **Languages** over an alphabet `α`: `Language α := List α → Prop`.\n- **A machine model**: deterministic multi-tape Turing machines (`Machine α k`, with `k + 1` tapes over\n  `Option α`) with a *finite* set of states, and their step-by-step runs.\n- **Time bounds**: `DecidesIn`, `ComputesIn` and `VerifiesIn` a time bound `T`, measured in the input\n  length; `PolyBounded T` means `T n ≤ c * (n + 1) ^ d`.\n- **P** (`InP`): decided in polynomial time.\n- **NP** (`InNP`): verified in polynomial time, with a certificate on a second tape.\n- **Polynomial-time reductions** (`L ≤ₚ L'`), **NP-hardness** and **NP-completeness**.\n- **The open problem**: `PEqNP` and `PNeNP`, over the binary alphabet.\n\nThe theorems, each with a full proof:\n\n| Result | Lean name | File |\n| --- | --- | --- |\n| P ⊆ NP | `InP.inNP` | [`Complexity/NP.lean`](PvsNP/Complexity/NP.lean) |\n| P is closed under complement | `InP.compl` | [`Complexity/P.lean`](PvsNP/Complexity/P.lean) |\n| Polynomial-time functions compose | `PolyTimeComputable.comp` | [`Complexity/Reduction.lean`](PvsNP/Complexity/Reduction.lean) |\n| Reductions are reflexive and compose | `Reduces.refl`, `Reduces.trans` | [`Complexity/Reduction.lean`](PvsNP/Complexity/Reduction.lean) |\n| P is closed under reductions | `InP.of_reduces` | [`Complexity/Reduction.lean`](PvsNP/Complexity/Reduction.lean) |\n| NP is closed under reductions | `InNP.of_reduces` | [`Complexity/NP.lean`](PvsNP/Complexity/NP.lean) |\n| An NP-hard language in P puts NP in P | `NPHard.all_inP` | [`Complexity/Completeness.lean`](PvsNP/Complexity/Completeness.lean) |\n| For NP-complete `L`: P ≠ NP ↔ `L ∉ P` | `NPComplete.pNeNP_iff` | [`Open.lean`](PvsNP/Open.lean) |\n| Running a machine on more tapes is a faithful simulation | `Machine.run_lift` | [`Machine/Lift.lean`](PvsNP/Machine/Lift.lean) |\n| Running two machines in sequence | `Machine.run_seq` | [`Machine/Compose.lean`](PvsNP/Machine/Compose.lean) |\n| A concrete one-step machine: first-symbol languages are in P | `Examples.firstSymbol_inP` | [`Examples/FirstSymbol.lean`](PvsNP/Examples/FirstSymbol.lean) |\n\nThe statement of the open problem, verbatim from [`PvsNP/Open.lean`](PvsNP/Open.lean):\n\n```lean\n/-- **P = NP**, over the binary alphabet: every language in NP is in P. -/\ndef PEqNP : Prop := ∀ L : Language Bool, InNP L → InP L\n\n/-- **P ≠ NP — an open problem.** Stated, not proved. One of the Clay Millennium Prize Problems. -/\ndef PNeNP : Prop := ¬ PEqNP\n```\n\n## Build\n\nYou need [elan](https://github.com/leanprover/elan), which installs the Lean version pinned in\n[`lean-toolchain`](lean-toolchain) (Lean `v4.36.0`) on first use.\n\n```sh\nlake build\n```\n\nThis builds the library and the axiom audit ([`Audit/Axioms.lean`](Audit/Axioms.lean)). The audit\npins the output of `#print axioms` for every headline theorem, so the build fails if any of them\ncomes to rely on `sorry` or on a new axiom. A clean build takes well under a minute.\n\n## Layout\n\n```text\nPvsNP.lean                  root module: imports everything\nPvsNP/\n  Basic/Finite.lean         IsFinite: a list enumerates the type (core Lean has no Fintype)\n  Basic/Poly.lean           polynomial bounds and their closure under +, *, composition\n  Language.lean             languages, complement\n  Machine/Tape.lean         tapes: Int-indexed cells, head, read / write / move\n  Machine/Defs.lean         multi-tape machines, configurations, step, run, halting\n  Machine/Lift.lean         running a machine on more tapes (simulation theorem)\n  Machine/Compose.lean      running one machine after another (composition theorem)\n  Complexity/Time.lean      deciding, computing and verifying within a time bound\n  Complexity/P.lean         the class P; closure under complement\n  Complexity/Reduction.lean polynomial-time functions and reductions\n  Complexity/NP.lean        the class NP; P ⊆ NP; closure under reductions\n  Complexity/Completeness.lean  NP-hardness and NP-completeness\n  Open.lean                 the P vs NP statement (open)\n  Examples/FirstSymbol.lean concrete machines: languages decided by the first symbol\nAudit/Axioms.lean           build-time axiom audit\n```\n\nHow the modules depend on each other:\n\n```mermaid\ngraph TD\n  Finite[Basic/Finite] --> Defs[Machine/Defs]\n  Tape[Machine/Tape] --> Defs\n  Defs --> Lift[Machine/Lift]\n  Defs --> Compose[Machine/Compose]\n  Language --> Time[Complexity/Time]\n  Lift --> Time\n  Compose --> Time\n  Poly[Basic/Poly] --> P[Complexity/P]\n  Time --> P\n  P --> Reduction[Complexity/Reduction]\n  Reduction --> NP[Complexity/NP]\n  NP --> Completeness[Complexity/Completeness]\n  Completeness --> Open\n```\n\n## Modelling choices\n\nThese are deliberate, and each is a place where a reader should check that the definitions mean what\nthey claim:\n\n- **Finite control, finite alphabet.** A machine's state type must be finite (`IsFinite`): otherwise\n  it could read its input into its state and then apply any predicate at all. P, NP and\n  polynomial-time functions also require a finite alphabet: over `Nat`, a machine reading a single\n  symbol could test membership in the halting set.\n- **Tape alphabet `Option α`.** Machines write input symbols or blanks, nothing else. For alphabets with\n  at least two symbols this costs only a polynomial slowdown, and it lets machines over the same\n  alphabet run one after another with no re-encoding.\n- **Clean outputs.** A machine computing `f` must halt with `f x` on tape `0`, every other tape blank and\n  every head at `0`, which is exactly how the next machine expects its input. This makes composition\n  a literal hand-over.\n- **Verifiers in the style of Sipser.** The verifier's time bound depends on `|x|` only, and\n  `x ∈ L ↔ ∃ w, V accepts (x, w)`. A verifier running `T |x|` steps can read at most `T |x|`\n  certificate symbols, so certificates are polynomially short in effect. Certificates use the input\n  alphabet, which is the usual NP for two or more symbols; over a one-symbol alphabet it is not.\n- **Output bound stated, not derived.** `PolyTimeComputable f` asks for `|f x|` to be polynomially\n  bounded. That follows from the time bound in any reasonable model; deriving it is on the roadmap.\n\n## Roadmap\n\nThe milestones, in order; details and acceptance criteria are in [`ROADMAP.md`](ROADMAP.md).\n\n1. **Done:** machines, P, NP, reductions, P ⊆ NP, closure properties, NP-completeness, the open statement.\n2. **Done:** examples: concrete machines for small languages, run in the kernel.\n3. Derive the output-length bound from the time bound.\n4. Short certificates suffice: verifiers only ever need certificates of length `≤ T |x|`.\n5. Boolean formulas, CNF and an encoding into `List Bool`.\n6. **SAT ∈ NP.**\n7. **Cook–Levin, stated**: SAT is NP-complete, as a `Prop`.\n8. Cook–Levin, proved.\n9. Alphabet independence: P and NP over `Bool` match P and NP over any finite alphabet with two symbols.\n\n## License\n\n[Apache License 2.0](LICENSE).\n"},"jit":null,"api":"/v1/repos/pvsnp/tree?rev=989456136115376209fd6a56be8e8c3f89c3d9d4","api_url":"https://git.neoopensource.com/v1/repos/pvsnp/tree?rev=989456136115376209fd6a56be8e8c3f89c3d9d4"}