NP-Completeness CS 51 Summer 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AA A A AAA.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

Complexity Classes: P and NP
Cook’s Theorem The Foundation of NP-Completeness.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Lecture 21 NP-complete problems
Complexity class NP Is the class of languages that can be verified by a polynomial-time algorithm. L = { x in {0,1}* | there exists a certificate y with.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
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 )
CS21 Decidability and Tractability
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
1 Polynomial Church-Turing thesis A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
Time Complexity.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
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.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 ≤ L 2 means: For some polynomial time computable map r : x: x L 1 iff r(x)
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Machines with Memory Chapter 3 (Part B). Turing Machines  Introduced by Alan Turing in 1936 in his famous paper “On Computable Numbers with an Application.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
MCS 312: NP Completeness and Approximation algorthms Instructor Neelima Gupta
1 NP-Completeness Poly time algorithm: input size n (in some encoding), worst case running time – O(n c ) for some constant c. Three classes of problems.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
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.
1. 2 Lecture outline Basic definitions: Basic definitions: P, NP complexity classes P, NP complexity classes the notion of a certificate. the notion of.
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.
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.
1 How to establish NP-hardness Lemma: If L 1 is NP-hard and L 1 ≤ L 2 then L 2 is NP-hard.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NP-complete.
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.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
Complexity ©D.Moshkovitz 1 Our First NP-Complete Problem The Cook-Levin theorem A B C.
1 SAT SAT: Given a Boolean function in CNF representation, is there a way to assign truth values to the variables so that the function evaluates to true?
1 Design and Analysis of Algorithms Yoram Moses Lecture 13 June 17, 2010
 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
L is in NP means: There is a language L’ in P and a polynomial p so that L1 ≤ L2 means: For some polynomial time computable map r :  x: x  L1 iff.
Richard Anderson Lecture 26 NP-Completeness
Intro to Theory of Computation
Intro to Theory of Computation
NP-Completeness Proofs
Theory of Computability
Theory of Computability
Chapter 34: NP-Completeness
CS154, Lecture 13: P vs NP.
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Umans Complexity Theory Lectures
Our First NP-Complete Problem
Instructor: Aaron Roth
Intro to Theory of Computation
Presentation transcript:

NP-Completeness CS 51 Summer 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AA A A AAA

CS 512 Cook-Levin Any problem in NP can be – reduced in polynomial time –by a deterministic Turing Machine –to a problem of determining whether a Boolean circuit is satisfiable.

CS 513 Implications Deterministic poly-time algorithm for solving satisfiability implies –Deterministic poly-time algorithm for any problem in NP.

CS 514 Boolean Circuits Theoretical analogue of logic circuits. A Boolean circuit is a collection of –gates –inputs –wires no cycles

CS 515 Kinds of Gates ÇÆ : and not or

CS 516 Gates Wires carry 0 or 1 AND: 1 iff both 1 OR: 1 iff either 1 NOT: opposite Distinguished output gate Æ and : not Ç or

CS 517 Example Æ : Ç Æ x0x0 x1x1 x2x2 : Æ Output gate

CS 518 Example Æ : Ç Æ x0x0 x1x1 x2x2 : Æ Output gate

CS 519 Circuit Satisfiability A circuit is satisfiable –If there is some set of inputs –That produce a 1 The circuit-satisfiability problem tests whether a circuit is satisfiable. –CIRCUIT-SAT = { |C is a satisfiable Boolean circuit}

CS 5110 Circuit Satisfiability Claim: –CIRCUIT-SAT is in NP Why? We will show that circuits can simulate Turing Machines!

CS 5111 Circuits Let t: N ! N be a function, where t(n) ¸ n Let M be a TM that –Takes inputs over alphabet {0,1} –Runs in time t(n)

CS 5112 Claim Let M be a TM that –Takes inputs over alphabet {0,1} –Runs in time t(n) Each n has a Boolean Circuit with O(t 2 (n)) gates that outputs 1 on those inputs of length n accepted by M

