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

Similar documents
CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP

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

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

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

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

CSE 135: Introduction to Theory of Computation NP-completeness

Chapter 7: Time Complexity

Essential facts about NP-completeness:

Intro to Theory of Computation

Time Complexity. CS60001: Foundations of Computing Science

NP Complete Problems. COMP 215 Lecture 20

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?

Theory of Computation Time Complexity

NP-Complete Reductions 1

Lecture 3: Nondeterminism, NP, and NP-completeness

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

Lecture 19: Finish NP-Completeness, conp and Friends

CISC 4090 Theory of Computation

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

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

CSE 105 THEORY OF COMPUTATION

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

Complexity (Pre Lecture)

The Cook-Levin Theorem

NP-Completeness and Boolean Satisfiability

1 Non-deterministic Turing Machine

Lecture 16: Time Complexity and P vs NP

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

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

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

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

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

BBM402-Lecture 11: The Class NP

Lecture 20: conp and Friends, Oracles in Complexity Theory

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

Lecture 18: PCP Theorem and Hardness of Approximation I

CSCI3390-Lecture 16: NP-completeness

SOLUTION: SOLUTION: SOLUTION:

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

NP Completeness. Richard Karp, 1972.

CS21 Decidability and Tractability

CSE 105 THEORY OF COMPUTATION

Chapter 2 : Time complexity

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

Complexity Classes V. More PCPs. Eric Rachlin

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

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

Finish K-Complexity, Start Time Complexity

1. Introduction Recap

NP Completeness and Approximation Algorithms

SAT, NP, NP-Completeness

conp, Oracles, Space Complexity

Intractable Problems [HMU06,Chp.10a]

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

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

Lecture 23: More PSPACE-Complete, Randomized Complexity

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

There are two types of problems:

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

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.

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

Lecture 22: PSPACE

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

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

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Recap from Last Time

Correctness of Dijkstra s algorithm

NP-Completeness Part II

A An Overview of Complexity Theory for the Algorithm Designer

Exam Computability and Complexity

1 Computational Problems

Computability and Complexity Theory: An Introduction

Time to learn about NP-completeness!

Computability Theory

NP-Completeness. Sections 28.5, 28.6

Introduction to Advanced Results

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

On the Computational Hardness of Graph Coloring

Notes for Lecture Notes 2

Computability Theory

Non-Deterministic Time

An introduction to Parameterized Complexity Theory

Lecture 24: Randomized Complexity, Course Summary

Introduction. Pvs.NPExample

6.045 Final Exam Solutions

CSE 105 THEORY OF COMPUTATION

Algorithm Design and Analysis

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

NP-completeness. Chapter 34. Sergey Bereg

CSC 1700 Analysis of Algorithms: P and NP Problems

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

Polynomial-time Reductions

Intractable Problems. Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

P, NP, NP-Complete, and NPhard

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

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

Transcription:

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

Polynomial time reduction Definition: A language L is said to be polynomial time reducible or reducible in polynomial time to a language U if the map reduction between them can be computed in polynomial time This is, the time complexity of the Turing machine that computes the reduction mapping is bounded above by a polynomial function in the length of the input string 2

Example of polynomial time reducible languages Definition: A clause is a Boolean formula consisting of a set of Boolean variables connected by the logical or. A Boolean formula is said to be in conjunctive normal form (CNF) if it consists of clauses connected by the logical and. Notations: CNF denotes the set of all conjunctive normal forms whose clauses involve at most Boolean variables SAT denotes the set of all satisfiable Boolean formulas in CNF (Thus, SAT is a subset of CNF)

Example (cont.) Definition: An n-clique in an undirected graph is a fully connected (this is, all-to-all) n-node sub-graph of the graph nclique denotes the set of all undirected graphs possessing an n-clique Theorem 20.1: SAT is reducible to nclique in polynomial time 4

