6.045 Lecture 19: Finish NP-Completeness, conp and Friends 1
Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input w, halts with just f(w) on its tape Language A is poly-time reducible to language B, written as A P B, if there is a poly-time computable f : Σ* Σ* so that: w A f(w) B f is a polynomial time reduction from A to B Note there is a k such that for all w, f(w) k w k 2
Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B That is, A P B When this is true, we say B is NP-hard NP-complete problems: 3SAT, SAT, CLIQUE, IS, VC, SUBSET-SUM, KNAPSACK, PARTITION, BIN-PACKING, 3
Two Problems Let G denote a graph, and s and t denote nodes. SHORTEST PATH = {(G, s, t, k) G has a simple path of < k edges from s to t } LONGEST PATH = {(G, s, t, k) G has a simple path of > k edges from s to t } Are either of these in P? Are both of them? 4
HAMPATH = { (G,s,t) G is an directed graph with a Hamiltonian path from s to t} Theorem: HAMPATH is NP-Complete (1) HAMPATH NP (2) 3SAT P HAMPATH Sipser (p.314-318) 5
HAMPATH P LONGEST-PATH LONGEST-PATH = {(G, s, t, k) G has a simple path of > k edges from s to t } Can reduce HAMPATH to LONGEST-PATH by observing: (G, s, t) 2 HAMPATH (G, s, t, V -2) 2 LONGEST-PATH Therefore LONGEST-PATH is NP-hard. 6
conp and Friends 7
Definition: conp = { L L NP } What does a conp computation look like? A co-nondeterministic machine has multiple computation paths, and has the following behavior: - the machine accepts if all paths reach accept state - the machine rejects if at least one path reaches reject state 8
Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode: Guess string y of x k length and the machine accepts iff some y leads to an accept state In conp algorithms, we can use a try all instruction: Try all strings y of x k length and the machine accepts iff every y leads to an accept state 9
TAUTOLOGY = { is a Boolean formula and every variable assignment satisfies } Theorem: TAUTOLOGY is in conp How would we write pseudocode for a conp machine that decides TAUTOLOGY? How would we write TAUTOLOGY as the complement of some NP language? 10
Is P conp? Yes! L P implies that L P (hence L NP) In general, deterministic complexity classes are closed under complement 11
Is NP = conp? THIS IS AN OPEN QUESTION! It is believed that NP conp 12
conp P NP 13
Definition: A language B is conp-complete if 1. B conp 2. For every A in conp, there is a polynomial-time reduction from A to B (B is conp-hard) 14
UNSAT = { is a Boolean formula and no variable assignment satisfies } Theorem: UNSAT is conp-complete Proof: UNSAT conp (why?) (2) UNSAT is conp-hard: Let A conp. We show A P UNSAT On input w, transform w into a formula using Cook-Levin via an NP machine N for A w A SAT w A SAT w A UNSAT w A UNSAT 15
UNSAT = { is a Boolean formula and no variable assignment satisfies } Theorem: UNSAT is conp-complete TAUTOLOGY = { is a Boolean formula and every variable assignment satisfies } = { UNSAT} Theorem: TAUTOLOGY is conp-complete (1) TAUTOLOGY conp (already shown) (2) TAUTOLOGY is conp-hard: UNSAT P TAUTOLOGY: Given formula, output 16
Is P = NP conp? THIS IS AN OPEN QUESTION! 17
An Interesting Problem in NP conp FACTORING = { (m, n) m > n > 1 are integers, there is a prime factor p of m where n p < m } If FACTORING P, we could expect to break most public-key cryptography currently in use! Theorem: FACTORING 2 NP conp 18
PRIMES = {n n is a prime integer} Theorem (Pratt 70s): PRIMES NP conp PRIMES is in P Manindra Agrawal, Neeraj Kayal and Nitin Saxena Ann. of Math. Volume 160, Number 2 (2004), 781-793. Abstract We present an unconditional deterministic polynomialtime algorithm that determines whether an input number is prime or composite. 19
FACTORING = { (m, n) m, n > 1 are integers, there is a prime factor p of m where n p < m } Theorem: FACTORING NP conp Proof: (1) FACTORING NP A prime factor p of m such that p n is a proof that (m,n) is in FACTORING (2) FACTORING conp The prime factorization p 1 e1 p k ek of m is a proof that (m,n) is not in FACTORING: Verify each p i is prime, and p 1 e1 p k ek = m Verify that for all i=1,,k that p i < n
conp TAUTOLOGY FACTORING P NP SAT CLIQUE Decidable 22