Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Similar documents
13.1 Nondeterministic Polynomial Time

CSE 105 THEORY OF COMPUTATION

Introduction to Complexity Theory

Polynomial-Time Reductions

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

COP 4531 Complexity & Analysis of Data Structures & Algorithms

NP Complete Problems. COMP 215 Lecture 20

Limitations of Algorithm Power

Intro to Theory of Computation

Correctness of Dijkstra s algorithm

SAT, Coloring, Hamiltonian Cycle, TSP

Algorithm Design and Analysis

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Lecture 4: NP and computational intractability

NP-Complete problems

Algorithm Design and Analysis

1. Introduction Recap

NP and Computational Intractability

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Chapter 34: NP-Completeness

SAT, NP, NP-Completeness

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

NP and Computational Intractability

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Spring Lecture 21 NP-Complete Problems

Computational Complexity

Introduction. Pvs.NPExample

7.8 Intractability. Overview. Properties of Algorithms. Exponential Growth. Q. What is an algorithm? A. Definition formalized using Turing machines.

P vs. NP. Data Structures and Algorithms CSE AU 1

Algorithm Design and Analysis

Automata Theory CS Complexity Theory I: Polynomial Time

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Computational Intractability 2010/4/15. Lecture 2

NP-Complete Reductions 2

NP-Completeness. NP-Completeness 1

NP-Complete Reductions 1

Show that the following problems are NP-complete

CS21 Decidability and Tractability

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

Algorithms: COMP3121/3821/9101/9801

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

A Tale of Two Cultures: Phase Transitions in Physics and Computer Science. Cristopher Moore University of New Mexico and the Santa Fe Institute

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Comp487/587 - Boolean Formulas

Non-Deterministic Time

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

NP and NP Completeness

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

NP-Completeness Part II

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P

Mathematics, Proofs and Computation

Computational complexity theory

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

CS 350 Algorithms and Complexity

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

CS 350 Algorithms and Complexity

Polynomial-time Reductions

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP and NP-Completeness

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Algorithms Design & Analysis. Approximation Algorithm

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities?

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Problems and Solutions. Decidability and Complexity

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP)

Computational complexity theory

Computability Theory

CS 583: Algorithms. NP Completeness Ch 34. Intractability

8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability. Classify Problems

CS154, Lecture 13: P vs NP

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES

NP-Completeness. Algorithmique Fall semester 2011/12

Topics in Complexity

Complexity, P and NP

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

NP Completeness and Approximation Algorithms

Computational Complexity

NP-completeness. Chapter 34. Sergey Bereg

Design and Analysis of Algorithms

The P versus NP Problem. Ker-I Ko. Stony Brook, New York

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

1.1 P, NP, and NP-complete

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

NP-Completeness and Boolean Satisfiability

Introduction to Computational Complexity

A Working Knowledge of Computational Complexity for an Optimizer

NP-Complete Problems. More reductions

The Cook-Levin Theorem

1 Reductions and Expressiveness

CS151 Complexity Theory. Lecture 1 April 3, 2017

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

NP-problems continued

Transcription:

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harry Lewis November 19, 2013 Reading: Sipser 7.4, 7.5. For culture : Computers and Intractability: A Guide to the Theory of NP-completeness, by Garey & Johnson.

Composite Numbers COMPOSITES = {w : w a composite number in binary }. COMPOSITES NP Not obviously in P, since an exhaustive search for factors can take time proportional to the value of w, which grows as 2 n = exponential in the size of w. Only in 2002 was it shown that COMPOSITES P (equivalently, PRIMES P). 1

Boolean logic Boolean formulas Def: A Boolean formula (B.F.) is either: a Boolean variable x, y, z,... (α β) where α, β are B.F. s. (α β) where α, β are B.F. s. α where α is a B.F. e.g. (x y z) ( x y z) [Omitting redundant parentheses] 2

Boolean satisfiability Def: A truth assignment is a mapping a : Boolean variables {0, 1}. [0 = false, 1 = true] The {0, 1} value of a B.F. γ on a truth assignment a is given by the usual rules of logic: If γ is a variable x, then γ(a) = a(x). If γ = (α β), then γ(a) = 1 iff α(a) = 1 or β(a) = 1. If γ = (α β), then γ(a) = 1 iff α(a) = 1 and β(a) = 1. If γ = α, then γ(a) = 1 iff α(a) = 0. a satisfies γ (sometimes written a = γ) iff γ(a) = 1. In this case, γ is satisfiable. If no a satisfies γ, then γ is unsatisfiable. 3

Boolean Satisfiability SAT = {α : α is a satisfiable Boolean formula}. Prop: SAT NP 4

A similar problem in P: 2-SAT A 2-CNF formula is one that looks like (x y) ( y z) ( y x) i.e., a conjunction of clauses, each of which is the disjunction of 2 literals (or 1 literal, since (x) (x x)) 2-SAT = the set of satisfiable 2-CNF formulas. e.g. (x y) ( x y) ( x y) (x y) / SAT 5

2-SAT P Method (resolution): 1. If x and x are both clauses, then not satisfiable e.g. (x) (z y) ( x) 2. If (x y) ( y z) are both clauses, add clause (x z) (which is implied). 3. Repeat. If no contradiction emerges satisfiable. O(n 2 ) repetitions of step 2 since only 2 literals/clause. Proof of correctness: omitted 6

