CS:4330 Theory of Computation Spring 2018 Computability Theory Other NP-Complete Problems Haniel Barbosa
Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Sections 7.4 and 7.5.
The 3SAT Problem 3SAT is a special case of the SAT problem in which the Boolean formula is a 3CNF-formula, i.e. 3SAT = {ϕ ϕ is a satisfiable 3CNF-formula} Theorem 3SAT is NP-complete. Proof idea: provide a polynomial time reduction from SAT to 3SAT Transform ϕ SAT into CNF Represent each component of the CNF a 1 a n by n 2 clauses (a 1 a 2 z 2 ) ( z 2 a 3 z 3 ) ( z n 2 a n 1 a n ) The resulting formula is equisatisfiable to the original one, even though it is not logically equivalent 1 / 13
Reducing 3SAT to CLIQUE Theorem 3SAT is polynomial time reducible to CLIQUE. Proof idea Build a polynomial time reduction f from formulas to graphs In the constructed graphs, cliques of a specialized size correspond to a satisfying assignment to the formula Structures within the graph are designed to mimic the behavior of the variables and clauses Let ϕ be a formula with k clauses: ϕ = (a 1 b 1 c 1 ) (a 2 b 2 c 2 ) (a k b k c k ) The reduction f generates a string G, k in which G is an undirected graph. 2 / 13
Reducing 3SAT to CLIQUE Nodes Nodes are organized in k groups of three nodes each called the triplets t 1,..., t k Each triplet corresponds to one of the clauses in ϕ and each node in the triplet corresponds to a literal in the associated clause Label each node of G with its corresponding literal in ϕ Edges of G connect all but two types of pairs of nodes in G: No edge is present between the nodes of the same triplet No edge is present between two nodes with contradictory labels, such as x 1 and x 1 3 / 13
Example of 3SAT reduction to graphs The 3-SAT formula (x x y) ( x y y) ( x y y) is reduced to the following clique problem below. x ~x x y y y ~x ~y ~y The green vertices form a 3-clique and correspond to the satisfying assignment x = 0,y = 1 4 / 13
Why this construction works? Lemma A 3CNF formula ϕ with k clauses is satisfiable if and only if its encoding as a graph G has a k clique, i.e. G,k CLIQUE. Proof idea 3SAT CLIQUE: Suppose that ϕ has a satisfying assignment and show G has a k-clique CLIQUE 3SAT: Suppose that G has a k-clique and show that ϕ has a satisfying assignment 5 / 13
3SAT CLIQUE Suppose that ϕ has a satisfying assignment At least one literal is true in every clause (required by ) In each triplet of G we select one node corresponding to a true literal in the assignment. If more literals are true is some clause we select a true one arbitrarily The selected nodes form a k-clique: there are k nodes (the number of clauses in ϕ) and each pair of selected nodes are joined, by construction selected nodes are not from the same triplet, by construction, and they could not have contradictory labels, since the assignment can t make both a variable and its negation true Therefore G contains a k-clique 6 / 13
CLIQUE 3SAT Suppose that G has a k-clique No two of the clique nodes can occur in the same triplet because nodes in the same triplet are not connected Therefore each of the k-triplets contains one of the k-clique nodes Assign the variables of ϕ s.t. each literal labeling a clique node is true. This can be done since two nodes with contradictory labels are not connected This assignment satisfies ϕ each triplet contains a clique node therefore each clause contains a literal that is assigned to true 7 / 13
CLIQUE is NP-complete Since there is a polynomial time reduction from 3SAT into CLIQUE and CLIQUE NP, we can conclude that CLIQUE is NP-complete Polynomial time reducibility allows us to link these two very different problems Similar links may be made among other problems 8 / 13
NP-hardness Definition A language B is NP-hard if every A NP is polynomial time reducible to B. Lemma If A NP and A is NP-hard, then A is NP-complete. 9 / 13
VERTEX-COVER is NP-complete If G is an undirected graph, a vertex cover of G is a subset of the nodes where every edge of G touches one of those nodes. The vertex cover problem asks whether a graph contains a vertex cover of a specified size: VERTEX-COVER = { G,k G is an undirected graph with a k-node vertex cover} Theorem VERTEX-COVER is NP-complete Proof idea Show that VERTEX-COVER is in NP Easy to certify in polynomial time that subset of k nodes is a vertex-cover Show that VERTEX-COVER is NP-hard Reduction from 3SAT to VERTEX-COVER Alternative proof can be done using reductions between graph problems 10 / 13
VERTEX-COVER is NP-hard (from 3SAT reduction) Theorem 3SAT p VERTEX-COVER. Proof idea Convert a 3CNF formula ϕ into a graph G and number k such that ϕ is satisfiable whenever G has a vertex cover with k nodes. f (ϕ) = G,m + 2n, where ϕ is a 3CNF formula with n clauses on m variables G = (V,E), where V = {x i, x i 1 i m} {l i,j 1 i 3,1 j n} and E = {(l 1,j,l 2,j ),(l 1,j,l 3,j ),(l 2,j,l 3,j ) 1 j l} {(x i,l j,k ) 1 i m,1 j 3,1 k n} in which the j-th literal of clause k is x i 11 / 13
VERTEX-COVER is NP-hard (by graph reductions) Given a graph G = (V,E) X V is a vertex-cover if for each edge (u,v) E, u X or v X I V is an independent set if for each edge (u,v) E, u I or v I X is a vertex-cover iff V \ X is an independent set of G Note this a lemma to be proved X is a clique of G iff X is an independent set of Ḡ, i.e. the graph complement of G (which complements the edges) Note this a lemma to be proved NP-hardness proof then amounts to show: CLIQUE p INDEPENDENCE-SET: f ( G,k ) = Ḡ,k INDEPENDENCE-SET p VERTEX-COVER: f ( G,k ) = G, V k 12 / 13
Other NP-complete problems HAM-PATH SUBSET-SUM PARTITION BIN-PACKING KNAPSACK 13 / 13