Intro to Theory of Computation

Similar documents
Algorithm Design and Analysis

Polynomial-Time Reductions

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Intro to Theory of Computation

NP and Computational Intractability

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

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

SAT, NP, NP-Completeness

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

Algorithms Design & Analysis. Approximation Algorithm

NP and Computational Intractability

Algorithm Design and Analysis

CS154, Lecture 13: P vs NP

CSE 135: Introduction to Theory of Computation NP-completeness

CS154, Lecture 13: P vs NP

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

Chapter 8. NP and Computational Intractability. CS 350 Winter 2018

SAT, Coloring, Hamiltonian Cycle, TSP

Essential facts about NP-completeness:

NP Complete Problems. COMP 215 Lecture 20

Algorithm Design and Analysis

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?

NP and NP Completeness

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

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

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

Lecture 19: Finish NP-Completeness, conp and Friends

Computational Intractability 2010/4/15. Lecture 2

CS 583: Algorithms. NP Completeness Ch 34. Intractability

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

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

NP-Completeness Part II

P, NP, NP-Complete, and NPhard

Theory of Computation Chapter 9

CS21 Decidability and Tractability

CS21 Decidability and Tractability

The Cook-Levin Theorem

Lecture 4: NP and computational intractability

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

Computability and Complexity

NP-Complete problems

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

Design and Analysis of Algorithms

Correctness of Dijkstra s algorithm

Lecture 18: PCP Theorem and Hardness of Approximation I

CSE 421 NP-Completeness

NP-Complete Reductions 1

More NP-Complete Problems

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

Chapter 7: Time Complexity

BBM402-Lecture 11: The Class NP

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

CSC373: Algorithm Design, Analysis and Complexity Fall 2017

NP-Complete Problems. More reductions

Lecture 16: Time Complexity and P vs NP

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

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

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

NP-Completeness. Sections 28.5, 28.6

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Introduction to Complexity Theory

NP completeness and computational tractability Part II

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

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

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

1. Introduction Recap

CSC 373: Algorithm Design and Analysis Lecture 15

COMP 382. Unit 10: NP-Completeness

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

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

NP-Completeness Part II

CISC 4090 Theory of Computation

COMP Analysis of Algorithms & Data Structures

Automata Theory CS Complexity Theory I: Polynomial Time

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

Show that the following problems are NP-complete

On the Computational Hardness of Graph Coloring

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

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Theory of Computation Time Complexity

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

SOLUTION: SOLUTION: SOLUTION:

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

Lecture 15 - NP Completeness 1

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

A An Overview of Complexity Theory for the Algorithm Designer

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

Algebraic Dynamic Programming. Solving Satisfiability with ADP

Lecture 23: More PSPACE-Complete, Randomized Complexity

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

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

NP-Completeness. Subhash Suri. May 15, 2018

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

NP Completeness and Approximation Algorithms

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

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

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

CSC 1700 Analysis of Algorithms: P and NP Problems

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Computability and Complexity Theory: An Introduction

Transcription:

Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions Adam Smith; Sofya Raskhodnikova 4/18/2016 L25.1

The classes P and NP P is the class of languages decidable in polynomial time on a deterministic 1-tape TM: P = k TIME n k. NP is the class of languages that have polynomial-time verifiers. 4/18/2016 L25.3

Classes P, NP, EXP P. Languages for which there is a poly-time algorithm. EXP. Languages for which there is an exponential-time algorithm. NP. Languages for which there is a poly-time verifier. Lemma. P NP. Lemma. NP EXP. Lemma. A language L is in NP iff L can be decided by a polynomial-time nondeterministic TM. 4/18/2016 L25.4

P vs. NP Does P = NP? [Cook 1971, Edmonds, Levin, Yablonski, Gödel] Is the decision problem as easy as the verification problem? Clay $1 million prize. EXP P NP EXP P = NP EXP =NP P If P NP If yes: Efficient algorithms for HamPath, SAT, TSP, factoring Cryptography is impossible* Creativity is automatable If P = NP If no: No efficient algorithms possible for these problems. Consensus opinion on P = NP? Probably no. 4/18/2016 If P NP and NP=EXP L25.5

Classify Problems Desiderata: classify problems according to those that can be solved in polynomial-time and those that cannot. Some problems provably require exponential time (next month): Given a Turing machine, does it halt in at most k steps? Given a board position in an n-by-n generalization of chess, can black guarantee a win? Frustrating news: huge number of fundamental problems have defied classification for decades. Chapters 7.4-7.5 (NP-completeness): Show that these fundamental problems are "computationally equivalent" and appear to be different manifestations of one really hard problem. 6 L25.6

Polynomial-time reductions f: Σ Σ is polynomial-time computable if there is a poly-time TM that, on every input w Σ halts with just f(w) on its tape. f: Σ Σ is a polynomial-time mapping reduction from language A to language B if: f is polytime computable For all w Σ : w A f w B When such a reduction exists, write A P B Polynomial-time reductions are the major tool we have to understand P and NP 4/18/2016 L24.7

