CSE 135: Introduction to Theory of Computation NP-completeness

Similar documents
CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP

Time Complexity. CS60001: Foundations of Computing Science

Theory of Computation Time Complexity

CISC 4090 Theory of Computation

Chapter 7: Time Complexity

Intro to Theory of Computation

Computability Theory

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

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?

Lecture 16: Time Complexity and P vs NP

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

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

1 Non-deterministic Turing Machine

P and NP. Or, how to make $1,000,000.

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

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

BBM402-Lecture 11: The Class NP

Lecture 19: Finish NP-Completeness, conp and Friends

The Cook-Levin Theorem

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

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

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

CSE 105 THEORY OF COMPUTATION

Lecture 3: Nondeterminism, NP, and NP-completeness

Computational Models Lecture 11, Spring 2009

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring l. Blum TIME COMPLEXITY AND POLYNOMIAL TIME;

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

Intro to Theory of Computation

SAT, NP, NP-Completeness

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

Complexity (Pre Lecture)

NP and NP Completeness

NP-Completeness and Boolean Satisfiability

CSE 105 THEORY OF COMPUTATION

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

22c:135 Theory of Computation. Analyzing an Algorithm. Simplifying Conventions. Example computation. How much time does M1 take to decide A?

NP-Complete Reductions 1

NP and Computational Intractability

Finish K-Complexity, Start Time Complexity

NP-Complete Problems. More reductions

Computability Theory

Chapter 2 : Time complexity

NP Complete Problems. COMP 215 Lecture 20

Intractable Problems [HMU06,Chp.10a]

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

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Computability and Complexity CISC462, Fall 2018, Space complexity 1

CS154, Lecture 17: conp, Oracles again, Space Complexity

Essential facts about NP-completeness:

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

NP-Complete problems

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

NP-Completeness. Until now we have been designing algorithms for specific problems

1. Introduction Recap

NP-completeness. Chapter 34. Sergey Bereg

NP Completeness and Approximation Algorithms

Advanced Topics in Theoretical Computer Science

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

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

Introduction. Pvs.NPExample

Definition: conp = { L L NP } What does a conp computation look like?

Design and Analysis of Algorithms

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

Non-Deterministic Time

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class

1 Computational problems

SAT, Coloring, Hamiltonian Cycle, TSP

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Complexity, P and NP

Review of unsolvability

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

SOLUTION: SOLUTION: SOLUTION:

About the impossibility to prove P NP or P = NP and the pseudo-randomness in NP

Computational Complexity

Recap from Last Time

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

conp, Oracles, Space Complexity

Complexity: moving from qualitative to quantitative considerations

Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Introduction to Complexity Theory

Computability and Complexity

NP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard

CSC 373: Algorithm Design and Analysis Lecture 18

Correctness of Dijkstra s algorithm

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

On the Computational Hardness of Graph Coloring

Theory of Computation

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

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

NP-Completeness Part II

Computability and Complexity

CS151 Complexity Theory. Lecture 1 April 3, 2017

3130CIT Theory of Computation

Transcription:

CSE 135: Introduction to Theory of Computation NP-completeness Sungjin Im University of California, Merced 04-15-2014

Significance of the question if P? NP Perhaps you have heard of (some of) the following terms: NP, NPC, P, NP-hard, co-np, EXP. And the question if P = NP or not.

Significance of the question if P? NP Why do you need to care about P? NP?

Significance of the question if P? NP Why do you need to care about P? NP? A central question in computer science and mathematics.

Significance of the question if P? NP Why do you need to care about P? NP? A central question in computer science and mathematics. A lot of practical implications.

Significance of the question if P? NP Why do you need to care about P? NP? A central question in computer science and mathematics. A lot of practical implications. Problems in different complexity classes may have different challenges.

Significance of the question if P? NP Why do you need to care about P? NP? A central question in computer science and mathematics. A lot of practical implications. Problems in different complexity classes may have different challenges. NP, NPC problems are widely found in practice.

Significance of the question if P? NP The Millennium Prize Problems are seven problems in mathematics that were stated by the Clay Mathematics Institute in 2000. As of July 2013, six of the problems remain unsolved. A correct solution to any of the problems results in a US $1,000,000 prize (sometimes called a Millennium Prize) being awarded by the institute. The Poincare conjecture was solved by Grigori Perelman, but he declined the award in 2010. The question P? NP is the first in the list... (source: wikipedia)

Class P Definition P is the class of languages that are decidable in polynomial time on a deterministic single-tape Turing machine. In other words, P = k Time(n k ) Motivation: To define a class of problems that can be solved efficiently. P is invariant for all models of computation that are polynomially equivalent to the deterministic single-tape Turing Machine. P roughly corresponds to the class of problems that are realistically solvable on a computer.

Class P Justification P is invariant for all models of computation that are polynomially equivalent to the deterministic single-tape Turing Machine. Example. Theorem Let t(n) be a function, where t(n) n. Then every t(n) time multitape Turing machine has an equivalent O(t 2 (n)) time single-tape Turing machine. In fact, it can be shown that all reasonable determinitic computational models are polynomially equivalent.

Class P Definition P is the class of languages that are decidable in polynomial time on a deterministic single-tape Turing machine. In other words, P = k Time(n k ) Hence, a language is in P if and only if one can write a pseudo-code that decides the language. (The code must terminate for any input).

Class P Examples PATH = {< G, s, t > G is a directed graph that has a directed path from s to t}. Every context-free language.

Class NP Consider the following problem of testing whether a directed graph contains a Hamiltonian path connecting two given nodes. A Hamiltonian path in a directed graph G is a directed path that goes through each node exactly once. HAMPATH = {< G, s, t > G is a directed graph with a Hamiltonian path from s to t}. We are not aware of any algorithm that decides HAMPATH in polynomial time. But we know a brute-force algorithm finds a s-t Hamiltonian path in exponential time. Also we know that the solution can be easily verified.

