A graph G has a k-clique iff there exists a k-vertex subset all of
whose pairs are adjacent in G.
Instances For
The language CLIQUE = {⟨G, k⟩ | G has a k-clique} as a set of
graph/integer pairs.
Instances For
The polarity of a propositional literal: positive (x) or negative (¬x).
Instances For
A propositional literal: a variable index together with a polarity, so
that ⟨i, .pos⟩ represents x_i and ⟨i, .neg⟩ represents ¬x_i.
Instances For
Instances For
Two literals are contradictory when they refer to the same variable but
have opposite polarities (e.g. x_i and ¬x_i).
Instances For
Contradictoriness of literals is decidable, inherited from decidability of equality on variable indices and polarities.
The "contradictory" relation between literals is symmetric.
A 3-clause is a triple of literals, representing the disjunction
l₁ ∨ l₂ ∨ l₃ in a 3CNF formula.
Instances For
Project the j-th literal (for j : Fin 3) out of a 3-clause.
Instances For
A 3-clause is satisfied by an assignment σ iff at least one of its three
literals evaluates to true under σ.
Instances For
A 3CNF formula, represented as a list of 3-clauses (interpreted as their conjunction).
Instances For
A 3CNF formula φ is satisfiable iff there is an assignment σ under
which every clause of φ is satisfied.
Instances For
The graph produced by the standard 3SAT ≤_P CLIQUE reduction. Vertices
are pairs (i, j) with i a clause index and j ∈ Fin 3 a literal position;
two distinct vertices are adjacent iff they come from different clauses and
their literals are not contradictory. A clique of size |φ| then encodes a
satisfying assignment by picking, in each clause, a literal that is true.
Instances For
Two contradictory literals cannot both evaluate to true under any
single assignment.
Given a satisfying assignment σ for a clause c, choose (using
classical choice) one position j : Fin 3 whose literal evaluates to true.
Instances For
Specification of trueLitPos: the literal at the chosen position indeed
evaluates to true under σ.
Given a satisfying assignment σ for every clause of φ, build the
candidate clique in reductionGraph φ by selecting, for each clause i, the
vertex (i, j) where j is a position witnessing the clause's satisfaction.
Instances For
The candidate clique satisfyingClique φ σ hsat has exactly |φ|
vertices (one per clause), since the map i ↦ (i, _) is injective in i.
The candidate set satisfyingClique φ σ hsat is indeed a clique in
reductionGraph φ: any two of its vertices come from different clauses, and
their selected literals are both true under σ, hence not contradictory.
Forward direction of the 3SAT ≤_P CLIQUE reduction: if φ is
satisfiable, then reductionGraph φ contains a |φ|-clique.
Backward direction of the 3SAT ≤_P CLIQUE reduction: a |φ|-clique in
reductionGraph φ must hit every clause exactly once (since edges only join
different clauses) and pick a pairwise non-contradictory set of literals;
setting variables to make all chosen positive literals true yields a
satisfying assignment for φ.
Correctness of the 3SAT ≤_P CLIQUE reduction. A 3CNF formula φ is
satisfiable iff its reduction graph reductionGraph φ contains a clique of
size |φ|.
Tape alphabet used to encode either a 3SAT instance or a CLIQUE instance
on a single Turing-machine tape. The symbol sat φ represents an encoded
3CNF formula φ, and clique φ represents the encoded CLIQUE instance
⟨reductionGraph φ, |φ|⟩.
- sat (φ : ThreeSATToClique.ThreeCNF) : SATCliqueSymbol
- clique (φ : ThreeSATToClique.ThreeCNF) : SATCliqueSymbol
Instances For
Encoded 3SAT language: those single-symbol tape strings [.sat φ] whose
underlying formula φ is satisfiable.
Instances For
Encoded CLIQUE language (specialized to instances arising from the
reduction): the single-symbol strings [.clique φ] whose reduction graph
reductionGraph φ contains a |φ|-clique.
Instances For
On any input that is not of the form [.sat φ], the reduction function
threeSATToCliqueEnc returns the empty list.
Per-formula correctness of the encoded reduction:
[.sat φ] ∈ ThreeSATEnc ↔ threeSATToCliqueEnc [.sat φ] ∈ CLIQUEEnc,
obtained directly from reduction_correct.
Full correctness of the reduction function as a many-one reduction:
for every input string w, w ∈ ThreeSATEnc ↔ threeSATToCliqueEnc w ∈ CLIQUEEnc.
The reduction function threeSATToCliqueEnc is computable in polynomial
time; this is the time-complexity content of the 3SAT ≤_P CLIQUE reduction.
3SAT ≤_P CLIQUE. The encoded 3SAT language polynomially reduces to
the encoded CLIQUE language via threeSATToCliqueEnc.
Corollary (CLIQUE ∈ P → 3SAT ∈ P). Combining the polynomial-time
reduction 3SAT ≤_P CLIQUE with closure of P under polynomial-time
reductions: if the encoded CLIQUE language is in P, so is encoded 3SAT.