# PvsNP/Open.lean @ 68ee862ecf840b5859cdbb47a9a45c1bbaebcb39

````
import PvsNP.Complexity.Completeness

/-!
# The P versus NP problem — OPEN

This file **states** the P versus NP problem. It does not solve it, and nothing in this repository
claims to. `PNeNP` is a definition (a `Prop`), not a theorem; no axiom here assumes it or its
negation. `#print axioms` on any theorem of the project lists at most Lean's standard axioms
(`propext`, `Classical.choice`, `Quot.sound`).

The problem is posed over the binary alphabet `Bool`, as usual. Over any finite alphabet with at least
two symbols the answer is the same, but that equivalence is not proved here.

What *is* proved below: P = NP is the same as "P and NP have the same languages" (one inclusion is
P ⊆ NP), and for any NP-complete language `L`, P ≠ NP is the same as `L ∉ P`.
-/

namespace PvsNP

/-- **P = NP**, over the binary alphabet: every language in NP is in P. -/
def PEqNP : Prop := ∀ L : Language Bool, InNP L → InP L

/-- **P ≠ NP — an open problem.** Stated, not proved. One of the Clay Millennium Prize Problems. -/
def PNeNP : Prop := ¬ PEqNP

/-- P = NP says exactly that P and NP contain the same languages. -/
theorem pEqNP_iff : PEqNP ↔ ∀ L : Language Bool, InP L ↔ InNP L :=
  ⟨fun h L => ⟨InP.inNP, h L⟩, fun h L hL => (h L).mpr hL⟩

/-- P ≠ NP exactly when some NP language is not in P. -/
theorem pNeNP_iff : PNeNP ↔ ∃ L : Language Bool, InNP L ∧ ¬ InP L := by
  unfold PNeNP PEqNP
  constructor
  · intro h
    apply Classical.byContradiction
    intro hne
    exact h fun L hL => Classical.byContradiction fun hP => hne ⟨L, hL, hP⟩
  · intro ⟨L, hL, hP⟩ h
    exact hP (h L hL)

/-- For an NP-complete `L`: `L ∈ P` exactly when P = NP. -/
theorem NPComplete.inP_iff_pEqNP {L : Language Bool} (hL : NPComplete L) : InP L ↔ PEqNP :=
  hL.inP_iff

/-- For an NP-complete `L`: P ≠ NP exactly when `L ∉ P`. -/
theorem NPComplete.pNeNP_iff {L : Language Bool} (hL : NPComplete L) : PNeNP ↔ ¬ InP L :=
  not_congr hL.inP_iff_pEqNP.symm

end PvsNP

````

API: `https://git.neoopensource.com/v1/repos/pvsnp/blob?rev=68ee862ecf840b5859cdbb47a9a45c1bbaebcb39&path=PvsNP%2FOpen.lean`
