CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

Similar documents
Lecture 6 Regular Grammars

CSC 473 Automata, Grammars & Languages 11/9/10

CSCI FOUNDATIONS OF COMPUTER SCIENCE

20 MATHEMATICS POLYNOMIALS

Nondeterminism and Nodeterministic Automata

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

CS 275 Automata and Formal Language Theory

This lecture covers Chapter 8 of HMU: Properties of CFLs

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Convert the NFA into DFA

State Minimization for DFAs

Formal languages, automata, and theory of computation

Homework 3 Solutions

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Theory of Computation Regular Languages

1 Nondeterministic Finite Automata

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Minimal DFA. minimal DFA for L starting from any other

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Turing Machines Part One

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Duality # Second iteration for HW problem. Recall our LP example problem we have been working on, in equality form, is given below.

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

The Regulated and Riemann Integrals

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

CS 275 Automata and Formal Language Theory

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

ARITHMETIC OPERATIONS. The real numbers have the following properties: a b c ab ac

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Strong Bisimulation. Overview. References. Actions Labeled transition system Transition semantics Simulation Bisimulation

1.3 Regular Expressions

Designing finite automata II

Some Theory of Computation Exercises Week 1

1 The Lagrange interpolation formula

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Math Lecture 23

5.5 The Substitution Rule

Homework Solution - Set 5 Due: Friday 10/03/08

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

First Midterm Examination

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Handout: Natural deduction for first order logic

Is there an easy way to find examples of such triples? Why yes! Just look at an ordinary multiplication table to find them!

Recursively Enumerable and Recursive. Languages

Decidability. Models of Computation 1

Math& 152 Section Integration by Parts

Turing Machines Part One

Improper Integrals, and Differential Equations

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Theoretical foundations of Gaussian quadrature

How to simulate Turing machines by invertible one-dimensional cellular automata

Revision Sheet. (a) Give a regular expression for each of the following languages:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Finite Automata-cont d

Chapter 14. Matrix Representations of Linear Transformations

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

1.4 Nonregular Languages

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Administrivia CSE 190: Reinforcement Learning: An Introduction

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

1 From NFA to regular expression

Infinite Geometric Series

Lecture 09: Myhill-Nerode Theorem

New data structures to reduce data size and search time

Riemann Sums and Riemann Integrals

Bernoulli Numbers Jeff Morton

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

CMSC 330: Organization of Programming Languages

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

Riemann Sums and Riemann Integrals

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Boolean Algebra. Boolean Algebras

First Midterm Examination

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Lecture 1. Functional series. Pointwise and uniform convergence.

Chapter 5 : Continuous Random Variables

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

Elementary Linear Algebra

NFAs continued, Closure Properties of Regular Languages

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

AQA Further Pure 1. Complex Numbers. Section 1: Introduction to Complex Numbers. The number system

Part 5 out of 5. Automata & languages. A primer on the Theory of Computation. Last week was all about. a superset of Regular Languages

Math 1B, lecture 4: Error bounds for numerical methods

The Wave Equation I. MA 436 Kurt Bryan

Let's start with an example:

Transcription:

CS5371 Theory of Computtion Lecture 20: Complexity V (Polynomil-Time Reducibility)

Objectives Polynomil Time Reducibility Prove Cook-Levin Theorem

Polynomil Time Reducibility Previously, we lernt tht if problem A cn be mpped in finite steps into nother problem B, we conclude tht 1. if B is decidble, A is decidble 2. if B is recognizble, A is recognizble This is clled mpping reducibility Suppose tht we restrict the mpping reducibility to be done in polynomil time. Wht cn we conclude?

Polynomil Time Reducibility (2) We define (this slide + next slide): Definition: A function f: * * is polynomil-time computble function if some polynomil-time TM M exists tht hlts with just f(w) on its tpe, when strted with input w

Polynomil Time Reducibility (3) Definition: Lnguge A is polynomil-time mpping reducible, or simply polynomiltime reducible, to lnguge B, written s A P B, if polynomil-time computble function f exists, where for ech w, w2a f(w)2b The function f is clled polynomil-time reduction of A to B

Definition of NP-Complete Definition: Lnguge B is NP-complete if 1. B is in NP, nd 2. every lnguge A in NP is polynomil-time reducible to B Wht is so specil bout NP-complete? Question: Wht will hppen if n NPcomplete lnguge cn be decided in polynomil time?

Properties of NP-Complete Answer: Every lnguge in NP cn be decided in polynomil time (why??) Nturlly, NP-complete lnguge is the most difficult lnguge in NP In other words, we hve Theorem: Suppose B is NP-complete. Then, B is in P if nd only if P = NP

Cook-Levin Theorem Recll tht Cook-Levin Theorem is the following: Theorem: SAT is P if nd only if P = NP We hve not given its proof yet. To prove this, it is equivlent if we prove: Theorem: SAT is NP-complete

Proof of Cook-Levin To prove SAT is NP-complete, we need to do two things: 1. Show SAT is in NP 2. Show every other lnguge in NP is polynomil time reducible to SAT Proof of 1: Simple Cn you give DTM verifier proof? Cn you give n NTM decider proof? Proof of 2: Hrder

Proof of Prt 2 (Ide) Ide: We construct polynomil-time reduction for ech A in NP to SAT First, let N be n NTM tht decides A The reduction of A tkes string w nd gives Boolen formul F such tht N ccepts w F is stisfible In prticulr, we choose ( long nd strnge) F such tht its stisfying ssignment corresponds to the (ccepting) computtion for N to ccept w

