NP Completeness NP-Completeness Was Introduced by Stephen Cook in 1971 in a Foundational Paper
Total Page:16
File Type:pdf, Size:1020Kb
NP Completeness NP-completeness was introduced by Stephen Cook in 1971 in a foundational paper. Leonid Levin independently introduced the same concept and proved that a variant of SAT is NP-complete. 1. S. Cook. The Complexity of Theorem-Proving Procedures. STOC, 1971. 2. L. Levin. Universal Search Problems. PINFTRANS: Problems of Information Transmission, 1973. (Translated by Trakhtenbrot) Computational Complexity, by Fu Yuxi NP Completeness 1 / 76 The question \P =? NP" became known since 1971. Computational Complexity, by Fu Yuxi NP Completeness 2 / 76 Synopsis 1. NP-Completeness 2. Cook-Levin Theorem 3. Karp Theorem 4. Ladner Theorem 5. Baker-Gill-Solovay Theorem 6. On Relativization Computational Complexity, by Fu Yuxi NP Completeness 3 / 76 NP-Completeness Computational Complexity, by Fu Yuxi NP Completeness 4 / 76 G¨odelproved (1931): Theorem Proving is undecidable. G¨odelquestioned (1956): What happens if we are only interested in theorems with short proofs? Computational Complexity, by Fu Yuxi NP Completeness 5 / 76 From now on \polynomial time" is abbreviated to \P-time". Computational Complexity, by Fu Yuxi NP Completeness 6 / 76 On the Definition of NP Theorem. A language L ⊆ f0; 1g∗ is in NP if and only if there exists a polynomial ∗ p : N ! N and a P-time TM M, called a verifier for L, such that for every x 2 f0; 1g , p(jxj) x 2 L iff 9u2f0; 1g :M(x; u) = 1: p(jxj) If x 2 L and u 2 f0; 1g satisfy M(x; u)=1, then we call u a certificate for x with respect to L and M. A sequence of successful choices can be seen as a certificate. Conversely a certificate can be generated nondeterministically. Computational Complexity, by Fu Yuxi NP Completeness 7 / 76 NP and Efficient Verifiability P: The class of efficiently solvable problems. NP: The class of efficiently verifiable problems. I A problem in P will be called a P-problem. I A problem in NP will be called an NP-problem. Computational Complexity, by Fu Yuxi NP Completeness 8 / 76 NP-Problems 1. IndSet, TSP, Subset Sum, 0=1 IntProg, dHamPath 2. Graph Isomorphism, Factoring polylog I Babai's result in 2015, 2 . I Prime Factoring is NP-complete. 3. Linear Programming, Primality Computational Complexity, by Fu Yuxi NP Completeness 9 / 76 One can reduce one problem to another without even knowing any solutions to either. Computational Complexity, by Fu Yuxi NP Completeness 10 / 76 Karp Reduction Suppose L; L0 ⊆ f0; 1g∗. 0 0 We say that L is Karp reducible to L , denoted by L ≤K L , if there is a P-time computable function r : f0; 1g∗ ! f0; 1g∗ such that for every x 2 f0; 1g∗, x 2 L iff r(x) 2 L0: 0 00 00 If L ≤K L ≤K L then L ≤K L . Computational Complexity, by Fu Yuxi NP Completeness 11 / 76 Hardness and Completeness 0 0 We say that L is NP-hard if L ≤K L for every L 2 NP. We say that L0 is NP-complete if L0 is NP-hard and L0 2 NP. Fact. 1. If language L is NP-hard and L 2 P, then P = NP. 2. If language L is NP-complete, then L 2 P iff P = NP. Computational Complexity, by Fu Yuxi NP Completeness 12 / 76 Does there exist an NP-complete problem any way? Computational Complexity, by Fu Yuxi NP Completeness 13 / 76 Bounded Halting Problem Theorem. The following language is NP-complete: def n t n TMSAT = fhα; x; 1 ; 1 i j 9u2f0; 1g : Mα(x; u) outputs 1 in t stepsg: Let L 2 NP be decided by a q-time TM M using p-size certificate. Then \x 2 L" iff p(jxj) 9u 2 f0; 1g : M(x; u) outputs 1 in q(jxj+p(jxj)) steps p(jxj) q(jxj+p(jxj)) iff \hxMy; x; 1 ; 1 i 2 TMSAT". p(jxj) q(jxj+p(jxj)) The Karp reduction maps x onto hxMy; x; 1 ; 1 i. Computational Complexity, by Fu Yuxi NP Completeness 14 / 76 A language L ⊆ f0; 1g∗ is in coNP def= L j L 2 NP if there exists a polynomial p : N ! N and a P-time TM M such that p(jxj) x 2 L iff 8u2f0; 1g :M(x; u)=1 for every x. P ⊆ coNP \ NP: Computational Complexity, by Fu Yuxi NP Completeness 15 / 76 P = NP Implies coNP = NP. Computational Complexity, by Fu Yuxi NP Completeness 16 / 76 Theorem. If P = NP then EXP = NEXP. Proof. Suppose L 2 NEXP is accepted by an NDTM in 2nc time. Then c n 2jxj o Lpad = x01 j x 2 L 2 NP: By assumption Lpad 2 P. But then L 2 EXP. The padding technique used in this proof was introduced by Berman and Hartmanis. 1. Berman and Hartmanis. On Isomorphisms and Density of NP and Other Complete Sets. STOC, 1976. Computational Complexity, by Fu Yuxi NP Completeness 17 / 76 Cook-Levin Theorem Computational Complexity, by Fu Yuxi NP Completeness 18 / 76 Conjunctive Normal Form A CNF formula has the form 0 1 ^ _ @ vij A ; i j W where vij is called a literal, and j vij a clause. A literal is either a propositional variable, or the negation of a propositional variable. A kCNF formula is a CNF formula in which all clauses contain at most k literals. Computational Complexity, by Fu Yuxi NP Completeness 19 / 76 The First Natural NP-Complete Problem SAT is the language of all satisfiable CNF formulae. I The set of the unsatisfiable DNF's is the complement of SAT. I The set of the satisfiable DNF's is in P. Computational Complexity, by Fu Yuxi NP Completeness 20 / 76 2SAT Fact. 2SAT 2 P. x _ y for example is understood as both an edge from x to y and an edge from y to x. A 2SAT 2 P formula ' is unsatisfiable if and only if there is some z such that z is reachable from z. Computational Complexity, by Fu Yuxi NP Completeness 21 / 76 3SAT Fact. SAT ≤K 3SAT. Proof. For example u1 _ u2 _ u3 _ u4 _ u5 is satisfiable iff (u1 _ u2 _ v) ^ (:v _ u3 _ w) ^ (:w _ u4 _ u5) is satisfiable. Corollary. 3SAT is NP-complete if SAT is NP-complete. Computational Complexity, by Fu Yuxi NP Completeness 22 / 76 Cook-Levin Theorem Theorem (Cook, 1971; Levin, 1973). SAT is NP-complete. Computational Complexity, by Fu Yuxi NP Completeness 23 / 76 Variable Equality Intuitively the formula (x1 _ y1) ^ (x1 _ y1) ^ ::: ^ (xn _ yn) ^ (xn _ yn) is equivalent to (x1 = y1) ^ ::: ^ (xn = yn): Computational Complexity, by Fu Yuxi NP Completeness 24 / 76 Formula Defining a Boolean Function Claim. For every Boolean function f : f0; 1g` ! f0; 1g, there is an `-variable CNF ` ` formula 'f of size `2 such that 'f (u) = f (u) for every u 2 f0; 1g , where the size of a CNF formula is defined to be the number of _/^ symbols. Let 'f be ^ Cv (z1;:::; z`) v2f0;1g`^f (v)=0 where for each v, Cv (v) = 0 and Cv (u) = 1 for every u 6= v. Computational Complexity, by Fu Yuxi NP Completeness 25 / 76 Proof of Cook-Levin Theorem Suppose L 2 NP. Let M be a P-time TM and p a polynomial such that for every ∗ p(jxj) x 2 f0; 1g , x 2 L iff 9u2f0; 1g :M(x; u) = 1. Wlog, we may assume that M is oblivious. We shall construct a P-time computable function ' : L ! SAT such that \'x 2 SAT iff x 2 L", which is equivalent to saying that p(jxj) 'x 2 SAT iff 9u2f0; 1g :M(x ◦ u) = 1: Computational Complexity, by Fu Yuxi NP Completeness 26 / 76 Proof of Cook-Levin Theorem The idea is that 'x should be a CNF formula such that I it reflects the execution sequence of M(x ◦ u) from the initial configuration to the final configuration, and I M(x ◦ u) = 1 iff the CNF formula is satisfiable. Computational Complexity, by Fu Yuxi NP Completeness 27 / 76 Proof of Cook-Levin Theorem We choose to encode snapshots rather than configurations. I \Computation is local." The i-th snapshot zi depends only on zi−1, prev(i), inputpos(i). I The current state is calculated from zi−1. I The symbol at the input tape is read at inputpos(i). I The other symbols are collected from prev(i)'s. Computational Complexity, by Fu Yuxi NP Completeness 28 / 76 Proof of Cook-Levin Theorem Now x 2 L if and only if jxj+p(jxj) 9y 2 f0; 1g :9z1 ::: zT (jxj):'x (y; z1;:::; zT (jxj)) where 'x (y; z1;:::; zT (jxj)) is the conjunction of the following propositions. 1. x is a prefix of y; 2. z1 encodes the initial snapshot; 3. zT (jxj) encodes the final snapshot with output 1; 4. zprev(i); zi−1; zi and yinputpos(i) must satisfy the relationship imposed by the transition function. 3c+log n The size of zi is bounded by (3c + log n)2 , where c is the size of snapshot. Conclude that 'x (y; ez) is of polynomial length. Computational Complexity, by Fu Yuxi NP Completeness 29 / 76 Proof of Cook-Levin Theorem 'x (y; ez) is constructed in P-time. I Calculate jx ◦ uj in P-time, and jx◦uj I Simulate M on 0 in P-time to calculate I the head positions at the i-th step, and I for each work tape the largest j < i such that at the j-th step the head of the work tape was scanning the same cell as it is scanning at the i-th step.