Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

Similar documents
Lecture 22: PSPACE

CSE200: Computability and complexity Space Complexity

Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26

Lecture 3. 1 Terminology. 2 Non-Deterministic Space Complexity. Notes on Complexity Theory: Fall 2005 Last updated: September, 2005.

SOLUTION: SOLUTION: SOLUTION:

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

Polynomial Hierarchy

Space and Nondeterminism

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

Lecture 21: Space Complexity (The Final Exam Frontier?)

Notes on Space-Bounded Complexity

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan 9/6/2004. Notes for Lecture 3

6.045 Final Exam Solutions

Notes on Space-Bounded Complexity

Undirected ST-Connectivity in Log-Space. Omer Reingold. Presented by: Thang N. Dinh CISE, University of Florida, Fall, 2010

Computability and Complexity CISC462, Fall 2018, Space complexity 1

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Review of Basic Computational Complexity

CSCI 1590 Intro to Computational Complexity

NP-completeness was introduced by Stephen Cook in 1971 in a foundational paper.

Lecture 8. MINDNF = {(φ, k) φ is a CNF expression and DNF expression ψ s.t. ψ k and ψ is equivalent to φ}

CSCI 1590 Intro to Computational Complexity

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

PSPACE, NPSPACE, L, NL, Savitch's Theorem. More new problems that are representa=ve of space bounded complexity classes

1 PSPACE-Completeness

Notes on Complexity Theory Last updated: October, Lecture 6

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

Advanced topic: Space complexity

Complexity Theory 112. Space Complexity

The Polynomial Hierarchy

Lecture 8: Complete Problems for Other Complexity Classes

Introduction to Computational Complexity

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Time and space classes

CS151 Complexity Theory. Lecture 4 April 12, 2017

Lecture 23: More PSPACE-Complete, Randomized Complexity

Time Complexity. Definition. Let t : n n be a function. NTIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM}

Lecture 7: The Polynomial-Time Hierarchy. 1 Nondeterministic Space is Closed under Complement

CSCI 1590 Intro to Computational Complexity

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

Circuits. Lecture 11 Uniform Circuit Complexity

CS154, Lecture 17: conp, Oracles again, Space Complexity

Computational Complexity IV: PSPACE

Space Complexity. Huan Long. Shanghai Jiao Tong University

Introduction to Complexity Classes. Marcin Sydow

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

Space Complexity. The space complexity of a program is how much memory it uses.

More Complexity. Klaus Sutner Carnegie Mellon University. Fall 2017

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

PSPACE COMPLETENESS TBQF. THURSDAY April 17

Resource-Bounded Computation

Computational Complexity Theory

Principles of Knowledge Representation and Reasoning

Lecture 8: Alternatation. 1 Alternate Characterizations of the Polynomial Hierarchy

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18

Non-Deterministic Time

DRAFT. Diagonalization. Chapter 4

conp, Oracles, Space Complexity

1 Deterministic Turing Machines

Umans Complexity Theory Lectures

NP Complete Problems. COMP 215 Lecture 20

Parallelism and Machine Models

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary.

INAPPROX APPROX PTAS. FPTAS Knapsack P

POLYNOMIAL SPACE QSAT. Games. Polynomial space cont d

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

Lecture 10: Boolean Circuits (cont.)

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Lecture 5: The Landscape of Complexity Classes

Definition: conp = { L L NP } What does a conp computation look like?

6.840 Language Membership

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

MTAT Complexity Theory October 13th-14th, Lecture 6

CSC 5170: Theory of Computational Complexity Lecture 4 The Chinese University of Hong Kong 1 February 2010

Computability and Complexity Theory: An Introduction

Time-Space Tradeoffs for SAT

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

COMPLEXITY THEORY. Lecture 17: The Polynomial Hierarchy. TU Dresden, 19th Dec Markus Krötzsch Knowledge-Based Systems

MTAT Complexity Theory October 20th-21st, Lecture 7

COS 522: Computational Complexity Princeton University, Spring 2001 Lecturer: Sanjeev Arora

Hierarchy theorems. Evgenij Thorstensen V18. Evgenij Thorstensen Hierarchy theorems V18 1 / 18

Chapter 9. PSPACE: A Class of Problems Beyond NP. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

BARRIERS IN COMPLEXITY THEORY

Algorithms & Complexity II Avarikioti Zeta

Lecture 3: Reductions and Completeness

9. PSPACE 9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete

9. PSPACE. PSPACE complexity class quantified satisfiability planning problem PSPACE-complete

UNIT-IV SPACE COMPLEXITY

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