Proof of Prt 2 (Detils) Let N be n NTM tht decides A. Let n k be the running time of N on input of length n, with some constnt k. We define tbleu for N on input w to be n n k by n k tble tht represents brnch of computtion of N on w Ech row stores configurtion in the brnch of computtion For instnce, (see next slide)

A Tbleu for N on w Strt configurtion # q 0 w 1 w 2 w n # # # # # n k # # n k n k th configurtion

More on Tbleu For convenience, we ssume ech configurtion strts nd ends with # The 1st row is the strting configurtion, nd ech row follows from the previous row leglly A tbleu is ccepting if ny row of the tbleu is n ccepting configurtion Thus, every ccepting tbleu corresponds to n ccepting computtion

Proof of Cook-Levin (cont) So, deciding whether N ccepts w is equivlent to deciding whether n ccepting tbleu for N on w exists Our tsk now is to find formul F tht cn check if n ccepting tbleu exists Let us try formul F tht contins vrible x i,j,s for ech cell (i, j) in the tbleu, nd ech s in C = Q {#}, Lter, we hope x i,j,s = 1 cell (i,j) stores symbol s

Defining the Formul F Let us be more mbitious: we hope tht when F is stisfible, the stisfying ssignment of F cn tell us vlid nd ccepting tbleu So, we wnt to ensure tht the stisfying ssignment (when F is stisfible) gurntees: 1. Ech cell is occupied by exct 1 symbol 2. The tbleu hs ccepting configurtion 3. Ech row is correct

Proof of Cook-Levin (cont) In prticulr, we will use sub-formul to represent the bove three cses, so tht these sub-formul is stisfible if the corresponding three cses re correct The finl F is obtined by And -ing ll these formul, so tht if F is stisfible, ll three cses must be correct

Ech Cell hs only 1 symbol The sub-formul f i,j,1 ensures cell (i,j) contins t lest one symbol: f i,j,1 =_ s2c x i,j,s The sub-formul f i,j,2 ensures cell (i,j) contins t most one symbol: f i,j,2 =^s,t2c, s t ( (: x i,j,s )_(: x i,j,t )) Thus, f i,j,1^f i,j,2 will ensure cell (i,j) hs exctly one symbol, if F is stisfible

Accepting Configurtion The following sub-formul ensures the tbleu hs n ccepting configurtion if F is stisfible: f ccept =_ i,j x i,j,qccept

Row is Legl To ensure strting row is correct, we use the following sub-formul: f strt = x 1,1,#^ x 1,2,q0^ x 1,3,w1^ x 1,4,w2^ ^ x 1,n+2,wn^ x 1,n+3, ^ ^ x 1,n k-1, ^ x 1, n k,# To ensure the remining rows re correct, we first define the concept of window nd legl window inside the tbleu: (next slide)

Row is Legl (2) A window t (i,j) refers to the 2x3 cells of (i,j), (i,j+1), (i,j+2), (i+1,j), (i+1,j+1), nd (i+1,j+2) A legl window is window tht does not violte the ctions specified by the N s trnsition function, ssuming the configurtion of ech row follows leglly from the configurtion in the row bove

Row is Legl (3) E.g., q 2 q 1 b c This window is legl if there is trnsition (q 1,b) = (q 2,c,L) q 1 b q 2 This window is legl if there is trnsition (q 1,b) = (q 2,,R) q 1 b This window is legl if there is trnsition (q 1,c) = (q 2,b,R) for some c nd q 2

Row is Legl (4) E.g., # # b b This window is lso legl b b q 2 This window is legl if there is trnsition (q 1,b) = (q 2,c,L) for some q 1, b, nd c b This window is legl if there is trnsition (q 1,) = (q 2,b,L) for some q 1 nd q 2

Row is Legl (5) E.g., b b b q 2 q 1 b q 2 All these windows cnnot be legl, why? q 2 q 1 c b

Row is Legl (6) Note the the window contining the stte symbol in the center top cell gurntees tht the corresponding three lower cells re updted consistently with the trnsition function So, if row stores configurtion c, nd if ll windows in tht row re legl, then the row below it will store configurtion the follows leglly from c

Row is Legl (7) Bsed on the legl window concept, the sub-formul f move ensures tht ech row re following correctly: f move =^1 i,j n k -2 (window t (i,j) is legl) where window t (i,j) is legl is equl to: _ 1,2,,6 is legl window (x i,j,1^ x i,j+1,2^ x i,j+2,3^ x i+1,j,4^ x i+1,j+1,5^ x i+1,j+2,6 )

Thus, if Proof of Cook-Levin (cont) F = (^i,j (f i,j,1^f i,j,2 ))^f ccept^f strt^f move then F is stisfible implies tht its stisfying ssignment represents n ccepting tbleu N hs n ccepting computtion on input w N ccepts w Conversely, if N ccepts w, there must be n ccepting computtion, nd F hs stisfying ssigment F is stisfible

Proof of Cook-Levin (cont) In summry, for ny w, we hve found Boolen formul F such tht N ccepts w F is stisfible Tht is, the construction of F gives reduction from deciding lnguge in NP to deciding whether formul is in SAT To show SAT is NP-complete, it remins to show tht the construction of F is done in polynomil time (in terms of the length of the input w)

Proof of Cook-Levin (cont) Given w of length n, f strt cn be constructed in O(n k ) time sub-formul^i,j (f i,j,1^f i,j,2 ), f ccept, f move cn be constructed in O(n 2k ) time (why??) Time to construct F = polynomil time Thus, ny lnguge in NP is polynomiltime reducible to SAT nd SAT is in NP SAT is NP-complete

Next Time More NP-complete problems