CS21 Decidability and Tractability

Slides:



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

Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
The diagonalization method The halting problem is undecidable Decidability.
P and NP Sipser (pages ). CS 311 Fall Polynomial time P = ∪ k TIME(n k ) … P = ∪ k TIME(n k ) … TIME(n 3 ) TIME(n 2 ) TIME(n)
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 )
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
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.
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.
CS151 Complexity Theory Lecture 2 April 3, Time and Space A motivating question: –Boolean formula with n nodes –evaluate using O(log n) space?
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
CS21 Decidability and Tractability
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
February 4, 2015CS21 Lecture 131 CS21 Decidability and Tractability Lecture 13 February 4, 2015.
CS151 Complexity Theory Lecture 2 April 1, CS151 Lecture 22 Time and Space A motivating question: –Boolean formula with n nodes –evaluate using.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
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.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
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.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
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
February 1, 2016CS21 Lecture 121 CS21 Decidability and Tractability Lecture 12 February 1, 2016.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
Busch Complexity Lectures: Reductions
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Umans Complexity Theory Lectures
The diagonalization method The halting problem is undecidable
MCC 2093 Advanced Theoretical Computer Science
CS154, Lecture 13: P vs NP.
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Intro to Theory of Computation
Summary.
CS151 Complexity Theory Lecture 2 April 5, 2017.
Computability & Complexity I
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS154, Lecture 13: P vs NP.
CS154, Lecture 12: Time Complexity
NP-completeness The Chinese University of Hong Kong Fall 2008
Recall last lecture and Nondeterministic TMs
CS21 Decidability and Tractability
NP-Completeness Yin Tat Lee
Umans Complexity Theory Lectures
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CSE 589 Applied Algorithms Spring 1999
CS151 Complexity Theory Lecture 1 April 2, 2019.
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Intro to Theory of Computation
CS151 Complexity Theory Lecture 4 April 8, 2004.
Presentation transcript:

CS21 Decidability and Tractability Lecture 18 February 20, 2019 February 20, 2019 CS21 Lecture 18

Outline The complexity class EXP Time Hierarchy Theorem hardness and completeness an EXP-complete problem the complexity class NP alternate characterization of NP 3-SAT is NP-complete February 20, 2019 CS21 Lecture 18

e.g. (A, b, C), (E, D, b), (d, A, C), (c, b, a) Another puzzle Find an efficient algorithm to solve the following problem. Input: sequence of triples of symbols e.g. (A, b, C), (E, D, b), (d, A, C), (c, b, a) Goal: determine if it is possible to circle at least one symbol in each triple without circling upper and lower case of same symbol. February 20, 2019 CS21 Lecture 18

3SAT This is a disguised version of the language 3SAT = {formulas in Conjunctive Normal Form with 3 literals per clause for which there exists a satisfying truth assignment} e.g. (A, b, C), (E, D, b), (d, A, C), (c, b, a) (x1∨¬x2∨x3) ∧( x5∨x4∨¬x2)∧(¬x4∨x1∨x3)∧(¬x3∨¬x2 ∨¬x1) observe that this language is in TIME(2n) February 20, 2019 CS21 Lecture 18

Time Complexity P = ∪k ≥ 1 TIME(nk) EXP = ∪k ≥ 1 TIME(2nk) Key definition: “P” or “polynomial-time” is P = ∪k ≥ 1 TIME(nk) Definition: “EXP” or “exponential-time” is EXP = ∪k ≥ 1 TIME(2nk) P EXP decidable languages February 20, 2019 CS21 Lecture 18

EXP P = ∪k ≥ 1 TIME(nk) EXP = ∪k ≥ 1 TIME(2nk) Note: P ⊆ EXP. We have seen 3SAT ∈ EXP. does not rule out possibility that it is in P Is P different from EXP? February 20, 2019 CS21 Lecture 18

Time Hierarchy Theorem Theorem: for every proper complexity function f(n) ≥ n: TIME(f(n)) ⊆ TIME(f(2n)3). Note: P ⊆TIME(2n) ⊆ TIME(2(2n)3) ⊆ EXP Most natural functions (and 2n in particular) are proper complexity functions. We will ignore this detail in this class. February 20, 2019 CS21 Lecture 18

Time Hierarchy Theorem Theorem: for every proper complexity function f(n) ≥ n: TIME(f(n)) ⊆ TIME(f(2n)3). Proof idea: use diagonalization to construct a language that is not in TIME(f(n)). constructed language comes ith a TM that decides it and runs in time f(2n)3. February 20, 2019 CS21 Lecture 18