Example (cont.) Proof: Let CNF Define: f f ( φ) = G, and E = {{ x = { φ : φ is a Boolean formula ( n φ = ( x :CNF Graphs whereg i+ j, x + s 1 = ({ x x 1 }:1 2 x,..., x ) ( x n+ }, E), n+ 1 0) x n+ 2 x n+ where n is, from now on, the number of clauses in φ. SAT = { φ : φ CNF φ is satisfiable} Graphs = { G : G is an undirected graph} nclique = { G : G is an undirected graph possessing a n - clique} )} j, s ( i, )(0 i, n i x + s x i+ j 5 )}

Example (cont.) Sub-claim 1: f is a reduction from nclique to SAT x x l l x l i i l l j j i i SAT i l j l l n n ) )(, ( 1 ) ( ) )(, ( ),...,,,..., ( true in each clause is At least one literal is satisfied Each clause in 1 1 = + φ φ 6 SAT x y y y l x y j j i i f y n nclique f nclique f G n n x x x l l l l j i l j i n n j i j i j i 1) 1 )( ( ), ( ),...,,,..., ( )) ( }in y,..., - clique{ an ( ) ( ) ( clique in }is an 1,..., : { ) )(, ( 1 1 n 1 = = = = = + + + + + φ φ φ φ φ

Example (cont.) Sub-Claim 2: f is computable in polynomial time The following Turing machine computes f F= On input w: Sweep across the string verifying that w is in CNF. If w is not in CNF, REJECT. Else, Write the set of all literals in w on tape. For each clause C in w, HALT. For each literal a in C, For each literal b in w but not in C b a If write {a, b} on tape The time complexity of F is bounded above by w 7

The class NP Definition: A language (problem) L is said to be NP (or to be in the class NP) if its best nown time complexity bound is achieved by a nondeterministic decider which, on each input string produces either a polynomial time accepting branch, or its longest rejection branch is polynomially bounded Observation: A direct application of Theorem 18.2 lead us to the conclusion that the transformation of the nondeterministic TM to a deterministic TM will render exponential time complexity 8

NP is often misused NP stands for Nondeterministic Polynomial time and not for Non-polynomial time Non-polynomial time conveys a larger class of problems, including those without any nown NP solution 9

Verifying NP solutions When it comes to recognizing a string, the difference between P and NP is in the overhead imposed by searching for the appropriate accepting computation branch. Indeed, a string in an NP language is accepted in polynomial time whenever the computation starts in the polynomial time accepting branch This idea is at the base of the notion of polynomial time verifiers 10

Verifiers Definition: A verifier for a language L is a decider V so that L can be written as L = { w A*: ( c) V accepts < w, c > } Thus, a verifier is a decider used for expressing membership in L. Such expression acquires the form of the acceptance of a pair of strings, one representing a problem s instance and the other, its solution 11

Showing that a language is NP Verifiers provide a simpler way to demonstrate that a given language belongs to NP: In general, showing that a language is NP amounts to proving that: a) The language is decidable b) There is a polynomial time verifier for the language, this is, the verifier halts in polynomial time 12

Theorem 20.2 : SAT is NP Proof: SAT is decidable (Theorem 19.5). The next TM is a verifier for SAT: V= On input <w, c>, where w is a string representing a Boolean formula and c a string in {0, 1}*, w = c : 1. If w = c 1. Evaluate w in c 2. If w = 1, ACCEPT. If w = 0 REJECT. 2. Else, REJECT. Clearly V is O( w ), and a verifier of SAT since: SAT = { w: ( c {0,1}*) c = w V accepts< w, c > } 1

A non-np problem CLIQUECOMP is described as follows: Let UG be the set of all undirected graphs and N the natural numbers Problem domain: UG x N Problem instance: G in UG, and in N Question: Is it true that G has no -cliques? Verifying that G has no -cliques by exhaustion requires checing an exponentially large number of possibilities. But exhaustion is the only nown method for accomplishing this tas. Thus, no polynomial time verifier is nown for CLIQUECOMP 14