CS 5113 Proof Idea Define C n to simulate M on inputs of size n Gates of C n are –Organized in rows –One for each of t(n) steps in M’s computation –Each row represents M’s configuration at that step –Each row wired to previous Technical modification –M accepts or rejects with head at leftomost

CS 5114 Configurations Computation changes: –current state –current head position –tape contents

CS 5115 Configurations Configuration: 1011 q means: –state is q 7 –LHS of tape is 1011, RHS of tape is 0111 –head is on RHS 0

CS 5116 Yields u a q i b v yields u q j a c v if –???

CS 5117 Yields u a q i b v yields u q j a c v if –δ(q i,b) = (q j,c,L)

CS 5118 Yields u a q i b v yields u q j a c v if –δ(q i,b) = (q j,c,L) u a q i b v yields u a c q j v if –???

CS 5119 Yields u a q i b v yields u q j a c v if –δ(q i,b) = (q j,c,L) u a q i b v yields u a c q j v if –δ(q i,b) = (q j,c,R)

CS 5120 Yields u a q i b v yields u q j a c v if –δ(q i,b) = (q j,c,L) u a q i b v yields u a c q j v if –δ(q i,b) = (q j,c,R) q i b v yields q j c v if –???

CS 5121 More Configurations Starting: q 0 w Accepting: w 0 q a w 1 Rejecting: w 0 q r w 1 Halting configurations: –w 0 q a w 1, and –w 0 q r w 1

CS 5122 Accepting a Language C 1 = starting configuration of M on w each C i yields C i+1 C k is an accepting configuration. A Turing machine M accepts an input w if there exits a sequence C 1, C 2, …., C k such that

CS 5123 Tableaux Let M be –(Q, §, ¡, ±, q 0, q a, q r ) The tableau for M on w is –a t(n) by t(n) table. –rows are configurations of M –top row is start configuration of M on w –i th row is configuration at i th step.

CS 5124 Tableaux Why t(n) by t(n)? –How much tape can M read in t(n) steps? –How many configurations can M assume in t(n) steps?

CS 5125 Entries Each entry in the tableau contains –A tape symbol (in ¡ ), or –A state (in Q) Call entry at row i, col j cell[i,j]. –cell[1,i], …, cell[1,t(n)] starting config –And cell[1,1] = q 0, the starting state Recall M modifies so –cell[1,t(n)] is either q a or q r.

CS 5126

CS 5127 Proof Content of cell is determined by neighbors in preceding row. Given –cell[i-1,j-1] –cell[i,j-1] –cell[i+1,j-1] we can determine cell[i,j] –from M's transition function.

CS 5128 Proof Three top tape symbols nowhere near head So middle one unchanged on next row

CS 5129 Constructing the Circuit Circuit C n –has several gates for each cell in the tableau –compute value at a cell from the 3 cells that affect it.

CS 5130 Constructing the Circuit To make the description easier, we –add ``lights'' to show the output –illustrative purposes only