Could we potentially place A in a smaller complexity class if we consider other computational models?

Transcription:

Space Complexity

Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

Synopsis 1. Space Bounded Computation 2. Logspace Reduction 3. PSPACE Completeness 4. Savitch Theorem 5. NL Completeness 6. Immerman-Szelepcsényi Theorem Computational Complexity, by Fu Yuxi Space Complexity 2 / 44

Space Bounded Computation Computational Complexity, by Fu Yuxi Space Complexity 3 / 44

Space Bounded Computation Let S : N N and L {0, 1}. We say that L SPACE(S(n)) if there is some c and some TM deciding L that never uses more than cs(n) nonblank worktape locations on inputs of length n. Computational Complexity, by Fu Yuxi Space Complexity 4 / 44

Space Constructible Function Suppose S : N N and S(n) log(n). 1. S is space constructible if there is a Turing Machine that computes the function 1 n S(n) in O(S(n)) space. 2. S is space constructible if there is a Turing Machine that upon receiving 1 n uses exactly S(n)-space. The second definition is slightly less general than the first. Computational Complexity, by Fu Yuxi Space Complexity 5 / 44

Space Bounded Computation, the Nondeterministic Case L NSPACE(S(n)) if there is some c and some NDTM deciding L that never uses more than cs(n) nonblank worktape locations on inputs of length n, regardless of its nondeterministic choices. For space constructible function S(n) we could allow a machine in NSPACE(S(n)) to diverge and to use more than cs(n) space in unsuccessful computation paths. Computational Complexity, by Fu Yuxi Space Complexity 6 / 44

Configuration A configuration of a running TM M consists of the following: the state; the contents of the work tapes; the head positions. We write C start for the unique initial configuration. We assume that there is a single accepting configuration C accept. Computational Complexity, by Fu Yuxi Space Complexity 7 / 44

Configuration Graph A configuration graph G M,x of M with input x is a directed graph: the nodes are configurations; the arrows are one-step computations. M accepts x iff there is a path in G M,x from C start to C accept. Computational Complexity, by Fu Yuxi Space Complexity 8 / 44

Reachability Predicate for Configuration Graph Suppose M is an S(n)-space TM. A vertex of G M,x is described using O(S( x )) bits. Therefore G M,x has at most 2 O(S( x )) nodes. There is an O(S(n))-size CNF ϕ M,x such that for every two configurations C and C, ϕ M,x (C, C ) = 1 iff C C is an edge in G M,x. ϕ M,x (C, C ) can be checked by essentially comparing C and C bit by bit. It can be accomplished in either O(S(n)) time, or O(log S(n)) space. Computational Complexity, by Fu Yuxi Space Complexity 9 / 44

Space vs. Time Theorem. Suppose S(n) : N N is space constructible. Then TIME(S(n)) SPACE(S(n)) NSPACE(S(n)) TIME(2 O(S(n)) ). An algorithm proving that NSPACE(S(n)) TIME(2 O(S(n)) ) starts by constructing G M,x in 2 O(S(n)) time, and then applies the breadth first search algorithm to G M,x. Computational Complexity, by Fu Yuxi Space Complexity 10 / 44

Space vs. Time Theorem. For all space constructible S(n), TIME(S(n)) SPACE(S(n)/ log S(n)). 1. Hopcroft, Paul and Valiant. On Time versus Space and Related Problems. FOCS, 1975. Computational Complexity, by Fu Yuxi Space Complexity 11 / 44

Space Complexity Class PSPACE NPSPACE L NL def = c>0 SPACE(n c ), def = c>0 NSPACE(n c ), def = SPACE(log(n)), def = NSPACE(log(n)). Computational Complexity, by Fu Yuxi Space Complexity 12 / 44

Games are Harder than Puzzles NP PSPACE. Computational Complexity, by Fu Yuxi Space Complexity 13 / 44

Example The following problems are in L: EVEN PLUS MULP def = {x x has an even number of 1 s}, def = {( m, n, m + n ) m, n N}, def = {( m, n, m n ) m, n N}. Computational Complexity, by Fu Yuxi Space Complexity 14 / 44

PATH is in NL PATH = { G, s, t there is a path from s to t in the digraph G}. Theorem. PATH NL. Proof. Both a node and a counter can be stored in logspace. Computational Complexity, by Fu Yuxi Space Complexity 15 / 44

Universal Turing Machine without Space Overhead Theorem. There is a universal TM that operates without space overhead for input TM s with space complexity log(n). A universal TM can simulate M α by recording all the non-blank tape content of M α in its single work tape. A counter is used to store the location of the reader at x. Some additional space, whose size depends only on M α, is needed for bookkeeping. Computational Complexity, by Fu Yuxi Space Complexity 16 / 44

