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

Similar documents
CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

Final exam study sheet for CS3719 Turing machines and decidability.

3130CIT Theory of Computation

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

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

NP Complete Problems. COMP 215 Lecture 20

Introduction to Complexity Theory

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

NP Completeness and Approximation Algorithms

CS154, Lecture 13: P vs NP

Lecture Notes 4. Issued 8 March 2018

Correctness of Dijkstra s algorithm

Design and Analysis of Algorithms

6.045 Final Exam Solutions

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

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

Exam Computability and Complexity

Lecture 4: NP and computational intractability

Show that the following problems are NP-complete

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

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

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

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

CS154, Lecture 13: P vs NP

CS21 Decidability and Tractability

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

Chapter 34: NP-Completeness

CS 311 Sample Final Examination

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

NP and NP Completeness

Introduction. Pvs.NPExample

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Lecture 23: More PSPACE-Complete, Randomized Complexity

BBM402-Lecture 11: The Class NP

Theory Bridge Exam Example Questions

Turing Machines and Time Complexity

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

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

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

Approximation Algorithms

Spring Lecture 21 NP-Complete Problems

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Intro to Theory of Computation

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

CSE 135: Introduction to Theory of Computation NP-completeness

Lecture 16: Time Complexity and P vs NP

Algebraic Dynamic Programming. Solving Satisfiability with ADP

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Final Exam Version A December 16, 2014 Name: NetID: Section: # Total Score

Essential facts about NP-completeness:

Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3

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?

Regular Languages and Finite Automata

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Non-Deterministic Time

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

NP-Complete Reductions 2

CS 6505, Complexity and Algorithms Week 7: NP Completeness

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

6-1 Computational Complexity

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Complexity, P and NP

Theory of Computation Time Complexity

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

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

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

A An Overview of Complexity Theory for the Algorithm Designer

Answers to the CSCE 551 Final Exam, April 30, 2008

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

NP-Completeness. NP-Completeness 1

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Automata Theory CS Complexity Theory I: Polynomial Time

The Cook-Levin Theorem

Review of unsolvability

1 More finite deterministic automata

NP-Complete Reductions 1

CSE 105 THEORY OF COMPUTATION

Lecture 24: Randomized Complexity, Course Summary

Theory of Computation Lecture 1. Dr. Nahla Belal

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

NP, polynomial-time mapping reductions, and NP-completeness

SAT, NP, NP-Completeness

Midterm II : Formal Languages, Automata, and Computability

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Detecting Backdoor Sets with Respect to Horn and Binary Clauses

NP-Completeness Part II

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 2 : Regular Expressions & DFAs

CS/ECE 374 Final Exam Study Problems Fall 2016

Solutions to Old Final Exams (For Fall 2007)

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

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

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

CS 5114: Theory of Algorithms

SOLUTION: SOLUTION: SOLUTION:

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

Transcription:

CS 301 - Lecture 29 P, NP, and NP-Completeness Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata Equivalence of NFA and DFA Regular Expressions and Regular Grammars Properties of Regular Languages Languages that are not regular and the pumping lemma Context Free Languages Context Free Grammars Derivations: leftmost, rightmost and derivation trees Parsing, Ambiguity, Simplifications and Normal Forms Nondeterministic Pushdown Automata Pushdown Automata and Context Free Grammars Deterministic Pushdown Automata Pumping Lemma for context free grammars Properties of Context Free Grammars Turing Machines Definition, Accepting Languages, and Computing Functions Combining Turing Machines and Turing s Thesis Turing Machine Variations, Universal Turing Machine, and Linear Bounded Automata Recursive and Recursively Enumerable Languages, Unrestricted Grammars Context Sensitive Grammars and the Chomsky Hierarchy Computational Limits and Complexity Computability and Decidability Complexity The class P P = DTIME( n k ) for all k Polynomial time Type of deterministic machine no longer matters Adding more tapes changes k for a particular problem, but still polynomial All tractable problems The class NP NP = NTIME( n k ) for all k Non-Deterministic Polynomial time 1

Observation: Open Problem: P = NP? P NP Deterministic Polynomial Non-Deterministic Polynomial WE DO NOT KNOW THE ANSWER Why Does P = NP Matter? From Garey and Johnson Computers and Intractability Function 10 20 30 40 50 60 Our Three Classic Problems: Satisfiability Hamiltonian Path N 0.0001 s 0.0002 s 0.0003 s 0.0004 s 0.0005 s 0.0006 s N^2 0.0001 s 0.0004 s 0.0009 s 0.0016 s 0.0025 s 0.0036 s N^5 0.1 s 3.2 s 24.3 s 1.7 min 5.2 min 13.0 min 2^N 0.001 s 1 s 17.9 min 12.7 days 3^N 0.059 s 58 min 6.5 years 3855 centuries 35.7 years 2 X 10^8 centuries Common Run Times for Representative Algorithms 366 centuries 10^13 centuries Clique All can be solved in polynomial time using non-deterministic Turing machines. Could they be solved in polynomial time using deterministic Turing machines? 2