Recall proof for Halting Problem box (M, x): does M halt on x? inputs Y Turing Machines n Y The existence of H which tells us yes/no for each box allows us to construct a TM H’ that cannot be in the table. n n Y n H’ : n Y n Y Y n Y February 20, 2019 CS21 Lecture 18

Proof of Time Hierarchy Theorem box (M, x): does M accept x in time f(n)? inputs Y Turing Machines n TM SIM tells us yes/no for each box in time g(n) rows include all of TIME(f(n)) construct TM D running in time g(2n) that is not in table Y n n Y n D : n Y n Y Y n Y February 20, 2019 CS21 Lecture 18

Proof of Time Hierarchy Theorem SIM is TM deciding language { <M, x> : M accepts x in ≤ f(|x|) steps } Claim: SIM runs in time g(n) = f(n)3. define new TM D: on input <M> if SIM accepts <M, <M>>, reject if SIM rejects <M, <M>>, accept D runs in time g(2n) February 20, 2019 CS21 Lecture 18

Proof of Time Hierarchy Theorem Proof (continued): suppose M in TIME(f(n)) decides L(D) M(<M>) = SIM(<M, <M>>) ≠ D(<M>) but M(<M>) = D(<M>) contradiction. February 20, 2019 CS21 Lecture 18

Proof of Time Hierarchy Theorem Claim: there is a TM SIM that decides {<M, x> : M accepts x in ≤ f(|x|) steps} and runs in time g(n) = f(n)3. Proof sketch: SIM has 4 work tapes contents and “virtual head” positions for M’s tapes M’s transition function and state f(|x|) “+”s used as a clock scratch space February 20, 2019 CS21 Lecture 18

Proof of Time Hierarchy Theorem Proof sketch (continued): 4 work tapes contents and “virtual head” positions for M’s tapes M’s transition function and state f(|x|) “+”s used as a clock scratch space initialize tapes simulate step of M, advance head on tape 3; repeat. can check running time is as claimed. February 20, 2019 CS21 Lecture 18

So far… We have defined the complexity classes P (polynomial time), EXP (exponential time) some language P decidable languages regular languages context free languages EXP February 20, 2019 CS21 Lecture 18

Poly-time reductions Type of reduction we will use: “many-one” poly-time reduction (commonly) “mapping” poly-time reduction (book) A B f yes yes reduction from language A to language B f no no February 20, 2019 CS21 Lecture 18

Poly-time reductions function f should be poly-time computable yes yes f no no function f should be poly-time computable Definition: f : Σ*→ Σ* is poly-time computable if for some g(n) = nO(1) there exists a g(n)-time TM Mf such that on every w ∈ Σ*, Mf halts with f(w) on its tape. February 20, 2019 CS21 Lecture 18

Poly-time reductions Definition: A ≤P B (“A reduces to B”) if there is a poly-time computable function f such that for all w w ∈ A ⇔ f(w) ∈ B as before, condition equivalent to: YES maps to YES and NO maps to NO as before, meaning is: B is at least as “hard” (or expressive) as A February 20, 2019 CS21 Lecture 18

Poly-time reductions Theorem: if A ≤P B and B ∈ P then A ∈ P. Proof: a poly-time algorithm for deciding A: on input w, compute f(w) in poly-time. run poly-time algorithm to decide if f(w) ∈ B if it says “yes”, output “yes” if it says “no”, output “no” February 20, 2019 CS21 Lecture 18

Example 2SAT = {CNF formulas with 2 literals per clause for which there exists a satisfying truth assignment} L = {directed graph G, and list of pairs of vertices (u1, v1), (u2, v2),…, (uk, vk), such that there is no i for which [ui is reachable from vi in G and vi is reachable from ui in G]} We gave a poly-time reduction from 2SAT to L. determined that 2SAT ∈ P from fact that L ∈ P February 20, 2019 CS21 Lecture 18

Hardness and completeness Reasonable that can efficiently transform one problem into another. Surprising: can often find a special language L so that every language in a given complexity class reduces to L! powerful tool February 20, 2019 CS21 Lecture 18

Hardness and completeness Recall: a language L is a set of strings a complexity class C is a set of languages Definition: a language L is C-hard if for every language A ∈ C, A poly-time reduces to L; i.e., A ≤P L. meaning: L is at least as “hard” as anything in C February 20, 2019 CS21 Lecture 18

