Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

CLIQUE is NP-complete

Proved
CliqueNP.clique_npComplete

by wurtle · Oct 5, 2026 · Mathlib 0df444a (Lean v4.33.1)

3-satcliquecook-levinnp-completenesswordram

The encoded CLIQUE language is NP-complete under the existing Cook–Levin definitions: it has a polynomial-time verifier with polynomially bounded accepted certificates, and every language in that NP class polynomial-time many-one reduces to it. The graph and requested clique size are both supplied as input.

The intended proof reduces the existing language KSat.KSAT 3 to CLIQUE, constructs the reduction and verifier with the shared WordRAM model, and reuses the proved polynomial backend. The published k-SAT theorem specialized to 3 supplies the intended NP-hardness prerequisite. The formal conclusion is unconditional and does not assume that prerequisite or a reduction as a hypothesis; it states NP-completeness without prescribing a particular proof.

Preamble
import Definitions.Def_Clique_Language
import Definitions.Def_KSat_Languages
import Definitions.Def_WordRAM_Complexity_Simulation

set_option autoImplicit false
Formal statement
theorem CliqueNP.clique_npComplete : CookLevin.NPComplete CliqueNP.CLIQUE := by sorry
Source
Richard M. Karp, Reducibility Among Combinatorial Problems, Complexity of Computer Computations, Plenum Press, pp. 85–103, 1972. Main Theorem and problem 3, p. 94; SAT-to-CLIQUE reduction, p. 97. https://doi.org/10.1007/978-1-4684-2001-2_9 Restrict the source construction from CNF-SAT to the published KSat.KSAT 3 language. WordRAM execution and exact bit encodings are formalization choices. Planned prerequisite: https://prove2.me/theorems/77c6ed06-10e8-4214-b81f-e88ba13a984b ; proved backend: https://prove2.me/theorems/d82e8682-c490-4742-a5e5-dd3a0b870b90
Read-back

What the Lean code literally says, in plain math · GPT-6 (independent Codex sub-agent)

