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

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

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

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

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP

Computability Theory

Lecture 16: Time Complexity and P vs NP

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

Lecture 22: PSPACE

Intro to Theory of Computation

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

Theory of Computation Time Complexity

CSE 135: Introduction to Theory of Computation NP-completeness

Chapter 7: Time Complexity

Notes for Lecture 3... x 4

Time to learn about NP-completeness!

CS154, Lecture 17: conp, Oracles again, Space Complexity

Lecture 24: Randomized Complexity, Course Summary

The Cook-Levin Theorem

Lecture 19: Finish NP-Completeness, conp and Friends

Finish K-Complexity, Start Time Complexity

conp, Oracles, Space Complexity

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

Week 3: Reductions and Completeness

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

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?

Complexity (Pre Lecture)

Computability Theory. CS215, Lecture 6,

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

CS294: Pseudorandomness and Combinatorial Constructions September 13, Notes for Lecture 5

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

CSCI3390-Lecture 16: NP-completeness

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

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

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

Lecture 3: Nondeterminism, NP, and NP-completeness

NP Completeness. Richard Karp, 1972.

Lecture 20: conp and Friends, Oracles in Complexity Theory

Exam Computability and Complexity

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

CSC 373: Algorithm Design and Analysis Lecture 18

Time to learn about NP-completeness!

NP-Completeness and Boolean Satisfiability

Applied Computer Science II Chapter 7: Time Complexity. Prof. Dr. Luc De Raedt. Institut für Informatik Albert-Ludwigs Universität Freiburg Germany

Lecture 7: Polynomial time hierarchy

Definition: conp = { L L NP } What does a conp computation look like?

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

PSPACE COMPLETENESS TBQF. THURSDAY April 17

Time Complexity. CS60001: Foundations of Computing Science

CISC 4090 Theory of Computation

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

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

Notes for Lecture 3... x 4

CS21 Decidability and Tractability

Cook-Levin Theorem. SAT is NP-complete

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

CSE 105 THEORY OF COMPUTATION

The Polynomial Hierarchy

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits

Definition: Alternating time and space Game Semantics: State of machine determines who

NP-Complete Reductions 1

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

Computability and Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSE 105 Theory of Computation

Lecture 8: Alternatation. 1 Alternate Characterizations of the Polynomial Hierarchy

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

CSCE 551: Chin-Tser Huang. University of South Carolina

Lecture Notes: The Halting Problem; Reductions

BBM402-Lecture 11: The Class NP

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

Introduction to Complexity Theory

Intractable Problems [HMU06,Chp.10a]

INAPPROX APPROX PTAS. FPTAS Knapsack P

1 Non-deterministic Turing Machine

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

NP-Completeness. NP-Completeness 1

22c:135 Theory of Computation. Analyzing an Algorithm. Simplifying Conventions. Example computation. How much time does M1 take to decide A?

Complexity: moving from qualitative to quantitative considerations

Lecture 12: Mapping Reductions

CSC 1700 Analysis of Algorithms: P and NP Problems

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

Lecture 10: Boolean Circuits (cont.)

CS151 Complexity Theory. Lecture 1 April 3, 2017

Lecture 18: PCP Theorem and Hardness of Approximation I

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

COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

Intro to Theory of Computation

Lecture 1: Course Overview and Turing machine complexity

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

Umans Complexity Theory Lectures

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

Review of Complexity Theory

Chapter 3: The Church-Turing Thesis

CS154, Lecture 10: Rice s Theorem, Oracle Machines

NP Complete Problems. COMP 215 Lecture 20

Transcription:

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

Is SAT solvable in O(n) time on a multitape TM? Logic circuits of 6n gates for SAT? If yes, then not only is P=NP, but there would be a dream machine that could crank out short proofs of theorems, quickly optimize all aspects of life recognizing quality work is all you need to produce THIS IS AN OPEN QUESTION! 2

Polynomial Time Reducibility f : Σ* Σ* is a polynomial time computable function if there is a poly-time Turing machine M that on every input w, halts with just f(w) on its tape Language A is poly-time reducible to language B, written as A P B, if there is a poly-time computable f : Σ* Σ* so that: w A f(w) B f is a polynomial time reduction from A to B Note there is a k such that for all w, f(w) w k 3

A n w n f f B n c f(w) n c f converts any string w into a string f(w) such that w A f(w) B 4

Theorem: If A P B and B P C, then A P C A f B g C n n c n cd f g 5

Theorem: If A P B and B P, then A P Proof: Let M B be a poly-time TM that decides B. Let f be a poly-time reduction from A to B. We build a machine M A that decides A as follows: M A = On input w, 1. Compute f(w) 2. Run M B on f(w), output its answer w A f(w) B 6

Theorem: If A P B and B NP, then A NP Proof: Analogous 7

Theorem: If A P B and B 2 P, then A 2 P Theorem: If A P B and B 2 NP, then A 2 NP Corollary: If A P B and A P, then B P 8

Definition: A language B is NP-complete if: 1. B NP 2. Every A in NP is poly-time reducible to B That is, A P B When this is true, we say B is NP-hard On homework, you showed A language L is recognizable iff L m A TM A TM is complete for recognizable languages : A TM is recognizable, and for all recognizable L, L m A TM 9

Suppose L is NP-Complete P NP L If L P, then P = NP! If L P, then P NP! 10

Suppose L is NP-Complete Then assuming the conjecture P NP, L is not decidable in n k time, for every k 11

There are thousands of NP-complete problems! Your favorite topic certainly has an NP-complete problem somewhere in it Even the other sciences are not safe: biology, chemistry, physics have NP-complete problems too! 12