Polynomial-time reduction Given languages A and B, A p B if there is a poly-time computable function f, such that for all strings w, w A iff f(w) B. A f B 4/18/2016 L26.8

Implication of poly-time reductions Theorem. If A p B and B P then A P. (So, if A p B and A P then B P.) Theorem. If A p B and B p C then A p C. (Poly-time reductions compose.) 4/18/2016 L26.9

Basic reduction strategies Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets. L25.10

Independent Set Given an undirected graph G, an independent set in G is a set of nodes, which includes at most one endpoint of every edge. INDEPENDENT SET = { G, k G is an undirected graph which has an independent set with k nodes} Is there an independent set of size 6? Yes. independent set Is there an independent set of size 7? No. 11 L25.11

Vertex Cover Given an undirected graph G, a vertex cover in G is a set of nodes, which includes at least one endpoint of every edge. VERTEX COVER= { G, k G is an undirected graph which has a vertex cover with k nodes} Is there vertex cover of size 4? Yes. vertex cover Is there a vertex cover of size 3? No. 12 L25.12

Independent Set and Vertex Cover Claim. S is an independent set iff V S is a vertex cover. Let S be any independent set. Consider an arbitrary edge (u, v). S is independent u S or v S u V S or v V S. Thus, V S covers (u, v). Let V S be any vertex cover. Consider two nodes u S and v S. Then (u, v) E since V S is a vertex cover. Thus, no two nodes in S are joined by an edge S independent set. L25.13

INDEPENDENT SET reduces to VERTEX COVER Theorem. INDEPENDENT-SET p VERTEX-COVER. Proof. On input G, k, where G is an undirected graph and k is an integer, 1. Output G, n k, where n is the number of nodes in G. Correctness: G has an independent set of size k iff it has a vertex cover of size n k. Reduction runs in linear time. L25.14

Reduction from special case to general case Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets. L25.15

Set Cover Given a set U, called a universe, and a collection of its subsets S 1, S 2,, S m, a set cover of U is a subcollection of subsets whose union is U. SET COVER={ U, S 1, S 2,, S m ; k U has a set cover of size k} Sample application. m available pieces of software. U = { 1, 2, 3, 4, 5, 6, 7 } k = 2 S 1 = {3, 7} S 4 = {2, 4} S 2 = {3, 4, 5, 6} S 5 = {5} S 3 = {1} S 6 = {1, 2, 6, 7} Set U of n capabilities that we would like our system to have. The ith piece of software provides the set S i U of capabilities. Goal: achieve all n capabilities using fewest pieces of software. L25.16

VERTEX COVER reduces to SET COVER Theorem. VERTEX-COVER P SET-COVER. Proof. On input G, k, where G = (V, E) is an undirected graph and k is an integer, 1. Output U, S 1, S 2,, S m ; k, where U=E and Correctness: S v = {e E : e incident to v } G has a vertex cover of size k iff U has a set cover of size k. Reduction runs in linear time.. 17 L25.17

Reduction by encoding with gadgets Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets. L25.18

Satisfiability Boolean variables: variables that can take on values T/F (or 1/0) Boolean operations:,, and Boolean formula: expression with Boolean variables and ops SAT = { Φ Φ is a satisfiable Boolean formula} Literal: A Boolean variable or its negation. Clause: OR of literals. Conjunctive normal form (CNF): AND of clauses. C j x 1 x 2 x 3 3SAT = { Φ Φ is a satisfiable Boolean CNF formula, where each clause contains exactly 3 literals} Ex: each corresponds to a different variable Yes: x 1 = true, x 2 = true x 3 = false. x i or x i C 1 C 2 C 3 C 4 x 1 x 2 x 3 x 1 x 2 x 3 x 2 x 3 x 1 x 2 x 3 L25.19

3SAT reduces to INDEPENDENT SET Theorem. 3-SAT P INDEPENDENT-SET. Proof. On input Φ, where Φ is a 3CNF formula, 1. Construct graph G from Φ G contains 3 vertices for each clause, one for each literal. Connect 3 literals in a clause in a triangle. Connect literal to each of its negations. 2. Output G, k, where k is the number of clauses in G. x 1 x 2 x 1 G x 2 x 3 x 3 x 1 x 2 x 4 k = 3 x 1 x 2 x 3 x 1 x 2 x 3 x 1 x 2 x 4 L25.20

3SAT reduces to INDEPENDENT SET Correctness. Let k = # of clauses and l= # of literals in. is satisfiable iff G contains an independent set of size k. Given satisfying assignment, select one true literal from each triangle. This is an independent set of size k. Let S be an independent set of size k. S must contain exactly one vertex in each triangle. Set these literals to true, and other literals in a consistent way. Truth assignment is consistent and all clauses are satisfied. Run time. O(k + l 2 ), i.e. polynomial in the input size. L25.21

Summary Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets: 3-SAT P INDEPENDENT-SET. Transitivity.If X P Y and Y P Z, then X P Z. Proof idea. Compose the two algorithms. Ex: 3-SAT P INDEPENDENT-SET P VERTEX-COVER P SET-COVER. L25.22