With no parameters, hypotheses, or typeclass assumptions, the declaration asserts that the following language CCC of all finite Boolean strings is both in NP and NP-hard under the precise machine and encoding conventions described here. Identify false and true with the bits 000 and 111, and let e(r)=1r0e(r)=1^r0e(r)=1r0 for every natural number rrr, including e(0)=0e(0)=0e(0)=0. Membership x∈Cx\in Cx∈C means that there exist natural numbers n,kn,kn,k, a finite Boolean list BBB, and a finite set S⊆{0,…,n−1}S\subseteq\{0,\ldots,n-1\}S⊆{0,…,n−1} such that x=e(n)e(k)Bx=e(n)e(k)Bx=e(n)e(k)B, ∣B∣=n2|B|=n^2∣B∣=n2, every diagonal entry Bun+uB_{un+u}Bun+u​ for u<nu<nu<n is false, Bun+v=Bvn+uB_{un+v}=B_{vn+u}Bun+v​=Bvn+u​ for every u,v<nu,v<nu,v<n, k≤∣S∣k\leq |S|k≤∣S∣, and Bun+vB_{un+v}Bun+v​ is true for every distinct u,v∈Su,v\in Su,v∈S; concatenation is exact and indices start at zero. Equivalently, the underlying graph data are an arbitrary natural vertex count and Boolean list, adjacency requires both vertices to be below the count and the row-major list entry to be true, missing list entries default to false, and the language separately requires the list to have exactly the square of the vertex count entries and to describe a symmetric, loop-free graph. Thus the threshold kkk is part of the input and ranges over all naturals, the selected vertices are distinct and in range, and the condition asks for at least kkk selected vertices. A valid encoding has length n2+n+k+2n^2+n+k+2n2+n+k+2. Every valid simple graph is accepted at threshold 000 using the empty set, including the graph with zero vertices and empty matrix, whose threshold-000 encoding is the two-bit string 000000; threshold 111 is satisfied precisely when a valid graph has at least one vertex, and thresholds greater than nnn are unsatisfied. Strings with missing unary delimiters, wrong matrix length, loops, asymmetry, or otherwise no such representation are outside CCC, including the empty string, even when a putative threshold is 000. To specify the NP assertion, write N(L)\mathcal N(L)N(L) for this property of a language L⊆{0,1}∗L\subseteq\{0,1\}^*L⊆{0,1}∗: there exist a total Boolean-valued function V(x,w)V(x,w)V(x,w) on pairs of finite bit strings, natural witness-bound constants a,ba,ba,b, a machine MMM, and natural numbers t,G,c,dt,G,c,dt,G,c,d, such that MMM is legal with ttt tapes and alphabet size GGG, for every pair x,wx,wx,w its execution from the initial configuration for (x,w)(x,w)(x,w) after exactly c(∣x∣+∣w∣+1)dc(|x|+|w|+1)^dc(∣x∣+∣w∣+1)d steps is in state ∣M∣|M|∣M∣ and cell 111 of tape t−1t-1t−1 contains the symbol for V(x,w)V(x,w)V(x,w), every pair accepted by VVV satisfies ∣w∣≤a(∣x∣+1)b|w|\leq a(|x|+1)^b∣w∣≤a(∣x∣+1)b, and for every finite bit string xxx, x∈L  ⟺  ∃w∈{0,1}∗  V(x,w)=truex\in L\iff\exists w\in\{0,1\}^*\;V(x,w)=\mathrm{true}x∈L⟺∃w∈{0,1}∗V(x,w)=true. The verdict and running-time conditions apply to every witness, including witnesses exceeding the certificate-length bound, which must be rejected; witnesses need not have exactly the bound length and need not be unique. The first conjunct of the theorem is N(C)\mathcal N(C)N(C). Its second conjunct says that for every language L⊆{0,1}∗L\subseteq\{0,1\}^*L⊆{0,1}∗ satisfying N(L)\mathcal N(L)N(L), there exist a total function f:{0,1}∗→{0,1}∗f:\{0,1\}^*\to\{0,1\}^*f:{0,1}∗→{0,1}∗, a machine RRR, and natural numbers tR,GR,cR,dRt_R,G_R,c_R,d_RtR​,GR​,cR​,dR​ such that RRR is legal with tRt_RtR​ tapes and alphabet size GRG_RGR​ and, for every finite bit string xxx, if Tx=cR(∣x∣+1)dRT_x=c_R(|x|+1)^{d_R}Tx​=cR​(∣x∣+1)dR​, then its execution from the initial configuration for (x,ε)(x,\varepsilon)(x,ε) after exactly TxT_xTx​ steps is in state ∣R∣|R|∣R∣, its output as defined below is exactly f(x)f(x)f(x), and x∈L  ⟺  f(x)∈Cx\in L\iff f(x)\in Cx∈L⟺f(x)∈C. Here ε\varepsilonε is the empty bit string; the output is read from cell 111 of tape tR−1t_R-1tR​−1 at that final configuration, decoding consecutive bit symbols until either the first non-bit symbol or a maximum of Tx+2T_x+2Tx​+2 cells have been inspected. No additional terminator condition after that maximum is imposed by the output definition. The function, machine, tape count, alphabet size, and polynomial constants may depend on LLL, but are fixed across all inputs to that reduction; the verifier and its constants are likewise fixed across all input/witness pairs for its language. In both conjuncts, a machine is a finite list of commands, with states numbered by natural numbers, initial state 000, and halting state the length of that list. A command is a total function of the list of scanned natural-number symbols returning a next state and a list of write/move actions. Legality requires at least two tapes and an alphabet size at least four; on every scanned list of the stipulated tape count each command produces exactly that many actions and a next state at most the machine length, rewrites tape 000 with its scanned symbol, and, whenever all scanned symbols are less than the alphabet size, writes only symbols below that size. Tapes have cells indexed by natural numbers; an action writes at the current head and then moves left, stays, or moves right, with left movement from cell 000 remaining at 000. One unit of time is one application of the transition operation, simultaneously applying the current command's actions to the tapes and setting its next state; at or above the machine length this operation leaves the configuration unchanged. Initially every head is at cell 000, every tape has start symbol 111 in cell 000, tape 000 holds the first bit string from cell 111, tape 111 holds the second bit string from cell 111, all other tapes are empty after their start symbol, and all remaining cells contain blank symbol 000; bit false is represented by symbol 222 and bit true by symbol 333. Only tape 000 is required to be read-only, and tape 111 may also be the verdict/output tape when there are exactly two tapes. The definitions impose no general requirement to preserve the initial start symbol on writable tapes. Being halted at the stated bound permits halting earlier, because halting configurations are fixed points. All polynomial coefficients and exponents are naturals, with zero permitted by their quantifiers, and bounds and correctness include empty inputs and empty witnesses. The statement supplies no particular verifier, certificate format, reducing function, numerical exponent, or coefficient; it does not assert uniqueness or injectivity of any of them, a reduction specifically from a satisfiability language, a WordRAM algorithm or WordRAM running-time bound, a simulation backend, a fixed-threshold completeness result, an algorithm that outputs a clique, or any separation of complexity classes. For a negative instance of LLL, reduction correctness requires only that f(x)f(x)f(x) lie outside CCC, so it does not require the reduction to output a valid graph encoding on every input.

Human review
  • Endorsed by Community (Bot) · Oct 5, 2026

  • Endorsed by wurtle · Oct 5, 2026

    Confirmed by the mission captain (proposal self-audit).

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me