PEqNP and PNeNP are definitions over the binary alphabet, not theorems, and no axiom assumes either. Proved around them: P = NP iff P and NP have the same languages, P ≠ NP iff some NP language is outside P, and for an NP-complete L, P ≠ NP iff L ∉ P. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diff
2 files changed +50 -0
| @@ -0,0 +1,49 @@ | ||
| 1 | +import PvsNP.Complexity.Completeness | |
| 2 | + | |
| 3 | +/-! | |
| 4 | +# The P versus NP problem — OPEN | |
| 5 | + | |
| 6 | +This file **states** the P versus NP problem. It does not solve it, and nothing in this repository | |
| 7 | +claims to. `PNeNP` is a definition (a `Prop`), not a theorem; no axiom here assumes it or its | |
| 8 | +negation. `#print axioms` on any theorem of the project lists at most Lean's standard axioms | |
| 9 | +(`propext`, `Classical.choice`, `Quot.sound`). | |
| 10 | + | |
| 11 | +The problem is posed over the binary alphabet `Bool`, as usual. Over any finite alphabet with at least | |
| 12 | +two symbols the answer is the same, but that equivalence is not proved here. | |
| 13 | + | |
| 14 | +What *is* proved below: P = NP is the same as "P and NP have the same languages" (one inclusion is | |
| 15 | +P ⊆ NP), and for any NP-complete language `L`, P ≠ NP is the same as `L ∉ P`. | |
| 16 | +-/ | |
| 17 | + | |
| 18 | +namespace PvsNP | |
| 19 | + | |
| 20 | +/-- **P = NP**, over the binary alphabet: every language in NP is in P. -/ | |
| 21 | +def PEqNP : Prop := ∀ L : Language Bool, InNP L → InP L | |
| 22 | + | |
| 23 | +/-- **P ≠ NP — an open problem.** Stated, not proved. One of the Clay Millennium Prize Problems. -/ | |
| 24 | +def PNeNP : Prop := ¬ PEqNP | |
| 25 | + | |
| 26 | +/-- P = NP says exactly that P and NP contain the same languages. -/ | |
| 27 | +theorem pEqNP_iff : PEqNP ↔ ∀ L : Language Bool, InP L ↔ InNP L := | |
| 28 | + ⟨fun h L => ⟨InP.inNP, h L⟩, fun h L hL => (h L).mpr hL⟩ | |
| 29 | + | |
| 30 | +/-- P ≠ NP exactly when some NP language is not in P. -/ | |
| 31 | +theorem pNeNP_iff : PNeNP ↔ ∃ L : Language Bool, InNP L ∧ ¬ InP L := by | |
| 32 | + unfold PNeNP PEqNP | |
| 33 | + constructor | |
| 34 | + · intro h | |
| 35 | + apply Classical.byContradiction | |
| 36 | + intro hne | |
| 37 | + exact h fun L hL => Classical.byContradiction fun hP => hne ⟨L, hL, hP⟩ | |
| 38 | + · intro ⟨L, hL, hP⟩ h | |
| 39 | + exact hP (h L hL) | |
| 40 | + | |
| 41 | +/-- For an NP-complete `L`: `L ∈ P` exactly when P = NP. -/ | |
| 42 | +theorem NPComplete.inP_iff_pEqNP {L : Language Bool} (hL : NPComplete L) : InP L ↔ PEqNP := | |
| 43 | + hL.inP_iff | |
| 44 | + | |
| 45 | +/-- For an NP-complete `L`: P ≠ NP exactly when `L ∉ P`. -/ | |
| 46 | +theorem NPComplete.pNeNP_iff {L : Language Bool} (hL : NPComplete L) : PNeNP ↔ ¬ InP L := | |
| 47 | + not_congr hL.inP_iff_pEqNP.symm | |
| 48 | + | |
| 49 | +end PvsNP | |