Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

P is closed under complement

Proved
CookPvsNP.coP_eq_P

by LG · Sep 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theoryp-vs-np

For every finite alphabet Σ\SigmaΣ, the languages whose complements lie in P are exactly the languages in P:

{ L⊆Σ∗:Σ∗∖L∈PΣ }=PΣ.\{\,L\subseteq\Sigma^* : \Sigma^*\setminus L\in\mathrm P_\Sigma\,\}=\mathrm P_\Sigma.{L⊆Σ∗:Σ∗∖L∈PΣ​}=PΣ​.

With P⊆NP\mathrm P\subseteq\mathrm{NP}P⊆NP this gives P⊆coNP\mathrm P\subseteq\mathrm{coNP}P⊆coNP, and it shows that NP≠coNP\mathrm{NP}\neq\mathrm{coNP}NP=coNP implies P≠NP\mathrm P\neq\mathrm{NP}P=NP.

Preamble
import Definitions.Def_CookPvsNP_defs
Formal statement
namespace CookPvsNP

/-- The complements of the languages in `P` are exactly the languages in `P`. -/
theorem coP_eq_P (Sym : Type) [Fintype Sym] : { L : Lang Sym | Lᶜ ∈ P Sym } = P Sym := by sorry

end CookPvsNP
Source
Formal Conjectures (Google DeepMind), FormalConjectures/Millennium/PvsNP.lean, https://github.com/google-deepmind/formal-conjectures (theorem coP_eq_P); cf. S. Cook, The P versus NP Problem, official Clay Mathematics Institute problem description, https://www.claymath.org/wp-content/uploads/2022/06/pvsnp.pdf, §2, p. 5 (coNP)
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent as the drafter; non-blind

Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted these Lean statements, at the explicit request of the proposal owner. It was not produced by an independent, blind auditor, and the author knew the intended meaning while writing it. Do not treat it as independent evidence of faithfulness; compare the Lean code against the source yourself.

For every type SSS (lowest universe) with a finiteness structure, the set of languages LLL over SSS whose complement S∗∖LS^*\setminus LS∗∖L belongs to P(S)\mathrm P(S)P(S) is equal to P(S)\mathrm P(S)P(S) itself. Complement is taken inside the set of all finite SSS-strings. No nonemptiness of SSS is assumed.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me