The Cook-Levin Theorem: SAT and 3SAT are NP-complete 1. 3SAT NP A satisfying assignment is a proof that a 3cnf formula is satisfiable 2. 3SAT is NP-hard Every language in NP can be polynomial-time reduced to 3SAT (complex logical formula) Corollary: 3SAT P if and only if P = NP 13

Theorem (Cook-Levin): 3SAT is NP-complete Proof Idea: (1) 3SAT NP (done) (2) Every language A in NP is polynomial time reducible to 3SAT (this is the challenge) We give a poly-time reduction from A to SAT The reduction converts a string w into a 3cnf formula such that w A iff 3SAT For any A NP, let N be a nondeterministic TM deciding A in n k time will simulate N on w 14

Deterministic Computation Nondeterministic Computation n k reject accept or reject accept exp(n k ) 15

Let L(N) NTIME(n k ). A tableau for N on w is an n k n k matrix whose rows are the configurations of some possible computation history of N on w # q 0 w 1 w 2 w n # # # n k Each cell contains a σ Q Γ { # } # # n k 16

A tableau is accepting if the last row of the tableau is an accepting configuration N accepts w if and only if there is an accepting tableau for N on w Given w, we ll construct a 3cnf formula with O( w 2k ) clauses, describing logical constraints that any accepting tableau for N on w must satisfy The 3cnf formula will be satisfiable if and only if there is an accepting tableau for N on w 17

Variables of formula will encode a tableau Let C = Q Γ { # } Each cell of a tableau contains a symbol from C cell[i,j] = symbol in the cell at row i and column j = the jth symbol in the ith configuration For every i and j (1 i, j n k ) and for every s C we make a Boolean variable x i,j,s in Total number of variables = C n 2k, which is O(n 2k ) The x i,j,s variables represent the cells of a tableau We will enforce the condition: for all i, j, s, x i,j,s = 1 cell[i,j] = s 18

Idea: Make so that every satisfying assignment to the variables x i,j,s corresponds to an accepting tableau for N on w (an assignment to all cell[i,j] s of the tableau) The formula will be the AND of four CNF formulas: = cell start accept move cell : for all i, j, there is a unique s C with x i,j,s = 1 start : the first row of the table equals the start configuration of N on w accept : the last row of the table has an accept state move : every row is a configuration that yields the configuration on the next row 19

start : the first row of the table equals the start configuration of N on w start = x 1,1,# x 1,2,q 0 x 1,3,w x 1,4,w x 1,n+2,w 1 2 n x 1,n+3, x 1,n -1, x k 1,n k,# # q 0 w 1 w 2 w n # # # O(n k ) clauses 20

accept : the last row of the table has an accept state accept = x k n,j, q accept 1 j n k # q 0 w 1 w 2 w n # # # # q accept # 21

accept : the last row of the table has an accept state accept = x k n,j, q accept 1 j n k How can we convert accept into a 3-cnf formula? The clause (a 1 a 2 a t ) is equivalent to (a 1 a 2 z 1 ) ( z 1 a 3 z 2 ) ( z t-3 a t-1 a t ) where z i are new variables. This produces O(t) new 3cnf clauses. O(n k ) clauses 22

cell : for all i, j, there is a unique s C with x i,j,s = 1 cell = 1 i, j n k s C x i,j,s ( x i,j,s x i,j,t ) s,t C s t for all i,j at least one x i,j,s is set to 1 at most one x i,j,s is set to 1 O(n 2k ) clauses 23

move : every row is a configuration that yields the configuration on the next row Key Question: If one row yields the next row, how many cells can be different between the two rows? Answer: AT MOST THREE CELLS! # b a # b a a q 1 b q 2 a c c b # c b # 24

move : every row is a configuration that yields the configuration on the next row Key Question: If one row yields the next row, how many cells can be different between the two rows? Answer: AT MOST THREE CELLS! # b a # b a a q 1 b q 2 a c c b # c b # 25

move : every row is a configuration that yields the configuration on the next row Idea: check that every 2 3 window of cells is legal (consistent with the transition function of N) # q 0 w 1 w 2 w n # # # j i the (i,j) window # # 26

move = 1 i, j n k ( the (i, j) window is legal ) the (i, j) window is legal = (a 1,, a 6 ) ISN T legal - - - - - - ( x i,j,a x i,j+1,a x i,j+2,a x i+1,j,a x i+1,j+1,a x i+1,j+2,a ) 1 2 3 4 5 6 O(n 2k ) clauses 31

Summary. We wanted to prove: Every A in NP has a polynomial time reduction to 3SAT For every A in NP, we know A is decided by some nondeterministic n k time Turing machine N We gave a generic method to reduce a string w to a 3CNF formula of O( w 2k ) clauses such that satisfying assignments to the variables of directly correspond to accepting computation histories of N on w The formula is the AND of four 3CNF formulas: = cell start accept move 32

Theorem (Cook-Levin): SAT and 3SAT are NP-complete Corollary: SAT P if and only if P = NP Given a favorite problem 2 NP, how can we prove it is NP-hard? Generic Recipe: 1. Take a problem that you know to be NP-hard (3-SAT) 2. Prove that P Then for all A 2 NP, A P and P We conclude that A P, and is NP-hard 33

is NP-Complete P NP 34

Reading Assignment Read Luca Trevisan s notes for an alternative proof of the Cook-Levin Theorem! Sketch: 1. Define CIRCUIT-SAT: Given a logical circuit C(y), is there an input a such that C(a)=1? 2. Show that CIRCUIT-SAT is NP-hard: The n k x n k tableau for N on w can be simulated using a logical circuit of O(n 2k ) gates 3. Reduce CIRCUIT-SAT to 3SAT in polytime 4. Conclude 3SAT is also NP-hard 35