Space Hierarchy Theorem Theorem. If f, g are space constructible such that f (n) = o(g(n)), then SPACE(f (n)) SPACE(g(n)). We design V by modifying the universal machine so that V(x) simulates M x (x), and it stops when it is required to use more than g(n) space, and it negates the result after it completes simulation. If V was executed in f (n) space, then V = M α for some large enough α so that V can complete the simulation of M α on α. But then M α (α) = V(α) = M α (α). 1. J. Hartmanis and R. Stearns. On the Computational Complexity of Algorithms. Transactions of AMS, 117:285-306, 1965. Computational Complexity, by Fu Yuxi Space Complexity 17 / 44

Logspace Reduction Computational Complexity, by Fu Yuxi Space Complexity 18 / 44

Logspace Reduction A function f : {0, 1} {0, 1} is implicitly logspace computable if the following hold: 1. c. x. f (x) c x c, 2. { x, i i f (x) } L and 3. { x, i f (x) i = 1} L. Problem B is logspace reducible to problem C, written B L C, if there is an implicitly logspace computable f such that x B iff f (x) C. Logspace reductions are of Karp style. All known NP-completeness results can be established using logspace reduction. Computational Complexity, by Fu Yuxi Space Complexity 19 / 44

Transitivity of Logspace Reduction Lemma. If B L C and C L D then B L D. Let M f, M g be logspace machines that compute x, i f (x) i respectively y, j g(y) j. We construct a machine that, given input x, j with j g(f (x)), outputs g(f (x)) j. The machine operates as if f (x) were stored on a virtual tape. It stores the address i of the current cell of the virtual tape. It uses O(log f (x) ) = O(log x ) space to calculate g(f (x))j. Computational Complexity, by Fu Yuxi Space Complexity 20 / 44

Logspace Computability A function f : {0, 1} {0, 1} is logspace computable if it can be computed by a TM that has a write-once output tape using O(log n) work tape space. Lemma. Implicitly logspace computability = logspace computability. Computational Complexity, by Fu Yuxi Space Complexity 21 / 44

PSPACE Completeness Computational Complexity, by Fu Yuxi Space Complexity 22 / 44

Space Completeness A language L is PSPACE-hard if L L L for every L PSPACE. If in addition L PSPACE then L is PSPACE-complete. Computational Complexity, by Fu Yuxi Space Complexity 23 / 44

Quantified Boolean Formula A quantified Boolean formula (QBF) is a formula of the form Q 1 x 1 Q 2 x 2... Q n x x.ϕ(x 1,..., x n ) where each Q i is one of the two quantifiers,, x 1,..., x n range over {0, 1}, and ϕ is a quantifier free Boolean formula containing no free variables other than x 1,..., x n. Let TQBF be the set of true QBFs. Computational Complexity, by Fu Yuxi Space Complexity 24 / 44

Quantified Boolean Formula Suppose ϕ is a CNF. ϕ SAT if and only if x.ϕ TQBF. ϕ TAUTOLOGY if and only if x.ϕ TQBF. Computational Complexity, by Fu Yuxi Space Complexity 25 / 44

Theorem. TQBF is PSPACE-complete. 1. Larry Stockmeyer, Albert Meyer. Word Problems Requiring Exponential Time. STOC 1973. Computational Complexity, by Fu Yuxi Space Complexity 26 / 44

Proof of Stockmeyer-Meyer Theorem TQBF PSPACE. Suppose ψ = Q 1 x 1 Q 2 x 2... Q n x x.ϕ(x 1,..., x n ). A counter of length n can be identified to an assignment. Apply the depth first tree traversal. We actually have a linear space algorithm. Computational Complexity, by Fu Yuxi Space Complexity 27 / 44

Proof of Stockmeyer-Meyer Theorem Let M be a TM that decides L in polynomial, say S(n) space. We reduce x {0, 1} to a QBF ϕ x of size O(S( x ) 2 ) in logspace such that M(x) = 1 iff ϕ x is true. 1. Construct in logspace ψ 0 such that ψ 0 (C, C ) is true if and only if C C. 2. Let ψ i (C, C ) be true if and only if there exists a path of length 2 i from C to C. The following formula can be computed in logspace. C D 1 D 2.((D 1 =C D 2 =C ) (D 1 =C D 2 =C )) ψ i 1 (D 1, D 2 ). 3. Now ψ i = ψ i 1 + O(S( x )). Hence ψ = O(S( x ) 2 ). Computational Complexity, by Fu Yuxi Space Complexity 28 / 44

