Diamond graphs #
The diamond construction of Sipser, Theorem 7.46 reduces satisfiability to directed
Hamiltonian paths. This file treats it for an arbitrary layout of the rows, so that reductions can
choose how many nodes each row has. A diamond graph (Cslib.Complexity.Diamond.graph) has
Ndiamonds, diamondiwith a top node, a bottom node (the top of diamondi + 1), and a row of3 * slots i + 3nodes joined both ways in a line; the top has arcs to both ends of the row, and both ends have arcs to the bottom. Slots < slots iof rowiis the pair of row nodes3 * s + 2and3 * s + 3, and the nodes3 * s + 1separate the pairs;Mclause nodes;- a list of detours (
Cslib.Complexity.Diamond.Detour), each through claused.clauseacrossd.slotofd.row: left to right whend.leftToRightis true, right to left when it is false.
When the detours across each slot all belong to one clause (Cslib.Complexity.Diamond.WellFormed),
the graph has a Hamiltonian path from the first top to the last bottom exactly when the rows can be
given directions so that every clause has a detour in the direction of its row
(Cslib.Complexity.Diamond.mem_DirHamPath_iff). In a Hamiltonian path every separator has its two
row neighbours as predecessor and successor, a detour must return to the slot it left, so all
separators of a row point the same way, and the node of a clause is entered from a slot whose row
points the way of the detour. Conversely, rows traversed in the given directions, each clause
visited by one detour in the direction of its row, form a Hamiltonian path.
Sipser's construction is the layout with one slot for each clause in every row; giving each row only the slots of the detours through it makes the graph linear in the size of the formula.
Node labels, detours, graphs, and the WellFormed and Satisfiable predicates are defined in
CslibFrontier.Computability.Complexity.Problems.Hamiltonian.Diamond.Defs, and Hamiltonian-path
soundness (satisfiable_of_mem_DirHamPath) is proved in
CslibFrontier.Computability.Complexity.Problems.Hamiltonian.Diamond.Soundness; both are
re-exported
here alongside completeness, the equivalences mem_DirHamPath_iff and mem_DirHamCycle_iff, and
polynomial-time computability.
Main definitions #
Cslib.Complexity.Diamond.encDetour: the encoding of detours used for polynomial-time computability.
Main results #
Cslib.Complexity.Diamond.mem_DirHamPath_iff: Hamiltonian paths of a diamond graph are directions of its rows satisfying every clause.Cslib.Complexity.Diamond.mem_DirHamCycle_iff: Hamiltonian cycles of a closed diamond graph likewise.Cslib.Complexity.Diamond.computableInPolyTime_graph,Cslib.Complexity.Diamond.computableInPolyTime_cycleGraph: diamond graphs are computable in polynomial time from layouts computable in polynomial time.
References #
Directions satisfying every clause give Hamiltonian paths #
Steps of a row traversal #
Hamiltonian paths of diamond graphs. A well-formed diamond graph has a Hamiltonian path from the top of the first diamond to the bottom of the last exactly when its rows can be given directions so that every clause has a detour in the direction of its row.
Hamiltonian cycles of closed diamond graphs. A well-formed closed diamond graph has a Hamiltonian cycle exactly when its rows can be given directions so that every clause has a detour in the direction of its row.
Polynomial time #
The top nodes are computable in polynomial time from unary indices.
The row nodes are computable in polynomial time from unary indices.
The clause nodes are computable in polynomial time from unary indices.
A diamond graph is computable in polynomial time from a layout computable in polynomial time, with the numbers of diamonds, slots and clauses in unary.
A closed diamond graph is computable in polynomial time from a layout computable in polynomial time, with the numbers of diamonds, slots and clauses in unary.