P vs. NP We would like to solve problems in NP efficiently. We know P NP. Problems in P can be solved fairly quickly. What is the relationship between P and NP? 7

NP and Exponential Time Claim: NP k TIME(2 nk ) Of course, this gets us nowhere near P. Is P = NP? i.e., do all the NP problems have polynomial time algorithms? It doesn t feel that way but as of today there is no NP problem that has been proven to require exponential time! 8

The Strange, Strange World if P = NP Many apparently hard DECISION PROBLEMS are actually easy! Thousands of important languages can be decided in polynomial time, e.g. SATISFIABILITY TRAVELLING SALESMAN HAMILTONIAN CIRCUIT MAP COLORING But not just DECISION problems but also SEARCH and OPTIMIZATION problems would also be easy if P = NP 9

If P = NP, then many apparently hard SEARCH PROBLEMS are easy! Every reasonable search problem could be solved in polynomial time. reasonable solutions can be recognized in polynomial time (and are of polynomial length) SAT SEARCH: Given a satisfiable boolean formula, find a satisfying assignment. FACTORING: Given a natural number (in binary), find its prime factorization. NASH EQUILIBRIUM: Given a two-player game, find a Nash equilibrium. Proof: Use binary search! 10

If P = NP, Optimization becomes easy Every reasonable optimization problem can be solved in polynomial time. Optimization problem maximize (or minimize) f(x) subject to certain constraints on x Reasonable f and constraints are poly-time MIN-TSP: Given a TSP instance, find the shortest tour. SCHEDULING: Given a list of assembly-line tasks and dependencies, find the maximum-throughput scheduling. PROTEIN FOLDING: Given a protein, find the minimum-energy folding. CIRCUIT MINIMIZATION: Given a digital circuit, find the smallest equivalent circuit. 11

How to solve Optimization problems quickly if P=NP Use binary search to find the maximum value M such that, for some x, f(x) M Any such question is there an x such that f(x) M? can be answered quickly because the corresponding DECISION problem is easy Then search for such an x which is easy to do since SEARCH is easy 12

If P = NP, Secure Cryptography becomes impossible Cryptography: Every encryption algorithm can be broken in polynomial time. Given an encryption z, find the corresponding decryption key K and message m is an NP search problem. Take CS127. 13

If P = NP, Artificial Intelligence becomes easy Artificial Intelligence: Learning is easy. Given many examples of some concept (e.g. pairs (image1, dog ), (image2, person ),...), classify new examples correctly. Turns out to be equivalent to finding a short classification rule consistent with examples. Take CS228. 14

If P = NP, Even Mathematics Becomes Easy! Mathematical Proofs: Can always be found in polynomial time (in their length) if P = NP. SHORT PROOF: Given a mathematical statement S and a number n (in unary), decide if S has a proof of length at most n (and, if so, find one). An NP problem! cf. letter from Gödel to von Neumann, 1956. 15

Gödel s Letter to Von Neumann, 24 years before NP was defined [φ(n) = time required for a TM to determine whether a formula has a proof of length n]... If there really were a machine with φ(n) k n (or even k n 2 ) this would have consequences of the greatest importance. Namely, it would obviously mean that in spite of the undecidability of the Entscheidungsproblem, the mental work of a mathematician concerning Yes-or-No questions could be completely replaced by a machine.... It would be interesting to know, for instance, the situation concerning the determination of primality of a number and how strongly in general the number of steps in finite combinatorial problems can be reduced with respect to simple exhaustive search.... 16

The World if P NP? Q: If P NP, can we conclude anything about any specific problems? Idea: Try to find a hardest NP language. Just like A TM was the hardest Turing-recoginizable language. Want L NP such that L P iff every NP language is in P. 17

Polynomial-time Reducibility Def: L 1 P L 2 iff there is a polynomial-time computable function f : Σ 1 Σ 2 s.t. for every x Σ 1, x L iff f(x) L 2. Proposition: If L 1 P L 2 and L 2 P, then L 1 P. Proof: 18

Lecture 14: Polynomial Reductions, N P-Completeness, and Cook s Theorem 5 Harvard CS 121 & CSCI E-121 November 19, 2013 L 1 P L 2 L 1 p L 2 Σ 1 f Σ 2 L 1 L 2 x L 1 f(x) L 2 x / L 1 f(x) / L 2 x L 1 f(x) L 2 x L 1 f(x) L 2 f computable in polynomial time f computable in polynomial time L 2 P L 1 P. L 2 P L 1 P. 19

NP-Completeness Def: L is NP-complete iff 1. L NP and 2. Every language in NP is reducible to L in polynomial time. ( L is NP-hard ) Prop: Let L be any NP-complete language. Then P = NP if and only if L P. 20

Cook Levin Theorem (Stephen Cook 1971, Leonid Levin 1973) Theorem: SAT (Boolean satisfiability) is NP-complete. Proof: Need to show that every language in NP reduces to SAT (!) Proof later. 21

Cook, Symposium on Theory of Computing, 1971 22

Levin, Universal Search Problems, 1973 Several well-known large-scale problems of the sequential search type are discussed, and it is proved that those problems can be solved only in the time that it takes to solve any problems of the indicated type, in general. 23