Beruflich Dokumente
Kultur Dokumente
Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
NP-Completeness
Lecture 40 Section 7.4 Robb T. Koether
Hampden-Sydney College
Outline
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Homework Review NP-Completeness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Homework Review
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Exercise 7.12, page 295. Let M ODEXP = { a, b, c, p | a, b, c, and p are binary integers such that ab c (mod p)}. Show that M ODEXP P. (Note that the most obvious algorithm doesnt run in polynomial time. Hint: Try it rst where b is a power of 2.)
Homework Review
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Solution The efcient algorithm to raise a number to the power n (n > 0) is to use repeated squaring. For example, a16 = a2
2 2 2
If the exponent is not a power of 2, then there are some more details. For example, a13 = a2 a
2 2
a.
Homework Review
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Solution Use this algorithm together with reduction modulo p after each operation. For example, 313 (mod 5): 32 9 4 (mod 5). 4 3 12 2 (mod 5). 22 4 (mod 5). 42 16 1 (mod 5). 1 3 3 (mod 5).
Homework Review
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Factoring On a related note, if it were possible (is possible) to compute (n 1)! (mod n) in polynomial time, then it would be possible (is possible) to factor n in polynomial time. How so?
NP-Completeness
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Certain problems in NP have been shown to have a special property: If they are solvable deterministically in polynomial time, then so are all problems in NP. These problems are called NP-complete. We will show that SAT is NP-complete.
The SAT Problem Given a Boolean expression in m variables x1 , x2 , . . . , xm consisting of n literals (occurrences of xi or xi ), do there exist Boolean values for x1 , x2 , . . . , xm that make the expression true? (n is the size of the problem.)
Cooks Theorem
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Theorem (Cooks Theorem) SAT P if and only if P = NP. Proof idea. First show that SAT is in NP. Then show that every problem in NP is polynomial-time reducible to SAT. Details in the next lecture.
Polynomial-Time Computability
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Denition (Polynomial-time computable) A function f : is polynomial-time computable if there is a polynomial-time Turing machine M that halts on all inputs w with f (w) on its tape. Denition (Polynomial-time reducible) A language A is polynomial-time reducible to a language B if there exists a polynomial-time computable function f such that w A f (w) B. We write A P B .
NP-Complete
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
A Polynomial-Time Reduction
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Before proving Cooks Theorem, we will look at an example of a polynomial-time reduction. We will reduce 3SAT to CLIQUE. That is, we will show that 3SAT P SAT.
Let f be a Boolean expression in conjunctive normal form with exactly 3 literals per clause. Create a graph G by the following two steps. (1) For each clause, create a group of nodes labeled with the literals in that clause.
For example, let f = (x y z ) (x y z ) (x y z ) (x y z ). Then there are four groups of three nodes each.
z z
(2) Connect each node in one group with every node in the other groups that is logically compatible with it. That is, for every variable x, connect x with everything except x in every other clause. Do this for each group.
z z
z z
z z
z z
z z
z z
z z
z z
z z
z z
z z
Let k be the number of clauses in the expression. We now ask, does the graph have a clique of size k ?
z z
z z
This clique gives us values for x, y , and z that will satisfy the expression. Namely, x is true, y is false, and z is false. This shows that yes to CLIQUE implies yes to 3SAT. It is also easy to see that no to CLIQUE implies no to 3SAT. It is also the case that this reduction can be done in polynomial time.
NP-Complete
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
NP-Complete
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Theorem If B is NP-complete and B P C for some C NP, then C is NP-complete. Proof. The relation P is transitive.
Assignment
NPCompleteness Robb T. Koether Homework Review NPCompleteness The SAT Problem Cooks Theorem The Reduction of 3SAT to CLIQUE Assignment
Homework Read Section 7.4, pages 271 - 276. Exercises 9, 10, page 295. Problems 13, 18, page 295.