Download presentation
Presentation is loading. Please wait.
1
Cook Theorem and NP-complete problems
NP-completeness Cook Theorem and NP-complete problems
2
NP-complete problems Definition 10.1.
A decision problem Π NP is called NP-complete if all other problems in NP polynomially transforms to Π.
3
Boolean variables Definition 10.2.
Assume X = {x1,…,xk} is a set of Boolean variables. A truth assignment for X is a function T: X → {true, false}. We extend T to the set by setting if T(x) := false and vice versa (x can be regarded as the negation of x). The elements of L are called the literals over X.
4
Literals A clause over X is a set of literals over X.
A clause represents the disjunction of those literals and is satisfied by a truth assignment iff at least one of its members is true. A family Z of clauses over X is satisfiable iff there is some truth assignment simultaneously satisfying all of its clauses.
5
Satisfiability Instance: A set X of variables and a family Z of clauses over X. Question: Is Z satisfiable?
6
Cook Theorem (Cook 1971) Theorem 10.1 Satisfiability is NP-complete.
7
Proof Satisfiability belongs to NP because a satisfying truth assignment serves as a certificate for any yes-instance, which of course can be checked in polynomial time.
8
Proof Let now Π = (X,Y) be any other problem in NP. We have to show that P polynomially transforms to Satisfiability. By definition there is a polynomial p and a decision problem Π'=(X',Y') in P, where X' = {x#c: x X, c {0,1}└ p(size(x))┘} and Y = {y X : c {0,1}└ p(size(x))┘ : y#c Y'}. Let Φ:{0,…,N}× A{⊔}→{-1,…,N}×A{⊔}×{-1,0,1} be a polynomial-time Turing machine for Π’ with alphabet A. Let q be a polynomial such that time (Φ,x#c) ≤ q(size(x#c)) for all instances x#c X'. size(x#c) = size(x) └p(size(x))┘
9
Main idea We will now construct a collection Z(x) of clauses over some set V(x) of Boolean variables for each x ∈ X, such that Z(x) is satisfiable if and only if x∈Y.
10
Variables Q:=q(size(x) + 1 + └p(size(x))┘)
Q is an upper bound on the length of any computation of on input x#c, for any c ∈ {0,1}p(size(x)). V(x) contains the following Boolean variables: vijσ , 0 ≤ i ≤ Q, -Q ≤ j ≤ Q и σ A{⊔} wijn , 0 ≤ i ≤ Q, -Q ≤ j ≤ Q и −1≤ n ≤ N; We set Q …. Q is an upper bound on the length of any computation of Fi
11
Meaning of Variables vijσ , 0 ≤ i ≤ Q, -Q ≤ j ≤ Q и σ A{⊔} (vijσ indicates whether after i steps of the computation the j-th position of the string contains the symbol σ); wijn , 0 ≤ i ≤ Q, -Q ≤ j ≤ Q и −1≤ n ≤ N; (wijn indicates whether at time i the j-th position of the string is scanned and the n-th instruction is executed). We set Q …. Q is an upper bound on the length of any computation of Fi
12
Our goal So if (n(i),s(i),π(i)) i = 0,1,2,…is a computation of Φ, then we intend to set vijσ = true sj(i) =σ; wijn = true π(i) = j и n(i) = n; The collection Z(x) of clauses to be constructed will be satisfiable there is a string c with output(Φ,x#c)=1.
13
Требуемые условия для выполнимого набора дизъюнкций
At any time each position of the string contains a unique symbol . At any time a unique position of the string is scanned and a single instruction is executed . The algorithm starts correctly with input x#c for some c{0,1}└ p(size(x))┘. The algorithm works correctly ((n,σ)=(m,τ,δ)). When the algorithm reaches statement −1, it stops. Positions not being scanned remain unchanged. The output of the algorithm is 1.
14
At any time each position of the string contains a unique symbol:
15
At any time a unique position of the string is scanned and a single instruction is executed:
16
The algorithm starts correctly with input x#c for some c{0,1}└ p(size(x))┘.:
17
The algorithm works correctly ((n,σ)=(m,τ,δ)).
18
When the algorithm reaches statement −1, it stops:
19
Positions not being scanned remain unchanged:
20
The output of the algorithm is 1:
{vQ,1,1}, {vQ,2,⊔}
21
Reduction is polynomial
The encoding length of Z(x) is O(Q3log Q): There are O(Q3) occurrences of literals, whose indices require O(log Q) space. Since Q depends polynomially on size(x), we conclude that there is a polynomial-time algorithm which, given x, constructs Z(x). Note that p, and q are fixed and not part of the input of this algorithm. It remains to show that Z(x) is satisfiable if and only if x Y.
22
If Z(x) is satisfiable then x Y.
If Z(x) is satisfiable, consider a truth assignment T satisfying all clauses. Let c {0,1}└ p(size(x))┘, with cj = 1 for all j with T(v0,size(x)+1+j,1) = true and cj = 0 for all j with T(v0,size(x)+1+j,1) = false. By the construction the variables reflect computation of on input x#c. we may conclude that output(, x#c)=1. Since is a certificate-checking algorithm, this implies that x is a yes-instance (x Y).
23
If x Y then Z(x) is satisfiable.
If x Y, let c be any certificate for x. Let (n(i),s(i),π(i)) i = 0, 1, …, m be the computation of Φ on input x#c. Then we define T(vi,j,σ ) = true sj(i) = σ T(wi,j,n ) = true π(i) = j and n(i) = n. T(vi,j,σ ) = T(vi-1,j,σ ) i = m + 1,…, Q. T(wi,j,n ) = T(wi-1,j,n ) i = m + 1,…, Q. Then T is a truth assignment satisfying Z(x), completing the proof.
24
3Sat Instance: A set X of variables and a collection Z of clauses over X, each containing exactly three literals. Question: Is Z satisfiable?
25
3Sat Theorem 10.2 (Cook 1971) 3Sat is NP-complete.
We should replace each clause Z with a family Z’ of clauses such that each element of Z’ has exactly 3 literals and clause is satisfiable if and only if all clauses of Z’ are satisfiable.
26
Proof
27
Stable Set Instance: A graph G and an integer k.
Question: Is there a stable set of k vertices? A stable set in G is a set of pairwise non-adjacent vertices.
28
Stable Set Theorem 10.3 (Karp 1972) Stable Set is NP-complete.
29
Sketch of proof «Satisfiability» → «Stable Set» «Satisfiability»:
Let Z ={Z1,…,Zm} be a collection of clauses with Zi={λi1,…, λiki} (i = 1,…,m), where the λij are literals over some set X of variables. We shall construct a graph G such that G has a stable set of size m if and only if there is a truth assignment satisfying all m clauses. We show that Satisfiability polynomially transforms to Stable Set.
30
Reduction For each clause Zi we introduce a clique of ki vertices according to the literals in this clause. Vertices corresponding to different clauses are connected by an edge if and only if the literals contradict each other.
31
Instance
32
Proof Suppose G has a stable set of size m.
Then its vertices specify pairwise compatible literals belonging to different clauses. Setting each of these literals to be true (and setting variables not occurring there arbitrarily) we obtain a truth assignment satisfying all m clauses.
33
Proof Conversely, if some truth assignment satisfies all m clauses, then we choose a literal which is true out of each clause. The set of corresponding vertices then defines a stable set of size m in G.
34
Homework Vertex Cover Instance. A graph G and an integer k.
Question. Is there a vertex cover of cardinality k? Clique Question. Has G a clique of cardinality k? Prove NP-completeness of Vertex cover and Clique.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.