NP-completeness, NP-hardness Definition: A problem (language) L is said to be NP-complete if a) The problem (language) L is NP; and b) Every NP problem (language) is reducible to L in polynomial time Definition: A problem (language) L is said to be NP-hard if a) Every NP problem (language) is reducible to L in polynomial time 15

P=NP? a long-standing open problem It is clear from their definitions that P is a subclass of NP and that NP-complete is a subclass of NP-hard The question of whether the class P is a strict subset of the class NP or an equality disguised as a subset remains unanswered It is claimed that an answer to this question has practical consequences. Indeed, it all depends, as polynomial algorithms of time complexity of the order O( n ), are often as impractical as exponential time methods 16

NP-complete and the P=NP question Coo, Levin, Karp are among the many theoretical computer scientists that have attempted to answer whether P=NP NP-complete languages were introduced by Coo in the 70 s in the midst of these theoretical efforts 17

The Coo-Levin Theorem Theorem 20.: SAT is NP-complete Proof: Let L be an NP language, and D a decider for L. Then, for each w in L, there is a polynomial time computation path induced by D. The size of the tableau described in the proof of Theorem n 19.4 is then, bounded by O( w ), for some n>0. Therefore, the TM Phi in the proof of the same theorem, construct the Boolean formula associated with the tableau in polynomial time, as well. 18

Coo-Levin Theorem (cont.) Let O( w ) be the time complexity of M. Then, the time complexity of Phi is estimated as follows: Step 1: An accepting run of M taes O( w ) time. And writing the tableau taes 2 O ( w ) O( w ) = O( w ) time. Therefore, 2 step 1 is O( w ) Step 2: Writing each of φ cell ( w), φ move ( w), φ acc ( w) demands inspecting the whole tableau, and 2 therefore, the writing taes O( w ); φ (w) is written in O( w ). start 19

More theory Theorem 20.4: If L is polynomial time reducible to U and U is in P, then L is in P. Proof: Let M be a polynomial time decider for U and f a polynomial time reduction map from L to U. Construct: N= On input w: 1. Compute f(w). 2. Run M on f(w) and output whatever M outputs. Clearly, N decides L in polynomial time. 20

The P=NP connection The previous result provides the connection between NP-completeness and the P=NP question. By virtue of the Theorem 20.2, if a polynomial time TM is found for solving an NP-complete problem then P = NP Unfortunately, no such TM has been discovered, so far 21

More theoretical facts Theorem 20.5 : If f and g are polynomial time computable mappings, and the composition f g is well-defined, then f g is computable in polynomial time Proof: Let F and G be the TMs that compute f and g, respectively. Define: C= On input w: Run F on w When F halts, run G on f(w) Halt The time complexity of C is bounded O(F)O(G) which is polynomial 22

More theoretical facts (cont.) Theorem 20.6: If L is polynomial time reducible to U, U is NP and L is in NP-complete, then U is NP-complete Proof: Let f be a polynomial time reduction from L to U and let Z be an NP language. Since L is NP-complete, there is f, polynomial time reduction from Z to L. Let g be the polynomial time reduction from L to U. Then f g is a polynomial time reduction from Z to U. Since, by hypothesis U is NP, U is NP-complete 2

More theoretical facts (cont.) Theorem 20.7: If L is polynomial time reducible to U, and L is in NP-hard, then U is in NP-hard Proof: Let f be a polynomial time reduction from L to U and let Z be an NP language. Since L is NP-hard, there is f, polynomial time reduction from Z to L. Let g be the polynomial time reduction from L to U. Then f g is a polynomial time reduction from Z to U. Therefore, U is NPhard 24

Reduction as a tool The previous theorems are extensively used for determining the complexity class of a problem. In particular, SAT is often used as a reference for NPcomplete problems in the sense that: If A problem is NP and SAT is polynomially reducible to the problem, then the problem itself is NPcomplete A similar technique wors for NP-hard problems 25