February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.

Slides:



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

Complexity ©D.Moshkovits 1 Where Can We Draw The Line? On the Hardness of Satisfiability Problems.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
The diagonalization method The halting problem is undecidable Decidability.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
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 )
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
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.
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.
Computability and Complexity 20-1 Computability and Complexity Andrei Bulatov Class NL.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CS151 Complexity Theory Lecture 2 April 3, Time and Space A motivating question: –Boolean formula with n nodes –evaluate using O(log n) space?
CS151 Complexity Theory Lecture 1 March 30, 2004.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
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.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N  N, where f(n) is the maximum.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
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.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
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.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
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
The NP class. NP-completeness
Computability and Complexity
Busch Complexity Lectures: Reductions
(xy)(yz)(xz)(zy)
MCC 2093 Advanced Theoretical Computer Science
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
Intro to Theory of Computation
CS151 Complexity Theory Lecture 2 April 5, 2017.
Where Can We Draw The Line?
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Computability & Complexity I
CS154, Lecture 12: Time Complexity
CS21 Decidability and Tractability
CS21 Decidability and Tractability
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Instructor: Aaron Roth
Presentation transcript:

February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015

Midterm 30 points Mean: 21.5 Median: 22.5 (last year: 30 pts; mean 20.3; median: 20) Distribution: 30: 3 (6) 26-30: 34 (18) 21-26: 42 (32) February 18, 2015CS21 Lecture : 22 (29) 13-17: 11 (20) 9-13: 6 (7) < 9 : 7 (3)

February 18, 2015CS21 Lecture 183 Outline The complexity class P –examples of problems in P The complexity class EXP Time Hierarchy Theorem

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

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

February 18, 2015CS21 Lecture 186 2SAT This is a disguised version of the language 2SAT = {formulas in Conjunctive Normal Form with 2 literals per clause for which there exists a satisfying truth assignment} –CNF = “AND of ORs” (A, b), (E, D), (d, C), (b, a) (x 1   x 2 )  (x 5  x 4 )  (  x 4  x 3 )  (  x 2   x 1 ) –satisfying truth assignment = assignment of TRUE/FALSE to each variable so that whole formula is TRUE

2SAT Theorem: There is a polynomial-time algorithm deciding 2SAT (“2SAT 2 P”). Proof: algorithm described on next slides. February 18, 2015CS21 Lecture 187

February 18, 2015CS21 Lecture 188 x2x2 x1x1 x4x4 x1x1 Algorithm for 2SAT Build a graph with separate nodes for each literal. –add directed edge (x, y) iff formula includes clause (  x  y) or (y   x ) (equiv. to x  y) e.g. (x 1   x 2 )  (x 5  x 4 )  (  x 4  x 3 )  (  x 2   x 1 ) x5x5 x4x4 x3x3 x2x2 x5x5 x3x3

February 18, 2015CS21 Lecture 189 Algorithm for 2SAT Claim: formula is unsatisfiable iff there is some variable x with a path from x to  x and a path from  x to x in derived graph. Proof (  ) –edges represent implication . By transitivity of , a path from x to  x means x   x, and a path from  x to x means  x  x.

February 18, 2015CS21 Lecture 1810 Algorithm for 2SAT Proof (  ) –to construct a satisfying assign. (if no x with a path from x to  x and a path from  x to x): pick unassigned literal s with no path from s to  s assign it TRUE, as well as all nodes reachable from it; assign negations of these literals FALSE note: path from s to t and s to  t implies path from  t to  s and t to  s, implies path from s to  s note: path s to t (assigned FALSE) implies path from  t (assigned TRUE) to  s, so s already assigned at that point.

February 18, 2015CS21 Lecture 1811 Algorithm for 2SAT Algorithm: –build derived graph –for every pair x,  x check if there is a path from x to  x and from  x to x in the graph Running time of algorithm (input length n): –O(n) to build graph –O(n) to perform each check –O(n) checks –running time O(n 2 ). 2SAT  P.

February 18, 2015CS21 Lecture 1812 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 18, 2015CS21 Lecture SAT 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) (x 1  x 2  x 3 )  (x 5  x 4  x 2 )  (  x 4  x 1  x 3 )  (  x 3  x 2  x 1 ) observe that this language is in TIME(2 n )

February 18, 2015CS21 Lecture 1814 Time Complexity Key definition: “P” or “polynomial-time” is P =  k ≥ 1 TIME(n k ) Definition: “EXP” or “exponential-time” is EXP =  k ≥ 1 TIME(2 n k ) decidable languages P EXP

February 18, 2015CS21 Lecture 1815 EXP P =  k ≥ 1 TIME(n k ) EXP =  k ≥ 1 TIME(2 n k ) Note: P  EXP. We have seen 3SAT  EXP. –does not rule out possibility that it is in P Is P different from EXP?

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

February 18, 2015CS21 Lecture 1817 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 with a TM that decides it and runs in time f(2n) 3.

February 18, 2015CS21 Lecture 1818 Recall proof for Halting Problem Turing Machines inputs Y n Y n n Y n YnYYnnY H’ : box (M, x): does M halt on x? 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.

February 18, 2015CS21 Lecture 1819 Proof of Time Hierarchy Theorem Turing Machines inputs Y n Y n n Y n YnYYnnY D : box (M, x): does M accept x in time f(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

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

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

February 18, 2015CS21 Lecture 1822 Proof of Time Hierarchy Theorem Claim: there is a TM SIM that decides { : 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 18, 2015CS21 Lecture 1823 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 18, 2015CS21 Lecture 1824 So far… We have defined the complexity classes P (polynomial time), EXP (exponential time) regular languages context free languages decidable languages P some language EXP

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

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

February 18, 2015CS21 Lecture 1827 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 18, 2015CS21 Lecture 1828 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 18, 2015CS21 Lecture 1829 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 (u 1, v 1 ), (u 2, v 2 ),…, (u k, v k ), such that there is no i for which [u i is reachable from v i in G and v i is reachable from u i in G]} We gave a poly-time reduction from 2SAT to L. determined that 2SAT  P from fact that L  P

February 18, 2015CS21 Lecture 1830 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 18, 2015CS21 Lecture 1831 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 18, 2015CS21 Lecture 1832 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