Some N P problems
Ü Computer scientists have studied many N P problems, that is, problems that can be solved nondeterministicallyin
polynomial time.
Ü Traditionally complexity question are studied as languages:
thecases that satisfy the stated conditions are described bystrings in some language L, while those that do not are in L.¯
Ü We need to rephrase our intuitive understanding of the problem in terms of a language.
The class N P
Ü The class N P is the set of all languages that are polynomially decidable by anondeterministic Turing machine.
Ü A nondeterministic algorithm “operates in two phases”:
1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called
verification)
Ü The second phase is called a verification algorithmand must take polynomial time.
SAT problem
Ü Example: Reconsider the SAT problem
Ü Suppose that a conjunctive normal form expression has length n, with m different literals (variable or negation of a variable):
(x1∨ ¯x2) ∧ (x3∨ x4)
| {z }
n
Ü Since m < n, we take n as the problem size.
Ü We encode the conjunctive normal form expression as a string for a Turing machine:
Σ = {x, ∨, ∧, (, ), −, 0, 1}
and the subscript of x is encoded as binary number:
(x1 ∨ x − 10) ∧ (x11 ∨ x100)
Example (continued):
Ü Since the subscript cannot be larger than m, the maximum length of any subscript is log2m.
Ü So, the the maximum encoded lengthof an n-symbol conjuctive normal form expression is O(nlogn) ⇒ O(n2).
Ü The next step is to nondeterministically create a certificate (assignments for the variables).
Ü This can be done in O(n) time (binary decision tree with 2n leaves and O(n) height).
Ü The verificationalgorithm takes O(n3) time:
Ü we check if the certificate makes the expression true (the encoded problem is O(n2) and for each of the n variables we have to go through the entire encoded problem).
Ü SAT ∈ N P.
The CLIQUE problem
Ü Example: CLIQUE problem
Ü Let G = (V, E) be an undirected graph with vertices v1, v2, . . . , vn.
Ü A k-cliqueis a subset Vk⊆ 2V, such that there is an edge between every pair of vertices vi, vj ∈ Vk.
Ü The clique problem is todecide if, for agiven k, G has a k-clique.
Ü A deterministic search can examine all the elements of 2V (exponential time-complexity).
Ü A nondeterministic algorithm guesses the correct subset (creating a certificate) andverifiesthe solution in deterministic polynomial time.
Ü CLIQUE ∈ N P.
N P problems
Ü There are many other such problems and all share the same characteristics:
1. All problems are in N P and have simple nondeterministic solutions.
2. All problems have deterministic solutions with exponential time complexity.
Ü One way to unify different cases is to see if we can reduce them to each other, in the sense if one is tractable, the others will tractable also.
Ü Cook-Karpe thesis: A problem that is in P is called tractable.
Polynomial time reduction
Definition
A language L1 is said to be polynomial-time reducible to another language L2 if there exists a deterministic Turing machine by which any w1 in the alphabet of L1 can be trans- formed in polynomial time to a w2 in the alphabet of L2 in such a way that w1 ∈ L1 if and only if w2 ∈ L2.
Polynomial time reduction
Ü Example: SAT problem is polynomial-time reducible to 3SAT.
Ü A restricted type of SAT is the 3SAT problem, in which each clause can have at most three literals:
e1 = (x1∨ x2∨ x3∨ x4) We introduce a new variable z and construct
e2 = (x1∨ x2∨ z) ∧ (x3∨ x4∨ ¯z)
Ü If e1 is true, one of the x1, x2, x3, x4 must be true.
Ü If x1∨ x2 is true, we choose z = 0, and e2 is true.
Ü If x3∨ x4 = 1, we can choose z = 1 to satisfy e2.
Ü Conversely, if e2 is true, e1 must also be true, so for satisfiability, e1 and e2 are equivalent.
Ü We run once through the expression (length n) and add new variables. The reduction runs in O(n).
Polynomial time reduction
Ü Example: 3SAT problem is polynomial-time reducible to CLIQUE.
Ü Consider
e = (x1∨ ¯x2∨ ¯x3)∧( ¯x1∨x2∨x3)∧( ¯x1∨ ¯x2∨x3)∧(x1∨x2∨x3)
Ü We draw a graph in which each clause is represented by a group of three vertices and each literal is associated with one of the vertices.
Ü For each vertex in a group, we put an edge to all vertices of the other groups, unless the two associated literals are complements.
Ü Notice that the subgraph with ( ¯x2)1, (x3)2, (x3)3, (x1)4 is a 4-clique and that ¯x2= x3 = x1 = 1 is a variable assignment that satisfies e.
Ü It can be shown that the 3SAT problem can be satisfied if and only if the associated graph has a k-clique.
Ü The reduction can be done in deterministically polynomial time.
Polynomial time reduction
Ü The point of these polynomial time reductions is that we can now look at a given problem in several ways:
Ü Suppose we conjecture that SAT is tractable.
Ü If this is difficult to prove, we might try the simpler 3SAT case.
Ü If this does not work either, we can try to find an efficient algorithm for the CLIQUE problem.
Ü If any of the options can be shown to be tractable, we can claim that SAT is tractable.
N P-completeness and an open question
Ü There are a number of problems that are central to complexity study and are such that, if we completely understood one of them, we would understand the major issue involved in tractability.
Definition
A language L is said to be N P-complete if L ∈ N P and every L1 ∈ N P is polynomial-time reducible to L.
Ü It follows from this definition that if L is N P-complete and polynomial-time reducible to L1, then L1 is also
N P-complete.
Ü If we can find one deterministic polynomial-time algorithm for any N P-complete language, then every language in N P is also in P, that is, P = N P.
N P-completeness and an open question
Ü Do efficient algorithms exists for such problems?
Ü None have been found yet.
Ü This puts N P-completeness in the center of the question of the tractability of many important problems.
Ü The next result is known as Cook’s theorem.
Theorem
The SAT problem is N P-complete.
For every configuration sequence of a Turing machine one can construct a conjunctive normal form expression that is satisfiable if and only if there is a sequence of configurations leading to
acceptance.
N P-completeness and an open question
Ü If we accept Cook’s theorem, we immediately have a number of N P-complete problems:
Ü We have shown that SAT can be reduced to 3SAT, and that 3SAT can be reduced to CLIQUE.
Ü Therefore, 3SAT and CLIQUE are both N P-complete.
Ü There are many more problems that are known to be N P-complete.
Ü Efficient algorithms for any of these have been tried to find, so far without success.
Ü This leads us to conjecture that P 6= N P, and that many important problems are intractable.
Ü P versus N P remains the fundamental open problem in computer science.
References
LINZ, P. An introduction to Formal Languages and Automata.
Jones and Bartlett Learning, 2012.