Class NP Verifier Although we do not know an instance (string) w is in HAMPATH or not, if it is the case, then there is a proof here obviously, a s-t Hamiltonian path. Can we check it efficiently (in polynomial time)? Absolutely! However, not all problems are polynomially verifiable. Think about HAMPATH. How can we be convinced that a given graph has no s-t Hamiltonian path?

Class NP Polynomial time Verifier Definition A verifier for a language A is an algorithm V, where A = {w V accepts < w, c > for some string c} (c is called a certificate or proof). We measure the time of a verifier only in terms of the length of w, so a polynomial time verifier runs in polynomial time in the length of w. A language A is polynomially verifiable if it has a polynomial time verifier. Note that c has polynomial length in w.

Class NP Polynomial time Verifier Definition NP is the class of languages that have polynomial time verifiers.

Class NP Polynomial time Verifier

Class NP Polynomial time Verifier The term NP comes from nondeterminitic polynomial time and is derived an alternative characterization by using nondeterministic polynomial time Turing machines. Theorem A language is in NP iff it is decided by some nondeterministic polynomial time Turing machine. Proof. ( ) Convert a polynomial time verifier V to an equivalent polynomial time NTM N. On input w of length n: Nondeterministically select string c of length at most n k (assuming that V runs in time n k ). Run V on input < w, c >. If V accepts, accept; otherwise, reject.

Class NP Theorem A language is in NP iff it is decided by some nondeterministic polynomial time Turing machine. Proof. ( ) Convert a polynomial time NTM N to an equivalent polynomial time verifier V. On input w of length n: Simulate N on input w, treating each symbol of c as a description of the nondeterministic choice to make at each step. If this branch of N s computation accepts, accept; otherwise, reject.

Class NP Examples A clique is an undirected graph is a subgraph, wherein every two nodes are connected by an edge. A k-clique is a clique that contains k nodes. CLIQUE = {< G, k > G is an undirected graph with a k-clique} Lemma CLIQUE is in NP. Proof. Let w =< G, k >. The certificate c is a k-clique. Can easily test if c is a clique in polynomial time in w and c, and has k nodes.

Class NP Examples HAMPATH = {< G, s, t > G is a directed graph with a Hamiltonian path from s to t}. Lemma HAMPATH is in NP.

P versus NP? Either of the following two must be true: P = NP or P NP. We know that NP EXPTIME = k TIME(2 nk ) But we do not even know if NP EXPTIME or NP EXPTIME

NP-completeness Cook-Levin Theorem Most researchers, however, belive that P NP becuase of the existence of some problems that capture the entire NP class. A Boolean formula is an expression involving Boolean variables and operations. For example, Φ = ( x y) (x z) is a boolean formula. We say a boolean formula is satisfiable if some assignment of 0s and 1s to the variables makes the formula evaluate to 1. Note that Φ is satisfialbe (x = 0, y = 1, z = 0). Satisfiability problem (SAT) SAT = {< Φ > Φ is a satisfiable Boolean formula} Theorem (Cook-Levin Theorem) SAT P iff P = NP.

NP-completeness Polynomial Time Reducibility Definition A function f : Σ Σ is a polynomial time computable function if some polynomial time Turing machine M exists that halts with just f (w) on its tape, when started on any input w. For simplicity, you can use RAM instead of Turing machine here.

NP-completeness Polynomial Time Reducibility Definition Language A is polynomial time mapping reducible, or simply polynomial time reducible, to language B, written A p B, if a polynomial time computable function f : Σ Σ exists, where for every w, w A f (w) B The function is called the polynomial time reduction of A to B.

NP-completeness Polynomial Time Reducibility Theorem If A P B and B P, then A P.

NP-completeness Polynomial Time Reducibility Theorem If A P B and B P, then A P. Proof. B P there is a poly-time algorithm M that decides B. A P B there is a polynomial time reduction f from A to B. We give an algorithm N that decides A: On input w, Compute f (w). Run M on input f (w) and output whatever M outputs. We need to show two: Correctness: w A iff f (w) B iff M accepts f (w). Also note that N always terminates. N runs in polynomial time: computing f (w) takes polynomial time in w. So f (w) is polynomial in w = n, and M is a poly-time algorithm.

NP-completeness Definition Definition A language B is NP-complete if it satisfies two conditions: 1. B is in NP, and 2. for every A NP, A P B.

NP-completeness Definition Definition A language B is NP-complete if it satisfies two conditions: 1. B is in NP, and 2. for every A NP, A P B. Theorem If B is NPC (NP-complete) and B P, then P = NP.

NP-completeness Definition Let s say that B NPC if B is NP-complete. Theorem A language C is NP-complete if B P C for some B NPC, and C NP.

NP-completeness Cook-Levin Theorem Theorem SAT is NP-complete.

NP-completeness NPC derivation tree Theorem SAT is NP-complete.

NP-completeness NPC derivation tree Suppose that we know 3SAT is NPC. Then we can show that CLIQUE is also NPC. A literal is a Boolean variable or a negated Boolean variable, as in x or x. A clause is several literals connected with s, as in x 1 x 2 x 4. A Boolean formula is in conjunctive normal form, or cnf-formula, if it consists of several clauses connected with s. It is a 3cnf-formaula if all the clauses have three literals, as in (x 1 x 1 x 2 ) ( x 1 x 2 x 2 ) ( x 1 x 2 x 2 )

NP-completeness NPC derivation tree Theorem CLIQUE is NPC.