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

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

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP

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

3130CIT Theory of Computation

Lecture 16: Time Complexity and P vs NP

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

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

Final exam study sheet for CS3719 Turing machines and decidability.

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

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

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

NP Completeness and Approximation Algorithms

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

Theory Bridge Exam Example Questions

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

NP Complete Problems. COMP 215 Lecture 20

Chapter 7: Time Complexity

Finite Automata. Mahesh Viswanathan

Lecture 19: Finish NP-Completeness, conp and Friends

Turing Machines and Time Complexity

Introduction to Complexity Theory

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

Finish K-Complexity, Start Time Complexity

CS 311 Sample Final Examination

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

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

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

CSE 135: Introduction to Theory of Computation NP-completeness

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

NP and NP Completeness

Lecture Notes 4. Issued 8 March 2018

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

Approximation Algorithms

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

Review of unsolvability

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

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

Non-Deterministic Time

Design and Analysis of Algorithms

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

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

Lecture 3: Nondeterminism, NP, and NP-completeness

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

Algebraic Dynamic Programming. Solving Satisfiability with ADP

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

Show that the following problems are NP-complete

BBM402-Lecture 11: The Class NP

Advanced topic: Space complexity

CSE 105 THEORY OF COMPUTATION

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Spring Lecture 21 NP-Complete Problems

Computability and Complexity

CS21 Decidability and Tractability

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

CS256 Applied Theory of Computation

6.045 Final Exam Solutions

Lecture 7: Polynomial time hierarchy

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Turing machines and linear bounded automata

Intro to Theory of Computation

Correctness of Dijkstra s algorithm

CSE 105 THEORY OF COMPUTATION

Turing machines and linear bounded automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

CS21 Decidability and Tractability

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

The Cook-Levin Theorem

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

Introduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Advanced Topics in Theoretical Computer Science

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

Midterm II : Formal Languages, Automata, and Computability

Introduction. Pvs.NPExample

1. Introduction Recap

NP-Completeness Review

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.

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

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

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Automata Theory CS Complexity Theory I: Polynomial Time

Regular Languages and Finite Automata

Theory of Computation Lecture 1. Dr. Nahla Belal

Exam Computability and Complexity

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

NP-Complete Reductions 2

Question Bank UNIT I

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

CSC 1700 Analysis of Algorithms: P and NP Problems

Complexity Classes V. More PCPs. Eric Rachlin

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

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

Transcription:

CS 301 - Lecture 28 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 Epressions and Regular Grammars Properties of Regular Languages Languages that are not regular and the pumping lemma Contet Free Languages Contet Free Grammars Derivations: leftmost, rightmost and derivation trees Parsing, Ambiguity, Simplifications and Normal Forms Nondeterministic Pushdown Automata Pushdown Automata and Contet Free Grammars Deterministic Pushdown Automata Pumping Lemma for contet free grammars Properties of Contet 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 Contet Sensitive Grammars and the Chomsky Hierarchy Computational Limits and Compleity Computability and Decidability Compleity

Selecting the Right Machine Model Computation Using Turing machine But the choice of machine seems to matter a great deal! Two tapes machines might take fewer steps than one tape machines Non-Deterministic machines might take fewer steps than Deterministic ones Is there a right choice to make?

Selecting the Right Machine If a two-tape machine takes steps, a one tape machine can simulate this in If a non-deterministic machine takes steps, a deterministic one can simulate this in So do we need classes for each machine type??

Theorem: DTIME( n k+ 1 k ) DTIME( n ) DTIME( k+1 n ) DTIME( n k )

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

P {ww} n n { a b }

Some Classic Problems in Computer Science Satisfiability Problem Hamiltonian Path Problem Clique Problem Are these problems in P??

Eample: The Satisfiability Problem Boolean epressions in Conjunctive Normal Form: t 1 t 2 t 3 t k ti = 1 2 3 p Variables Question: is epression satisfiable?