Hardness and completeness Recall: a language L is a set of strings a complexity class C is a set of languages Definition: a language L is C-complete if L is C-hard and L ∈ C meaning: L is a “hardest” problem in C February 20, 2019 CS21 Lecture 18

An EXP-complete problem Version of ATM with a time bound: ATMB = {<M, x, m> : M is a TM that accepts x within at most m steps} Theorem: ATMB is EXP-complete. Proof: what do we need to show? February 20, 2019 CS21 Lecture 18

An EXP-complete problem ATMB = {<M, x, m> : M is a TM that accepts x within at most m steps} Proof that ATMB is EXP-complete: Part 1. Need to show ATMB ∈ EXP. simulate M on x for m steps; accept if simulation accepts; reject if simulation doesn’t accept. running time mO(1). n = length of input ≥ log2m running time ≤ mk = 2(log m)k ≤ 2(kn) February 20, 2019 CS21 Lecture 18

An EXP-complete problem ATMB = {<M, x, m> : M is a TM that accepts x within at most m steps} Proof that ATMB is EXP-complete: Part 2. For each language A ∈ EXP, need to give poly-time reduction from A to ATMB. for a given language A ∈ EXP, we know there is a TM MA that decides A in time g(n) ≤ 2nk for some k. what should reduction f(w) produce? February 20, 2019 CS21 Lecture 18

An EXP-complete problem ATMB = {<M, x, m> : M is a TM that accepts x within at most m steps} Proof that ATMB is EXP-complete: f(w) = <MA, w, m> where m = 2|w|k is f(w) poly-time computable? hardcode MA and k… YES maps to YES? w ∈ A ⇒ <MA, w, m> ∈ ATMB NO maps to NO? w ∉ A ⇒ <MA, w, m> ∉ ATMB February 20, 2019 CS21 Lecture 18

An EXP-complete problem A C-complete problem is a surrogate for the entire class C. For example: if you can find a poly-time algorithm for ATMB then there is automatically a poly-time algorithm for every problem in EXP (i.e., EXP = P). Can you find a poly-time alg for ATMB? February 20, 2019 CS21 Lecture 18

An EXP-complete problem Can you find a poly-time alg for ATMB? NO! we showed that P ⊆ EXP. ATMB is not tractable (intractable). P ATMB decidable languages regular languages context free languages EXP February 20, 2019 CS21 Lecture 18

Back to 3SAT Remember 3SAT ∈ EXP 3SAT = {formulas in CNF with 3 literals per clause for which there exists a satisfying truth assignment} It seems hard. Can we show it is intractable? formally, can we show 3SAT is EXP-complete? February 20, 2019 CS21 Lecture 18

3SAT is decidable in polynomial time by a nondeterministic TM Back to 3SAT can we show 3SAT is EXP-complete? Don’t know how to. Believed unlikely. One reason: there is an important positive feature of 3SAT that doesn’t seem to hold for problems in EXP (e.g. ATMB): 3SAT is decidable in polynomial time by a nondeterministic TM February 20, 2019 CS21 Lecture 18

(Q, Σ, Γ, δ, q0, qaccept, qreject) where: Nondeterministic TMs Recall: nondeterministic TM informally, TM with several possible next configurations at each step formally, A NTM is a 7-tuple (Q, Σ, Γ, δ, q0, qaccept, qreject) where: everything is the same as a TM except the transition function: δ:Q x Γ→ P(Q x Γ x {L, R}) February 20, 2019 CS21 Lecture 18

Nondeterministic TMs visualize computation of a NTM M as a tree Cstart nodes are configurations leaves are accept/reject configurations M accepts if and only if there exists an accept leaf M is a decider, so no paths go on forever running time is max. path length rej acc February 20, 2019 CS21 Lecture 18

The class NP P = ∪k ≥ 1 TIME(nk) NP = ∪k ≥ 1 NTIME(nk) Definition: TIME(t(n)) = {L : there exists a TM M that decides L in time O(t(n))} P = ∪k ≥ 1 TIME(nk) Definition: NTIME(t(n)) = {L : there exists a NTM M that decides L in time O(t(n))} NP = ∪k ≥ 1 NTIME(nk) February 20, 2019 CS21 Lecture 18

NP in relation to P and EXP decidable languages regular languages context free languages EXP NP P P ⊆ NP (poly-time TM is a poly-time NTM) NP ⊆ EXP configuration tree of nk-time NTM has ≤ bnk nodes can traverse entire tree in O(bnk) time we do not know if either inclusion is proper February 20, 2019 CS21 Lecture 18