Polynomial Time Reductions Polynomial Computable function f : w For any computes in polynomial time f (w) Language A is polynomial time reducible to language B if there is a polynomial computable function such that: f w A f ( w) B Theorem: Suppose that is polynomial reducible to. If then. B P A A P B Theorem: 3SAT is polynomial time reducible to CLIQUE Proof: Let M be the machine to accept B Machine to accept w A in polynomial time: On input : 1. Compute f (w) 2. Run on input f (w) M Proof: give a polynomial time reduction of one problem to the other 3

Clique: 3CNF formula: A 5-clique ( x1 x2 x3) ( x3 x5 x6) ( x3 x6 x4) ( x4 x5 x6) Each clause has three literals CLIQUE = { < G, k > : Given a graph does G contains a -clique} k Again, no obvious deterministic polynomial time algorithm.. G Language: 3SAT ={ w : w is a satisfiable 3CNF formula} ( x1 x1 x2) ( x1 x2 x2) ( x1 x2 x3) x1 x x 2 2 x = 1 x 1 2 = 0 x = 1 3 ( x1 x1 x2) ( x1 x2 x2) ( x1 x2 x3) x1 x x 2 2 x 2 x 2 x 2 x 3 x 2 x 3 4

Theorem: Vertex Cover is polynomial time reducible to CLIQUE Clique: A 5-clique Proof: give a polynomial time reduction of one problem to the other CLIQUE = { < G, k > : Given a graph does G contains a -clique} k Again, no obvious deterministic polynomial time algorithm.. G Reduction: Given a Graph G, define its complement Gc All vertices in G are vertices in Gc. An edge (u,v) is in Gc if and only if (u,v) is not an edge in G. 1) Convert G into Gc an easy step. 2) Ask whether Gc has a clique of size K? Cliques and Covers: Let V1 = the Clique found in Gc. Claim (V V1) is a cover in G. Pick an arbitrary edge (u,v) in G. Suppose neither u or v is in (V-V1). Both u and v are V1 Both u and v are in a clique in Gc there must be an edge (u,v) in Gc there must not be an edge (u,v) in G But (u,v) was an edge in G! 5

NP-Completeness A problem is NP-complete if: Theorem: (ANY PROBLEM IN NP) is polynomial time reducible to CLIQUE It is in NP Every NP problem is reduced to it (in polynomial time) Clique is an NP-complete problem. Solve Clique in polynomial time and you solve all NP problems in polynomial time. Observation: If we can solve any NP-complete problem in Deterministic Polynomial Time (P time) then we know: P = NP Observation: If we prove that we cannot solve an NP-complete problem in Deterministic Polynomial Time (P time) then we know: P NP 6

Cook s Theorem: The satisfiability problem is NP-complete Observations: It is unlikely(??) that NP-complete problems are in P Sketch of Proof: Convert a Non-Deterministic Turing Machine to a Boolean expression in conjunctive normal form The NP-complete problems have exponential time algorithms Approximations of these problems are in P Other NP-Complete Problems: The Traveling Salesperson Problem Vertex cover Hamiltonian Path Vertex Cover = { < G, k > : Given a graph G does G contains a size cover? } k A cover is a set of vertices in G such that for every edge (u,v) in G, at least one of u and v belongs to G. All the above are reduced to the satisfiability problem 7

Where to Go From Here? The View We Have From CS 301 NP Where to Go From Here? NP Hard: drop requirement problem is in NP, but still as hard as an NP-complete problem. RP: Randomized Computations PSPACE: Polynomial Space Incorporating distributed computations. P See Papadimitriou, Computational Complexity We have established a starting point for a very rich analysis of complexity in both time and space. Where to Go From Here? A larger view of complexity theory Read What s Next Linz Chapter 1,2.1, 2.2, 2.3, (skip 2.4), 3, 4, 5, 6.1, 6.2, (skip 6.3), 7.1, 7.2, 7.3, (skip 7.4), 8, 9, 10, 11, 12.1, 12.2, (skip 12.3, 12.4, 12.5, 13), 14.1, 14.2, and 14.3 JFLAP Chapter 1, 2.1, (skip 2.2), 3, 4, 5, 6, 7, (skip 8), 9, (skip 10), 11 Next Lecture Topics Review for Final Exam Final exam Friday 12/19 Closed book, but you may bring one sheet of 8.5 1 inch paper with any notes you like. Homework Homework 15 (repeat of previous homework problems) Due Today Homework 16 = study for the final!! 8