Eample: ( 1 2) ( 1 3 ) Satisfiable: =, 1, 1 1 0 2 = 3 = ( 3 1 2) ( 1 ) = 1

Eample: ( 1 2) 1 2 Not satisfiable

L = { w:epression w is satisfiable} For n variables: L DTIME( 2 n ) eponential Algorithm: search ehaustively all the possible binary values of the variables

Eample: the Hamiltonian Problem s t Question: is there a simple path that passes through all vertices?

s t YES!

A solution: search ehaustively all paths L = {<G,s,t>: there is a Hamiltonian path in G from s to t} L DTIME( n!) DTIME(2 n ) Eponential time Intractable problem

Clique: A 5-clique CLIQUE = { : Given a graph does G contains a -clique} < G, k > G k Again, no obvious deterministic polynomial time algorithm..

Non-Determinism Language class: NTIME(n) NTIME(n) L 1 L L 3 2 A Non-Deterministic Turing Machine accepts each string of length in time O(n) n

Non-Deterministic Polynomial time algorithms: L NTIME( n k )

The class NP NP = NTIME( n k ) for all k Non-Deterministic Polynomial time

Eample: The satisfiability problem L = { w:epression w is satisfiable} Non-Deterministic algorithm: Guess an assignment of the variables Check if this is a satisfying assignment

L = { w:epression w is satisfiable} Time for n variables: Guess an assignment of the variables O(n) Check if this is a satisfying assignment O(n) Total time: O(n)

L = { w:epression w is satisfiable} L NP The satisfiability problem is an NP - Problem

Our Three Classic Problems: Satisfiability Hamiltonian Path Clique All can be solved in polynomial time using non-deterministic Turing machines. Could they be solved in polynomial time using deterministic Turing machines?

Observation: P NP Deterministic Polynomial Non-Deterministic Polynomial

Open Problem: P = NP? WE DO NOT KNOW THE ANSWER

Open Problem: P = NP? Eample: Does the Satisfiability problem have a polynomial time deterministic algorithm? WE DO NOT KNOW THE ANSWER

Polynomial Time Reductions Polynomial Computable function f : For any w computes in polynomial time f (w)

Language A is polynomial time reducible to language B if there is a polynomial computable function f such that: w A f ( w) B

Theorem: Suppose that is polynomial reducible to. B P A If then. Proof: Let M Machine to accept A P be the machine to accept B On input w : A 1. Compute f (w) in polynomial time: 2. Run M on input f (w) B

3CNF formula: ) ( ) ( ) ( ) ( 6 5 4 4 6 3 6 5 3 3 2 1 Each clause has three literals 3SAT ={ : is a satisfiable 3CNF formula} w w Language:

Theorem: 3SAT is polynomial time reducible to CLIQUE Proof: give a polynomial time reduction of one problem to the other

( 1 1 2) ( 1 2 2) ( 1 2 3) 1 2 2 1 1 1 2 2 3

) ( ) ( ) ( 3 2 1 2 2 1 2 1 1 1 1 2 1 2 2 1 2 3 1 0 1 3 2 1 = = =

NP-Completeness A problem is NP-complete if: It is in NP Every NP problem is reduced to it (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

Cook s Theorem: The satisfiability problem is NP-complete Sketch of Proof: Convert a Non-Deterministic Turing Machine to a Boolean epression in conjunctive normal form

Observations: It is unlikely(??) that NP-complete problems are in P The NP-complete problems have eponential time algorithms Approimations of these problems are in P

Other NP-Complete Problems: The Traveling Salesperson Problem Verte cover Hamiltonian Path All the above are reduced to the satisfiability problem

What s Net Read 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 Net Lecture Topics More Compleity Final eam Friday 12/19 Closed book, but you may bring one sheet of 8.5 11 inch paper with any notes you like. Homework Homework 14 Due Today Homework 15 Due Tuesday Homework 16 = study for the final!!