CS 5131 Constructing the Circuit To make the description easier, we –add ``lights'' to show the output –illustrative purposes only Let k = number of elements in ¡ [ Q. –each cell has k possible lights –grand total of k ¢ t 2 (n) lights –only one light can be lit, –that light indicates contents of cell.

CS 5132 Construction Model each light as light[i,j,s], where –1 · i,j · t(n) –s 2 ¡ –one and only one light on in each cell –if light[i,j,s] is on, then cell[i,j] = s.

CS 5133 Constructing the Circuit Pick light[i,j,s] in cell[i,j]. This light should be on iff cell[i,j] = s. Only three cells can affect this cell: –cell[i-1,j-1], –cell[i,j-1], and –cell[i+1,j-1]. How they affect the cell determined by transition function ±.

CS 5134 Construction Suppose that if –cell[i-1,j-1] = a 1, –cell[i,j-1] = b 1, and –cell[i+1,j-1] = c 1. then cell[i,j] = s, according to ±. Wire the circuit so that –light[i,j,s] = light[i-1,j-1, a 1 ] Æ light[i-1,j-1, b 1 ] Æ light[i-1,j-1, c 1 ]

CS 5135 Construction Wire the circuit so that –light[i,j,s] = light[i-1,j-1, a 1 ] Æ light[i-1,j-1, b 1 ] Æ light[i-1,j-1, c 1 ]

CS 5136 Construction In general, more than one setting (a 1,b 1,c 1 ), …, (a k,b k,c k ) of cell[i-1,j-1].cell[i,j-1],cell[i+1,j-1] can yield s. Wire the circuit so that –a i,b i,c i connected by Æ gates –different settings connected by Ç gates

CS 5137

CS 5138 First Row Hardwired for start configuration light[1,1,q 0 ] is initially on.

CS 5139 First Roiw light[1,2,1], …, light[1,n+1,1] connected to w 1,…w n light[1,2,0], …, light[1,n+1,0] connected to w 1,…w n by NOT gates

CS 5140 First Row light[1,n+2,_],…light[1,t(n),_] all on

CS 5141 Construction We have constructed a circuit that simulates M through its t(n) th step. Need one gate to be the output gate of the circuit M accepts w iff it is –in q a, and –at left-hand end of tape Choose light[t(n),1,q a ]. Completes proof M simulated by C n

CS 5142 Theorem CIRCUIT-SAT is NP-complete Is clearly in NP? (why?) We must show that any language A in NP is reducible to CIRCUIT-SAT We must give a polynomial time reduction mapping strings to circuits

CS 5143 Proof We must give a polynomial time reduction mapping strings to circuits –f(w) = C So that –W 2 A, C is satisfiable

CS 5144 Proof Let V be a poly-time verifier for A –Input –c is a certificate for x Now –Construct circuit simulating V –Fill in x inputs to circuit with w –Remaining inputs are for c Output this circuit, call it C

CS 5145 Proof Output this circuit, call it C –If C is satisfiable, a certificate exists, and w 2 A –If w 2 A, certificate exists, and C is satisfiable

CS 5146 Proof Check that circuit construction is poly time –Verifier running time is n k –Circuit size is O(n 2k ) –Circuit is simple and running time of reduction is O(n 2k )

CS SAT Boolean expression in CNF –Conjunctive normal form With no more than three literals –Literal = variable or its complement

CS 5148 Theorem 3-SAT is NP-Complete Obviously in NP Reduction of CIRCUIT-SAT to 3- SAT

CS 5149 Proof Let C be a circuit with –Inputs x 1, …, x k –Gates g 1, …,g m We build Boolean formula Á such that –x i correspond to input wires –g i correspond to gate output wires Relabel variables w 1, …, w k+m

CS 5150 NOT Gates For each NOT gate in C with input w i, output w j, add clauses –(w i Ç w j ) Æ ( : w i Ç w j ) Both clauses satisfied when assignment to w i and w j mirror NOT gate

CS 5151 AND Gates For each AND gate with inputs w i and w j, and output w k, add clauses –(w i Ç w j Ç : w k ) Æ –(w i Ç : w j Ç : w k ) Æ –( : w i Ç w j Ç : w k ) Æ –( : w i Ç : w j Ç w k ) Satisfied when assignments mirror AND

CS 5152 OR Gates For each OR gate with inputs w i and w j, and output w k, add clauses –(w i Ç w j Ç : w k ) Æ –(w i Ç : w j Ç w k ) Æ –( : w i Ç w j Ç w k ) Æ –( : w i Ç : w j Ç w k ) Satisfied when assignments mirror OR

CS 5153 Details All clauses have no more than 3 literals –If they have fewer, then repeat

CS 5154 Details Satisfying assignment for C yields satisfying assignment for Á by assigning g i vars according to C Satisfying assignment for Á yields satisfying assignment for C because it describes C’s computation with output 1 Reduction is poly-time

CS 5155 This work is licensed under a Creative Commons Attribution- ShareAlike 2.5 License.Creative Commons Attribution- ShareAlike 2.5 License