A reduction of linear size to Hamiltonian cycles #
Sipser's diamond reduction Cslib.Complexity.SAT.toDirHamPath gives every row a pair of nodes for
each clause, so its graph has Θ(m ^ 2) vertices and arcs on formulas with m clauses of three
literals. SAT.toSparseDirHamPath is the diamond graph (Cslib.Complexity.Diamond.graph) with one
diamond for each distinct variable of the formula, whose row has a slot for each occurrence of the
variable and no other. The occurrence at position p of φ.vars, a literal (x, b) of clause
j, adds a detour through the node of clause j across its slot in the row of x, left to right
when b is true. The detours across a slot belong to a single occurrence, so the graph is
well formed, and directions of the rows satisfying every clause are satisfying assignments: the
graph has a Hamiltonian path exactly when the formula is satisfiable
(Cslib.Complexity.SAT.toSparseDirHamPath_mem_iff).
The graph has at most 23 L + m + 1 vertices and arcs in total, for L occurrences of variables
(Cslib.Complexity.SAT.length_sparseDiamondGraph_le_length_vars), so at most (23 k + 1) m + 1 on
formulas with clauses of at most k literals (Cslib.Complexity.SAT.length_sparseDiamondGraph_le).
Closing the path with an arc back to the first top (Cslib.Complexity.SAT.toSparseDirHamCycle,
Cslib.Complexity.Diamond.mem_DirHamCycle_iff) gives directed Hamiltonian cycles, and splitting
every vertex into three (Cslib.Complexity.Graph.split) gives undirected Hamiltonian cycles
(Cslib.Complexity.SAT.toSparseHamCycle), still of linear size.
Main definitions #
Cslib.Complexity.SAT.occurrencePositions: the positions of the occurrences of a variable.Cslib.Complexity.SAT.sparseSlots,Cslib.Complexity.SAT.sparseDetours,Cslib.Complexity.SAT.sparseDiamondGraph: the layout of the rows and the graph.Cslib.Complexity.SAT.toSparseDirHamPath,Cslib.Complexity.SAT.toSparseDirHamCycle,Cslib.Complexity.SAT.toSparseHamCycle: the reductions.
Main results #
Cslib.Complexity.SAT.toSparseDirHamPath_mem_iff,Cslib.Complexity.SAT.toSparseDirHamCycle_mem_iff,Cslib.Complexity.SAT.toSparseHamCycle_mem_iff: correctness.Cslib.Complexity.SAT.computableInPolyTime_toSparseDirHamPath,Cslib.Complexity.SAT.computableInPolyTime_toSparseDirHamCycle,Cslib.Complexity.SAT.computableInPolyTime_toSparseHamCycle: the reductions are polynomial-time.Cslib.Complexity.SAT.length_sparseDiamondGraph_le_length_vars,Cslib.Complexity.SAT.length_sparseDiamondGraph_le,Cslib.Complexity.SAT.length_toSparseDirHamCycle_le,Cslib.Complexity.SAT.length_toSparseHamCycle_le: the graphs have linear size.
References #
The graph #
The positions in φ.vars of the occurrences of the variable x.
The number of slots of row i: the number of occurrences of variable i of
φ.distinctVars.
The detours: the occurrence at position p of φ.vars, a literal (x, b) of clause j,
goes through the node of clause j across its slot in the row of x, in the direction b.
The diamond graph with one diamond for each distinct variable of φ and a slot for each
occurrence.
The reduction from SAT to DirHamPath of linear size: the sparse diamond graph of φ,
from the top of the first diamond to the bottom of the last.
The reduction from SAT to DirHamCycle of linear size: the sparse diamond graph of φ with
an arc from the bottom of the last diamond back to the top of the first.
The reduction from SAT to HamCycle of linear size: the vertex-splitting graph of the
closed sparse diamond graph.
Correctness #
The sparse diamond graph is well formed.
Directions of the rows satisfying every clause are satisfying assignments.
Correctness of the sparse diamond construction. A formula is satisfiable exactly when its sparse diamond graph has a Hamiltonian path from the top of the first diamond to the bottom of the last.
Correctness of the closed sparse diamond construction. A formula is satisfiable exactly when its closed sparse diamond graph has a Hamiltonian cycle.
Correctness of the undirected construction. A formula is satisfiable exactly when the vertex-splitting graph of its closed sparse diamond graph has a Hamiltonian cycle.
Size #
The rows have at most as many slots in total as φ has occurrences of variables.
The sparse diamond graph has linear size. It has at most 23 L + m + 1 vertices and arcs
in total, counted as listed, for L occurrences of variables and m clauses.
The sparse diamond graph has linear size. On formulas with m clauses of at most k
literals, it has at most (23 k + 1) m + 1 vertices and arcs in total, counted as listed.
The closed sparse diamond graph has linear size.
The undirected reduction has linear size. On formulas with m clauses of at most k
literals, the graph of toSparseHamCycle has at most (115 k + 5) m + 10 vertices and edges in
total, counted as listed.
Polynomial-time reductions #
The positions of the occurrences of a variable are computable in polynomial time.
The numbers of slots are computable in polynomial time, in unary.
The detours are computable in polynomial time.
The sparse diamond graph is computable in polynomial time: node labels are computed in unary from diamond, row, clause and occurrence indices, then converted to binary.
The reduction toSparseDirHamPath is computable in polynomial time.
The reduction toSparseDirHamCycle is computable in polynomial time.
The reduction toSparseHamCycle is computable in polynomial time.