CS151 Complexity Theory Lecture 2 April 5, 2017.

Slides:



Advertisements
Similar presentations
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
Advertisements

Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Complexity 13-1 Complexity Andrei Bulatov Hierarchy Theorem.
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
CS151 Complexity Theory Lecture 1 March 30, 2015.
CS151 Complexity Theory Lecture 5 April 13, 2004.
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.
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
Umans Complexity Theory Lectures Lecture 2c: EXP Complete Problem: Padding and succinctness.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 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.
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.
Fall 2013 CMU CS Computational Complexity Lecture 3 and 4 Non-determinism, NTIME hierarchy threorem, Ladner’s Proof 9/17/2013.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
CS151 Complexity Theory Lecture 12 May 6, QSAT is PSPACE-complete Theorem: QSAT is PSPACE-complete. Proof: 8 x 1 9 x 2 8 x 3 … Qx n φ(x 1, x 2,
Umans Complexity Theory Lectures Lecture 1a: Problems and Languages.
Umans Complexity Theory Lectures Lecture 2b: A P-Complete Problem.
Computability & Complexity II Chris Umans Caltech.
Umans Complexity Theory Lectures Lecture 1c: Robust Time & Space Classes.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
1 Design and Analysis of Algorithms Yoram Moses Lecture 13 June 17, 2010
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
The NP class. NP-completeness
L is in NP means: There is a language L’ in P and a polynomial p so that L1 ≤ L2 means: For some polynomial time computable map r :  x: x  L1 iff.
Umans Complexity Theory Lectures
HIERARCHY THEOREMS Hu Rui Prof. Takahashi laboratory
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
Intro to Theory of Computation
Computability & Complexity I
Theory of Computability
Theory of Computability
CS21 Decidability and Tractability
CS151 Complexity Theory Lecture 3 April 10, 2017.
Chapter 34: NP-Completeness
Chapter 11 Limitations of Algorithm Power
CS154, Lecture 13: P vs NP.
CS154, Lecture 12: Time Complexity
Turing Machines Complexity ©D.Moshkovitz.
CS21 Decidability and Tractability
CS21 Decidability and Tractability
NP-Completeness Yin Tat Lee
Umans Complexity Theory Lectures
CS21 Decidability and Tractability
Our First NP-Complete Problem
CSE 589 Applied Algorithms Spring 1999
CS151 Complexity Theory Lecture 12 May 10, 2019.
CS151 Complexity Theory Lecture 1 April 2, 2019.
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
CS151 Complexity Theory Lecture 5 April 16, 2019.
CS151 Complexity Theory Lecture 4 April 12, 2019.
Intro to Theory of Computation
CS151 Complexity Theory Lecture 4 April 8, 2004.
Lecture 23 NP-Hard Problems
Presentation transcript:

CS151 Complexity Theory Lecture 2 April 5, 2017

Interlude In an ideal world, given language L state an algorithm deciding L prove that no algorithm does better we are pretty good at part 1 we are currently completely helpless when it comes to part 2, for most problems that we care about April 5, 2017

Interlude in place of part 2 we can relate the difficulty of problems to each other via reductions prove that a problem is a “hardest” problem in a complexity class via completeness powerful, successful surrogate for lower bounds April 5, 2017

Reductions reductions are the main tool for relating problems to each other given two languages L1 and L2 we say “L1 reduces to L2” and we write “L1 ≤ L2” to mean: there exists an efficient (for now, poly-time) algorithm that computes a function f s.t. x  L1 implies f(x)  L2 x  L1 implies f(x)  L2 April 5, 2017

Reductions f yes yes f no no L1 L2 positive use: given new problem L1 reduce it to L2 that we know to be in P. Conclude L1 in P (how?) e.g. bipartite matching ≤ max flow formalizes “L1 as easy as L2” April 5, 2017

Reductions f yes yes f no no L1 L2 negative use: given new problem L2 reduce L1 (that we believe not to be in P) to it. Conclude L2 not in P if L1 not in P (how?) e.g. satisfiability ≤ graph 3-coloring formalizes “L2 as hard as L1” April 5, 2017

Reductions Example reduction: 3SAT = { φ : φ is a 3-CNF Boolean formula that has a satisfying assignment } (3-CNF = AND of OR of ≤ 3 literals) IS = { (G, k) | G is a graph with an independent set V’ µ V of size ≥ k } (ind. set = set of vertices no two of which are connected by an edge) April 5, 2017

φ = (x  y  z)  (x  w  z)  …  (…) Ind. Set is NP-complete The reduction f: given φ = (x  y  z)  (x  w  z)  …  (…) we produce graph Gφ:  x x … y z w z one triangle for each of m clauses edge between every pair of contradictory literals set k = m April 5, 2017

φ = (x  y  z)  (x  w  z)  …  (…) Reductions φ = (x  y  z)  (x  w  z)  …  (…)  x x … y z w z Claim: φ has a satisfying assignment if and only if G has an independent set of size at least k proof? Conclude that 3SAT ≤ IS. April 5, 2017

Completeness complexity class C language L is C-complete if L is in C every language in C reduces to L very important concept formalizes “L is hardest problem in complexity class C” April 5, 2017

Completeness Completeness allows us to reason about the entire class by thinking about a single concrete problem related concept: language L is C-hard if every language in C reduces to L April 5, 2017

Completeness May ask: how to show every language in C reduces to L? in practice, shown by reducing known C-complete problem to L often not hard to find “1st” C-complete language, but it might not be “natural” April 5, 2017

L = { x : 9 y, |y|  |x|k, (x, y)  R } Completeness Example: NP = the set of languages L where L = { x : 9 y, |y|  |x|k, (x, y)  R } and R is a language in P. one NP-complete language “bounded halting”: BH = { (M, x, 1m) : 9 y, |y|  |x|k s.t. M accepts (x, y) in at most m steps } challenge is to find natural complete problem Cook 71 : SAT NP-complete April 5, 2017

Summary problems complexity class = set of languages function, decision language = set of strings complexity class = set of languages efficient computation identified with efficient computation on Turing Machine single-tape, multi-tape diagonalization technique: HALT undecidable TIME and SPACE classes reductions C-completeness, C-hardness April 5, 2017

April 5, 2017

Time and Space A motivating question: Boolean formula with n nodes evaluate using O(log n) space? depth-first traversal requires storing intermediate values idea: short-circuit ANDs and ORs when possible    1 1 April 5, 2017

Time and Space Can we evaluate an n node Boolean circuit using O(log n) space?       1 1 1 April 5, 2017

Time and Space Recall: Questions: TIME(f(n)), SPACE(f(n)) how are these classes related to each other? how do we define robust time and space classes? what problems are contained in these classes? complete for these classes? April 5, 2017

Outline Why big-oh? Linear Speedup Theorem Hierarchy Theorems Robust Time and Space Classes Relationships between classes Some complete problems April 5, 2017

Linear Speedup Theorem: Suppose TM M decides language L in time f(n). Then for any  > 0, there exists TM M’ that decides L in time f(n) + n + 2. Proof: simple idea: increase “word length” M’ will have one more tape than M m-tuples of symbols of M ∑new = ∑old  ∑oldm many more states April 5, 2017

Linear Speedup part 1: compress input onto fresh tape . . . . . . a b aba bba aa_ April 5, 2017

Linear Speedup part 2: simulate M, m steps at a time . . . . . . . . . b b a a b a b a a a b . . . m m . . . . . . abb aab aba aab aba 4 (L,R,R,L) steps to read relevant symbols, “remember” in state 2 (L,R or R,L) to make M’s changes April 5, 2017

Linear Speedup accounting: part 1 (copying): n + 2 steps part 2 (simulation): 6 (f(n)/m) set m = 6/ total: f(n) + n + 2 Theorem: Suppose TM M decides language L in space f(n). Then for any  > 0, there exists TM M’ that decides L in space f(n) + 2. Proof: same. April 5, 2017

Time and Space Moral: big-oh notation necessary given our model of computation Recall: f(n) = O(g(n)) if there exists c such that f(n) ≤ c g(n) for all sufficiently large n. TM model incapable of making distinctions between time and space usage that differs by a constant. In general: interested in course distinctions not affected by model e.g. simulation of k-string TM running in time f(n) by single-string TM running in time O(f(n)2) April 5, 2017

idea: same as “HALT undecidable” diagonalization and simulation Hierarchy Theorems Does genuinely more time permit us to decide new languages? how can we construct a language L that is not in TIME(f(n))… idea: same as “HALT undecidable” diagonalization and simulation April 5, 2017

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 April 5, 2017

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 April 5, 2017

Time Hierarchy Theorem Theorem (Time Hierarchy Theorem): For every proper complexity function f(n) ≥ n: TIME(f(n)) ( TIME(f(2n)3). more on “proper complexity functions” later… April 5, 2017

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) April 5, 2017

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. April 5, 2017

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 April 5, 2017

Proof of Time Hierarchy Theorem 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. Important detail: need to initialize tape 3 in time O(f(n)) April 5, 2017

Proper Complexity Functions Definition: f is a proper complexity function if f(n) ≥ f(n-1) for all n there exists a TM M that outputs exactly f(n) symbols on input 1n, and runs in time O(f(n) + n) and space O(f(n)). April 5, 2017

Proper Complexity Functions includes all reasonable functions we will work with log n, √n, n2, 2n, n!, … if f and g are proper then f + g, fg, f(g), fg, 2g are all proper can mostly ignore, but be aware it is a genuine concern: Theorem: 9 non-proper f such that TIME(f(n)) = TIME(2f(n)). April 5, 2017

SPACE(f(n)) ( SPACE(f(n) log f(n)). Hierarchy Theorems Does genuinely more space permit us to decide new languages? Theorem (Space Hierarchy Theorem): For every proper complexity function f(n) ≥ log n: SPACE(f(n)) ( SPACE(f(n) log f(n)). Proof: same ideas. April 5, 2017

Robust Time and Space Classes What is meant by “robust” class? no formal definition reasonable changes to model of computation shouldn’t change class should allow “modular composition” – calling subroutine in class (for classes closed under complement…) April 5, 2017

Robust Time and Space Classes L = SPACE(log n) PSPACE = k SPACE(nk) P = k TIME(nk) EXP = k TIME(2nk) April 5, 2017

Time and Space Classes Problems in these classes:  L : FVAL, integer multiplication, most reductions…   1 1 pasadena auckland athens PSPACE : generalized geography, 2-person games… san francisco davis oakland April 5, 2017

Time and Space Classes P : CVAL, linear programming, max-flow…       1 1 1 EXP : SAT, all of NP and much more… April 5, 2017

Relationships between classes How are these four classes related to each other? Time Hierarchy Theorem implies P ( EXP P µ TIME(2n) ( TIME(2(2n)3) µ EXP Space Hierarchy Theorem implies L ( PSPACE L = SPACE(log n) ( SPACE(log2 n) µ PSPACE April 5, 2017

Relationships between classes Easy: P µ PSPACE L vs. P, PSPACE vs. EXP ? April 5, 2017

Relationships between classes Useful convention: Turing Machine configurations. Any point in computation . . . σ1 σ2 … σi σi+1 … σm state = q represented by string: C = σ1 σ2 … σi q σi+1 σi+2… σm start configuration for single-tape TM on input x: qstartx1x2…xn April 5, 2017

Relationships between classes easy to tell if C yields C’ in 1 step configuration graph: nodes are configurations, edge (C, C’) iff C yields C’ in one step # configurations for a 2-tape TM (work tape + read-only input) that runs in space t(n) n x t(n) x |Q| x |∑|t(n) input-tape head position state work-tape contents work-tape head position April 5, 2017

Relationships between classes if t(n) = c log n, at most n x (c log n) x c0 x c1c log n ≤ nk configurations. can determine if reach qaccept or qreject from start configuration by exploring config. graph of size nk (e.g. by DFS) Conclude: L µ P April 5, 2017

Relationships between classes if t(n) = nc, at most n x nc x c0 x c1nc ≤ 2nk configurations. can determine if reach qaccept or qreject from start configuration by exploring config. graph of size 2nk (e.g. by DFS) Conclude: PSPACE µ EXP April 5, 2017

Relationships between classes So far: L µ P µ PSPACE µ EXP believe all containments strict know L ( PSPACE, P ( EXP even before any mention of NP, two major unsolved problems: L = P P = PSPACE ? ? April 5, 2017

A P-complete problem We don’t know how to prove L ≠ P But, can identify problems in P least likely to be in L using P- completeness. need stronger notion of reduction (why?) f yes yes f no no L1 L2 April 5, 2017

A P-complete problem logspace reduction: f computable by TM that uses O(log n) space denoted “L1 ≤L L2” If L2 is P-complete, then L2 in L implies L = P (homework problem) April 5, 2017

A P-complete problem Circuit Value (CVAL): given a variable-free Boolean circuit (gates , , , 0, 1), does it output 1? Theorem: CVAL is P-complete. Proof: already argued in P L arbitrary language in P, TM M decides L in nc steps April 5, 2017

A P-complete problem Tableau (configurations written in an array) for machine M on input w: … w1/qs w2 … wn _ height = time taken = |w|c width = space used ≤ |w|c … w1 w2/q1 … wn _ … w1/q1 a … wn _ ... ... … _/qa _ … _ _ April 5, 2017

A P-complete problem Important observation: contents of cell in tableau determined by 3 others above it: a/q1 b a a b/q1 a b/q1 a a b a b April 5, 2017

A P-complete problem Can build Boolean circuit STEP input (binary encoding of) 3 cells output (binary encoding of) 1 cell each output bit is some function of inputs can build circuit for each size is independent of size of tableau a b/q1 a STEP a April 5, 2017

A P-complete problem |w|c copies of STEP compute row i from i-1 Tableau for M on input w … w1/qs w2 … wn _ … w1 w2/q1 … wn _ ... ... |w|c copies of STEP compute row i from i-1 … STEP STEP STEP STEP STEP … April 5, 2017

A P-complete problem w1 w2 wn This circuit CM, w has inputs w1w2…wn and C(w) = 1 iff M accepts input w. logspace reduction Size = O(|w|2c) … w1/qs w2 … wn _ STEP STEP STEP STEP STEP STEP STEP STEP STEP STEP ... ... STEP STEP STEP STEP STEP ignore these 1 iff cell contains qaccept April 5, 2017

Answer to question NO! (probably) CVAL in L if and only if L = P Can we evaluate an n node Boolean circuit using O(log n) space?    NO! (probably) CVAL in L if and only if L = P    1 1 1 April 5, 2017

Padding and succinctness Two consequences of measuring running time as function of input length: “padding” suppose L  EXP, and define PADL = { x#N : x  L, N = 2|x|k } TM that decides PADL: ensure suffix of N #s, ignore #s, then simulate TM that decides L running time now polynomial ! April 5, 2017

Padding and succinctness converse (intuition only): “succinctness” suppose L is P-complete intuitively, some inputs are “hard” -- require full power of P SUCCINCTL has inputs encoded in different form than L, some exponentially shorter if “hard” inputs are exponentially shorter, then candidate to be EXP-complete April 5, 2017

Succinct encodings succinct encoding for a directed graph G= (V = {1,2,3,…}, E): a succinct encoding for a variable-free Boolean circuit: 1 iff (i, j)  E i j 1 iff wire from gate i to gate j type of gate i type of gate j i j April 5, 2017

An EXP-complete problem Succinct Circuit Value: given a succinctly encoded variable-free Boolean circuit (gates , , , 0, 1), does it output 1? Theorem: Succinct Circuit Value is EXP-complete. Proof: in EXP (why?) L arbitrary language in EXP, TM M decides L in 2nk steps April 5, 2017

An EXP-complete problem tableau for input x = x1x2x3…xn: Circuit C from CVAL reduction has size O(22nk). TM M accepts input x iff circuit outputs 1 x _ _ _ _ _ height, width 2nk April 5, 2017

An EXP-complete problem Can encode C succinctly: if i, j within single STEP circuit, easy to compute output if i, j between two STEP circuits, easy to compute output if one of i, j refers to input gates, consult x to compute output 1 iff wire from gate i to gate j type of gate i type of gate j i j April 5, 2017

Summary Remaining TM details: big-oh necessary. First complexity classes: L, P, PSPACE, EXP First separations (via simulation and diagonalization): P ≠ EXP, L ≠ PSPACE First major open questions: L = P P = PSPACE First complete problems: CVAL is P-complete Succinct CVAL is EXP-complete ? ? April 5, 2017

Summary EXP PSPACE P L April 5, 2017