CSCI 2670 Introduction to Theory of Computing December 2, 2004.

Slides:



Advertisements
Similar presentations
Complexity Classes: P and NP
Advertisements

 2004 SDU Lecture17-P,NP, NPC.  2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
Complexity 25-1 Complexity Andrei Bulatov #P-Completeness.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
Graphs 4/16/2017 8:41 PM NP-Completeness.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
NP-complete and NP-hard problems
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Clique Cover Cook’s Theorem 3SAT and Independent Set
1 The Cook-Levin Theorem Zeph Grunschlag. 2 Announcements Last HW due Thursday Please give feedback about course at oracle.seas.columbia.edu/wces oracle.seas.columbia.edu/wces.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CSC401 – Analysis of Algorithms Chapter 13 NP-Completeness Objectives: Introduce the definitions of P and NP problems Introduce the definitions of NP-hard.
The Class NP Lecture 39 Section 7.3 Mon, Nov 26, 2007.
1 P P := the class of decision problems (languages) decided by a Turing machine so that for some polynomial p and all x, the machine terminates after at.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
P Vs NP Turing Machine. Definitions - Turing Machine Turing Machine M has a tape of squares Each Square is capable of storing a symbol from set Γ (including.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
NP-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
Complexity ©D.Moshkovitz 1 Our First NP-Complete Problem The Cook-Levin theorem A B C.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
NP-Completeness A problem is NP-complete if: It is in NP
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
Richard Anderson Lecture 26 NP-Completeness
Intro to Theory of Computation
Intro to Theory of Computation
NP-Complete Problems.
CS154, Lecture 13: P vs NP.
CSE 589 Applied Algorithms Spring 1999
Presentation transcript:

CSCI 2670 Introduction to Theory of Computing December 2, 2004

2 Agenda Yesterday –The Class NP Today –NP-completeness

December 2, Announcement If you want me to have a review session for the final exam, please me your exam schedule

December 2, NP-completeness A problem C is NP-complete if finding a polynomial-time solution for C would imply P=NP Definition: A language B is NP-complete if it satisfies two conditions: 1.B is in NP, and 2.Every A in NP is polynomial time reducible to B

December 2, Cook-Levin theorem SAT = { |B is a satisfiable Boolean expression} Theorem: SAT is NP-complete –If SAT can be solved in polynomial time then any problem in NP can be solved in polynomial time

December 2, Proof of Cook-Levin theorem First show that SAT is in NP –Easy The show that SAT  P implies P = NP –Proof converts a non-deterministic Turing machine M with input w into a Boolean expression φ –M accepts string w iff φ is satisfiable – is converted into φ in polynomial time

December 2, Variables in proof of Cook-Levin Thm x i,j,s is true if tape position i contains symbol s at step j of computation –O(p(n) 2 ) variables H i,k is true if M’s tape head is at position i at step k of computation –O(p(n) 2 ) variables Q q,k is true if M is in state q at step k of the computation –O(p(n)) variables

December 2, Boolean expression Using the variables T i,j,k, H i,k, and Q q,k, Cook & Levin developed a Boolean expression that is satisfiable if and only if M accepts w –Expression reflects proper behavior of M Q start,0 ensures starts in start state H 0,0 ensures starts with tape head at start of tape T i,j,k   T i,j’,k ensures one symbol per tape cell Etc…

December 2, Purpose of Boolean expression If the Boolean expression in the proof of the Cook-Levin theorem can evaluate to TRUE then –Starting at the start state with w on the tape, M can take steps based on the transition function and end at the accept state –I.e., M accepts w If the Boolean expression is unsatisfiable, then M rejects w

December 2, Length of Boolean expression O((log p(n)) p(n) 2 ) Since p(n) is polynomial in the length of the input, so is the Boolean expression If the satisfiability of the expression can be determined in polynomial time, we can determine in polynomial time whether M accepts or rejects w –Every problem in NP would be in P if SAT is in P

December 2, Another NP-complete problem 3SAT –The Boolean expression must be in a specific form called 3-cnf Conjunctive normal form –A literal is a Boolean variable or the negation of a Boolean variable –A clause is the disjunction (OR) of literals –A Boolean formula is in cnf if it is the conjunction (AND) of clauses It is 3-cnf if all the clauses have 3 literals

December 2, Importance of Cook-Levin theorem Cook & Levin proved that SAT is NP- complete –If SAT can be solved in polynomial time, then any problem in NP can be solved in polynomial time The showed that any problem in NP can be polynomially reduced to the SAT problem The proof that 3SAT is NP-complete is similar –Generate a 3-cnf formula from a TM

December 2, Polynomial functions 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.

December 2, Polynomial time reducible Definition: Language A is polynomial time reducible to language B, written A ≤ P B, if a polynomial time computable function f:Σ *  Σ * exists where for every w, w  A iff f(w)  B f f

December 2, Reductions & NP-completeness Theorem: If A ≤ P B and B  P, then A  P. Proof: Let M be the polynomial time algorithm that decides B and let f be the polynomial reduction from A to B. Consider the TM N N = “On input w 1.Compute f(w) 2.Run M on f(w) and output M’s result” Then N decides A in polynomial time.

December 2, Implications of NP-completeness Theorem: If B is NP-complete and B  P, then P = NP. Theorem: If B is NP-complete and B≤ P C for some C in NP, then C is NP- complete

December 2, Showing a problem in NP-complete Two steps to proving a problem L is NP-complete –Show the problem is in NP Demonstrate there is a polynomial time verifier for the problem –Show some NP-complete problem can be polynomially reduced to L

December 2, NP-completeness proof CLIQUE is NP-complete –A clique in an undirected graph is a subgraph with every pair of nodes connected by an edge CLIQUE = { | G is an undirected graph with a k-clique}

December 2, Example This graph has a 4-clique

December 2, Proving CLIQUE is NP-complete 1.Show CLIQUE is in NP 2.Show some NP-complete problem can be polynomially reduced to CLIQUE

December 2, Is CLIQUE in NP? Yes Given a subset V’ of V –Verify |V’|=k O(k) time –Verify every pair of vertices in |V’| have an edge in E O(k 2 |E|) time

December 2, Reducing 3SAT to CLIQUE Create a polynomial time function that converts a 3-cnf Boolean formula to a graph –The graph will have a k-clique if and only if the formula is satisfiable –Cliques in the graph correspond to satisfying assignments of truth values to variables in the formula –Structures in the graph mimic behavior of clauses

December 2, SAT reduction to CLIQUE Start with any 3-cnf formula with k clauses φ = (a 1  b 1  c 1 )  (a 2  b 2  c 2 )  …  (a 2  b 2  c 2 ) Create a graph with 3k nodes –One node for each literal in φ –A single literal may have more than one node A pair of nodes x i and x j has an edge if i ≠ j and x i ≠ x j

December 2, Example φ = (x  y  y)  (x  y  y)  (x  x  y) x y y xyy x x y Q: Is φ satisfiable?A: Yes: x = y = 1

December 2, Correctness of construction Need to show the formula is satisfiable iff the graph has a k- clique If the formula is satisfiable, there is a way to assign values to the variables such that at least one literal is true in each clause –The corresponding nodes will create a k- clique

December 2, Correctness of construction Need to show the formula is satisfiable iff the graph has a k- clique By construction, any k-clique will contain one node from each clause and will not contain both x and x for any variable x –Assigning the variable corresponding to each node the value true will result in one literal in each clause being true

December 2, Are we done? We have shown that CLIQUE is in NP We have found a reduction from 3SAT to CLIQUE –The 3-cnf formula is satisfiable iff the graph has a k-clique What’s left? –Demonstrate the reduction is polynomial –|V| = # of literals in φ –|E| ≤ (|V|-3)(|V|-6)(|V|-9)…(3) = O(|V| 2 ) =O( (# of literals in φ) 2 )

December 2, Summary To show a language L is NP-complete 1.Demonstrate L is in NP 2.Find a language C that is known to be NP-complete 3.Create a function f from C to L 4.Demonstrate that if x is in C then f(x) is in L 5.Demonstrate that if f(x) is in L then x is in C 6.Demonstrate f is computable in polynomial time