A reduction of linear size to independent sets #
Karp's reduction Cslib.Complexity.SAT.toIndependentSet joins all complementary occurrences of a
variable, so its graph can have quadratically many edges in the number of clauses even for formulas
with three literals per clause. SAT.toSparseIndependentSet is the reduction with variable edges
Garey and Johnson, Theorem 3.3, stated for independent sets. It has
- two literal vertices for each of the
ndistinct variables of the formula, joined by an edge; - a vertex for each position of each clause, the positions of a clause forming a clique;
- an edge from each position to the literal vertex of the complement of its literal,
and asks for an independent set of n + m vertices, for m clauses. An independent set has at
most one vertex in each variable edge and in each clause clique, so one of n + m vertices has
exactly one in each: the literal vertices chosen give an assignment, and the position chosen in a
clause is not joined to its literal, which therefore holds. Conversely, a satisfying assignment
chooses the true literal of each variable and a true position of each clause.
On formulas whose clauses have at most k literals the graph has at most (k ^ 2 + 5 k) m
vertices and edges in total (Cslib.Complexity.SAT.length_toSparseIndependentSet_le), which is
linear in m for fixed k.
Main definitions #
Cslib.Complexity.SAT.toSparseIndependentSet, with the vertex labelsCslib.Complexity.SAT.SparseIndependentSet.literalVertexandCslib.Complexity.SAT.SparseIndependentSet.occurrenceVertex.
Main results #
Cslib.Complexity.SAT.toSparseIndependentSet_mem_iff:toSparseIndependentSet φ ∈ IndependentSet ↔ φ ∈ SAT.Cslib.Complexity.SAT.computableInPolyTime_toSparseIndependentSet: the reduction is polynomial-time.Cslib.Complexity.SAT.length_toSparseIndependentSet_le: the graph has linearly many vertices and edges for clauses of bounded width.
References #
The graph #
The vertex of the literal l of φ, its variable numbered by its position in
φ.distinctVars.
The vertex of position j of clause i.
The vertices: the two literals of every variable of φ, and every position of every clause.
The edges between the two literals of each variable.
The edges between any two positions of a clause.
The edges from each position of a clause to the complement of its literal.
The edges of the graph.
The reduction from SAT to IndependentSet with variable edges Garey and Johnson,
Theorem 3.3: the graph of φ with the target n + m, for n distinct
variables and m clauses.
Vertices and edges #
Correctness #
Correctness of the reduction with variable edges. A formula is satisfiable exactly when its
graph has an independent set of n + m vertices, for n distinct variables and m clauses.
Size #
The graph has linear size. On formulas with m clauses of at most k literals, the graph
of toSparseIndependentSet has at most (k ^ 2 + 5 k) m vertices and edges in total, counted as
listed.
Polynomial-time reduction #
The reduction toSparseIndependentSet is computable in polynomial time: vertex labels are
computed in unary from clause, position and variable indices, then converted to binary.