CS21 Decidability and Tractability

Slides:



Advertisements
Similar presentations
Complexity ©D.Moshkovits 1 Where Can We Draw The Line? On the Hardness of Satisfiability Problems.
Advertisements

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
The diagonalization method The halting problem is undecidable Decidability.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
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 )
CS151 Complexity Theory Lecture 1 March 30, 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.
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
Fall 2004COMP 3351 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
חישוביות וסיבוכיות 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.
The class P Section 7.2 CSC 4170 Theory of Computation.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
NPC.
1 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
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.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
 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
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
NP-Completeness A problem is NP-complete if: It is in NP
CSCI 2670 Introduction to Theory of Computing
CSC 4170 Theory of Computation The class P Section 7.2.
Time complexity Here we will consider elements of computational complexity theory – an investigation of the time (or other resources) required for solving.
Computability and Complexity
CS21 Decidability and Tractability
(xy)(yz)(xz)(zy)
CSC 4170 Theory of Computation The class P Section 7.2.
Umans Complexity Theory Lectures
CSCI 2670 Introduction to Theory of Computing
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Intro to Theory of Computation
Where Can We Draw The Line?
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Computability & Complexity I
Intro to Theory of Computation
Computational Complexity
CS21 Decidability and Tractability
Time Complexity We use a multitape Turing machine
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS154, Lecture 13: P vs NP.
CS154, Lecture 12: Time Complexity
Theory of Computability
CS21 Decidability and Tractability
Decidability and Tractability
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CSE 589 Applied Algorithms Spring 1999
CS151 Complexity Theory Lecture 1 April 2, 2019.
Instructor: Aaron Roth
Instructor: Aaron Roth
Theory of Computability
Presentation transcript:

CS21 Decidability and Tractability Lecture 17 February 15, 2019 February 15, 2019 CS21 Lecture 17

Outline Extended Church-Turing Thesis The complexity class P Examples of problems in P February 15, 2019 CS21 Lecture 17

Multitape TMs Convenient to “program” multitape TMs rather than single ones equivalent when talking about decidability not equivalent when talking about time complexity Theorem: Let t(n) satisfy t(n) ≥ n. Every multi-tape TM running in time t(n) has an equivalent TM running in time O(t(n)2). February 15, 2019 CS21 Lecture 17

Multitape TMs simulation of k-tape TM by single-tape TM: . . . a b a b add new symbol x for each old x marks location of “virtual heads” (input tape) . . . a a . . . b b c d . . . # a b a b # a a # b b c d # February 15, 2019 CS21 Lecture 17

Multitape TMs Repeat: O(t(n)) times . . . . . . . . . . . . scan tape, remembering the symbols under each virtual head in the state make changes to reflect 1 step of M; if hit #, shift to right to make room. when M halts, erase all but 1st string O(t(n)) times . . . a b a b . . . a a O(k t(n)) = O(t(n)) . . . b b c d O(k t(n)) = O(t(n)) O(t(n)) . . . # a b a b # a a # b b c d # February 15, 2019 CS21 Lecture 17

Multitape TMs Moral: feel free to use k-tape TMs, but be aware of slowdown in conversion to TM note: if t(n) = O(nc) then t(n)2 = O(n2c )= O(nc’) note: if t(n) = O(2nδ) for δ > 0 then t(n)2 = O(22nδ) = O(2nδ’) for δ’ > 0 high-level operations you are used to using can be simulated by TM with only polynomial slowdown e.g., copying, moving, incrementing/decrementing, arithmetic operations +, -, *, / February 15, 2019 CS21 Lecture 17

Extended Church-Turing Thesis the belief that TMs formalize our intuitive notion of an efficient algorithm is: quantum computers challenge this belief The “extended” Church-Turing Thesis everything we can compute in time t(n) on a physical computer can be computed on a Turing Machine in time t(n)O(1) (polynomial slowdown) February 15, 2019 CS21 Lecture 17

Time Complexity P = ∪k ≥ 1 TIME(nk) interested in a coarse classification of problems. For this purpose, treat any polynomial running time as “efficient” or “tractable” treat any exponential running time as inefficient or “intractable” Key definition: “P” or “polynomial-time” is P = ∪k ≥ 1 TIME(nk) February 15, 2019 CS21 Lecture 17

Time Complexity Why polynomial-time? insensitive to particular deterministic model of computation chosen closed under modular composition empirically: qualitative breakthrough to achieve polynomial running time is followed by quantitative improvements from impractical (e.g. n100) to practical (e.g. n3 or n2) February 15, 2019 CS21 Lecture 17

Examples of languages in P Recall: positive integers x, y are relatively prime if their Greatest Common Divisor (GCD) is 1. will show the following language is in P: RELPRIME = {<x, y> : x and y are relatively prime} what is the running time of the algorithm that tries all divisors up to min{x, y}? February 15, 2019 CS21 Lecture 17

Euclid’s Algorithm possibly earliest recorded algorithm Example run on input <10, 22>: x, y = 10, 22 x, y = 22, 10 x, y = 10, 2 x, y = 2, 0 reject on input <x, y>: repeat until y = 0 set x = x mod y swap x, y x is the GCD(x, y). If x = 1, accept; otherwise reject February 15, 2019 CS21 Lecture 17

Euclid’s Algorithm possibly earliest recorded algorithm Example run on input <24, 5>: x, y = 24, 5 x, y = 5, 4 x, y = 4, 1 x, y = 1, 0 accept on input <x, y>: repeat until y = 0 set x = x mod y swap x, y x is the GCD(x, y). If x = 1, accept; otherwise reject February 15, 2019 CS21 Lecture 17

Euclid’s Algorithm on input <x, y>: (1) repeat until y = 0 (2) set x = x mod y (3) swap x, y x is the GCD(x, y). If x = 1, accept; otherwise reject Claim: value of x reduced by ½ at every execution of (2) except possibly first one. Proof: after (2) x < y after (3) x > y if x/2 ≥ y, then x mod y < y ≤ x/2 if x/2 < y, then x mod y = x – y < x/2 every 2 times through loop, (x, y) each reduced by ½ loops ≤ 2max{log2x, log2y} = O(n = |<x, y>|); poly time for each loop February 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

(x1 ∨¬x2)∧(x5 ∨ x4)∧(¬x4 ∨ x3)∧(¬x2 ∨¬x1) 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) (x1 ∨¬x2)∧(x5 ∨ x4)∧(¬x4 ∨ x3)∧(¬x2 ∨¬x1) satisfying truth assignment = assignment of TRUE/FALSE to each variable so that whole formula is TRUE February 15, 2019 CS21 Lecture 17

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

Algorithm for 2SAT Build a graph with separate nodes for each literal. add directed edge (x, y) iff formula includes clause (¬x ∨ y) (equiv. to x ⇒ y) x4 ¬x4 ¬x1 ¬x3 x2 ¬x5 x3 x1 ¬x2 x5 e.g. (x1 ∨¬x2)∧(x5 ∨ x4)∧(¬x4 ∨ x3)∧(¬x2 ∨¬x1) February 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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(n2). 2SAT ∈ P. February 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17

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 15, 2019 CS21 Lecture 17