From 3CNF-SAT to binary constraint graphs #
The standard reduction turning a 3CNF formula into a constraint graph over the
alphabet Fin 3 → Bool, together with its correctness proof. This is the entry
point of Dinur's proof of the PCP theorem: it produces the constraint graph
whose unsatisfiability value the amplification step then boosts.
The construction #
Given φ : CNF, the graph toGraph φ has
- one variable vertex for each variable index
0 … φ.maxVar, and - one clause vertex for each clause of
φ, numbered(φ.maxVar + 1) + j; - one edge for each (clause, position) pair, so
3 * φ.lengthedges in all.
A variable vertex is meant to carry the value of its variable in bit 0 of its
label; a clause vertex is meant to carry the values of the three variables its
clause mentions, one per coordinate. The edge for clause j and position p
checks both that the clause vertex's triple satisfies clause j and that its
p-th coordinate agrees with the p-th variable vertex — the usual
consistency-plus-satisfaction pair of constraints.
Main definitions #
litOf— a total lookup of the literal at a given clause and positionnumVerts,numEdges,varVertex,clauseVertex,edgeClause,edgePosclauseSat— whether a triple of bits satisfies a clausetoGraph— the constraint graph produced by the reductionvertexLabel,mkAssign— the two translations between assignments
Main results #
numVerts_toGraph,numEdges_toGraph— the size of the produced graphsatisfiable_toGraph_iff— correctness of the reduction on 3CNF inputs
Indexing helpers #
The literal at position p of clause j of φ, defaulting to the positive
literal on variable 0 when either index is out of range. Totality keeps the
reduction free of dependent-index bookkeeping.
Equations
Instances For
The number of vertices of the constraint graph of φ: one per variable
index 0 … φ.maxVar, then one per clause.
Equations
- Complexity.ThreeSATCSP.numVerts φ = φ.maxVar + 1 + List.length φ
Instances For
The number of edges of the constraint graph of φ: three per clause.
Equations
Instances For
The constraint graph of φ always has at least one vertex, namely the
variable vertex 0.
The vertex carrying the value of variable v; out-of-range indices are
folded onto vertex 0.
Equations
- Complexity.ThreeSATCSP.varVertex φ v = if h : v < Complexity.ThreeSATCSP.numVerts φ then ⟨v, h⟩ else ⟨0, ⋯⟩
Instances For
The vertex carrying the claimed values of the variables of clause j;
out-of-range indices are folded onto vertex 0.
Equations
Instances For
The clause that edge number e belongs to.
Equations
Instances For
The position inside its clause that edge number e checks.
Equations
- Complexity.ThreeSATCSP.edgePos e = ⟨e % 3, ⋯⟩
Instances For
Whether the triple cl of claimed variable values satisfies clause j:
some position's claimed value matches that literal's sign.
Equations
- Complexity.ThreeSATCSP.clauseSat φ j cl = decide (∃ (q : Fin 3), cl q = (Complexity.ThreeSATCSP.litOf φ j q).sign)
Instances For
The reduction #
The constraint graph of a 3CNF formula φ. Variable vertices come first,
clause vertices after them; edge e links clause vertex edgeClause e to the
variable vertex of the literal at position edgePos e of that clause, and its
constraint demands both that the clause vertex's triple satisfies the clause and
that it agrees with the variable vertex on bit 0.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The reduction produces 3 * φ.length edges.
The reduction produces (φ.maxVar + 1) + φ.length vertices.
Basic facts about the indexing helpers #
A clause vertex of an existing clause sits at index (φ.maxVar + 1) + j.
Every edge belongs to a clause that exists.
Every (clause, position) pair is realized by an edge.
The edge constraint of toGraph, spelled out.
Translating assignments #
The label the graph assignment induced by a CNF assignment α puts on
vertex number w: a variable vertex gets the constant value of its variable, a
clause vertex gets the values of the three variables its clause mentions.
Equations
Instances For
The label of a variable vertex.
The label of a clause vertex.
The CNF assignment read off from a graph assignment: variable v takes the
value of bit 0 of the label of its variable vertex.
Equations
- Complexity.ThreeSATCSP.mkAssign φ a = List.map (fun (v : ℕ) => a (Complexity.ThreeSATCSP.varVertex φ v) 0) (List.range (φ.maxVar + 1))
Instances For
Correctness #
Correctness of the reduction. For a 3CNF formula, the constraint graph
produced by toGraph is satisfiable exactly when the formula is.