{"ok":true,"data":{"commit":"68ee862ecf840b5859cdbb47a9a45c1bbaebcb39","path":"PvsNP/Open.lean","oid":"910e440792c36b34d5ee343f503b442ad9412605","size":2017,"range_start":0,"range_end":2017,"truncated":false,"binary":false,"encoding":"utf8","content":"import PvsNP.Complexity.Completeness\n\n/-!\n# The P versus NP problem — OPEN\n\nThis file **states** the P versus NP problem. It does not solve it, and nothing in this repository\nclaims to. `PNeNP` is a definition (a `Prop`), not a theorem; no axiom here assumes it or its\nnegation. `#print axioms` on any theorem of the project lists at most Lean's standard axioms\n(`propext`, `Classical.choice`, `Quot.sound`).\n\nThe problem is posed over the binary alphabet `Bool`, as usual. Over any finite alphabet with at least\ntwo symbols the answer is the same, but that equivalence is not proved here.\n\nWhat *is* proved below: P = NP is the same as \"P and NP have the same languages\" (one inclusion is\nP ⊆ NP), and for any NP-complete language `L`, P ≠ NP is the same as `L ∉ P`.\n-/\n\nnamespace PvsNP\n\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/-- P = NP says exactly that P and NP contain the same languages. -/\ntheorem pEqNP_iff : PEqNP ↔ ∀ L : Language Bool, InP L ↔ InNP L :=\n  ⟨fun h L => ⟨InP.inNP, h L⟩, fun h L hL => (h L).mpr hL⟩\n\n/-- P ≠ NP exactly when some NP language is not in P. -/\ntheorem pNeNP_iff : PNeNP ↔ ∃ L : Language Bool, InNP L ∧ ¬ InP L := by\n  unfold PNeNP PEqNP\n  constructor\n  · intro h\n    apply Classical.byContradiction\n    intro hne\n    exact h fun L hL => Classical.byContradiction fun hP => hne ⟨L, hL, hP⟩\n  · intro ⟨L, hL, hP⟩ h\n    exact hP (h L hL)\n\n/-- For an NP-complete `L`: `L ∈ P` exactly when P = NP. -/\ntheorem NPComplete.inP_iff_pEqNP {L : Language Bool} (hL : NPComplete L) : InP L ↔ PEqNP :=\n  hL.inP_iff\n\n/-- For an NP-complete `L`: P ≠ NP exactly when `L ∉ P`. -/\ntheorem NPComplete.pNeNP_iff {L : Language Bool} (hL : NPComplete L) : PNeNP ↔ ¬ InP L :=\n  not_congr hL.inP_iff_pEqNP.symm\n\nend PvsNP\n"},"meta":{"request_id":"08f64e33-851","took_us":121,"limits":{"limit":600,"remaining":41,"window_ms":60000,"reset_ms":55885,"cost":1,"streams":{"limit":16,"open":0}}}}