QBF Game Two players make alternating moves on the board x 1 x 2 x 3 x 4 x 2n 1 x 2n.ϕ(x 1,..., x n ). Player I moves first. It has a winning strategy if ϕ is true after Player II s last move, no matter how Player II plays. Deciding if Player I has a winning strategy for QBF game is PSPACE-complete. 1. Christos Papadimitriou. Games Against Nature. FOCS, 1983. Computational Complexity, by Fu Yuxi Space Complexity 29 / 44

Savitch Theorem Computational Complexity, by Fu Yuxi Space Complexity 30 / 44

Savitch Theorem Theorem. If S is space constructible then NSPACE(S(n)) SPACE(S(n) 2 ). Suppose N is an NDTM that decides L in S(n) space. Given x {0, 1}, a divide-and-conquer depth first algorithm can be designed that searches for a path from C start to C accept in G N,x. The depth of recursive calls is S( x ). 1. W. Savitch. Relationships between Nondeterministic and Deterministic Tape Complexities. JCSS, 177-192, 1970. Computational Complexity, by Fu Yuxi Space Complexity 31 / 44

PSPACE = NPSPACE Computational Complexity, by Fu Yuxi Space Complexity 32 / 44

NL Completeness Computational Complexity, by Fu Yuxi Space Complexity 33 / 44

NL-Completeness C is NL-complete if it is in NL and for every B NL, B L C. Computational Complexity, by Fu Yuxi Space Complexity 34 / 44

NL-Completeness Theorem. PATH is NL-complete. Suppose a nondeterministic TM N decides L in O(log(n)). The logspace reduction from L to PATH is defined by x G N,x, C start, C accept. The graph G N,x is represented by an adjacent matrix, every bit of it can be calculated in O( C ) = O(log x ) space. We may assume that all space bounded TM s terminate by making use of counters. It follows that PATH remains NL-complete if only acyclic graphs are admitted. Computational Complexity, by Fu Yuxi Space Complexity 35 / 44

NL is nothing but PATH. Computational Complexity, by Fu Yuxi Space Complexity 36 / 44

Immerman-Szelepcsényi Theorem Computational Complexity, by Fu Yuxi Space Complexity 37 / 44

Savitch Theorem implies conpspace = NPSPACE. But conl = NL is a different story. Computational Complexity, by Fu Yuxi Space Complexity 38 / 44

Immerman-Szelepcsényi Theorem Theorem. PATH NL. 1. R. Szelepcsényi. The Method of Forcing for Nondeterministic Automata. Bulletin of EATCS, 1987. 2. N. Immerman. Nondeterministic Space is Closed under Complementation. SIAM Journal Computing, 1988. Computational Complexity, by Fu Yuxi Space Complexity 39 / 44

Proof of Immerman-Szelepcsényi Theorem Design a logspace NDTM N such that for vertices s, t of a graph G with n-vertices, N( G, s, t ) = 1 iff there is no path from s to t. For i [n 1], let C i be the set of nodes reachable from s in i-steps, and let c i = C i. Notice that c 1 can be computed in logspace. We can store a fixed number of c i s, but we cannot store any of C i s. Set c i+1 = 0. For each vertex v s, N guesses C i and increments c i+1 if either v C i or u v for some u C i. For each u in C i check that s u in i steps. This is PATH. A counter is maintained to ensure that C i = c i. After c n 1 has been calculated, guess C n 1 and accept if t / C n 1. Computational Complexity, by Fu Yuxi Space Complexity 40 / 44

Immerman-Szelepcsényi Theorem Corollary. For every space constructible S(n) log(n), one has conspace(s(n)) = NSPACE(S(n)). Computational Complexity, by Fu Yuxi Space Complexity 41 / 44

Theorem. 2SAT is NL-complete. Given G, s, t, where G is acyclic, we translate an edge x y to the clause x y. We also add clauses s and t. This is a logspace reduction from acyclic PATH to 2SAT. Computational Complexity, by Fu Yuxi Space Complexity 42 / 44

By Hierarchy Theorems some of the following inclusions are strict. Yet we don t know which is strict. L NL P NP PSPACE EXP. It is widely believed that NL P. L? = NL is a major open problem in the structural theory. Computational Complexity, by Fu Yuxi Space Complexity 43 / 44

Let UPATH be the path problem on undirected graph. 1. UPATH NL. 2. UPATH has a straightforward randomized algorithm. 3. UPATH L. Computational Complexity, by Fu Yuxi Space Complexity 44 / 44