CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Similar documents
CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Space Complexity. Huan Long. Shanghai Jiao Tong University

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

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

Introduction to Computational Complexity

Computability and Complexity CISC462, Fall 2018, Space complexity 1

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

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

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

Complexity Theory 112. Space Complexity

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

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

Lecture 22: PSPACE

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

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

CS151 Complexity Theory. Lecture 4 April 12, 2017

6.045 Final Exam Solutions

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

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

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

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

CS5371 Theory of Computation. Lecture 24: Complexity IX (PSPACE-complete, L, NL, NL-complete)

CSCI 1590 Intro to Computational Complexity

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

Computational Complexity

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

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

UNIT-IV SPACE COMPLEXITY

SOLUTION: SOLUTION: SOLUTION:

Time and space classes

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

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

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

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

conp, Oracles, Space Complexity

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

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

Lecture 3: Reductions and Completeness

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

CS4026 Formal Models of Computation

Advanced topic: Space complexity

Computational Complexity IV: PSPACE

CSCI 1590 Intro to Computational Complexity

Notes on Space-Bounded Complexity

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

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

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

Turing Machines Part II

Computability Theory

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

6.840 Language Membership

Notes on Space-Bounded Complexity

INAPPROX APPROX PTAS. FPTAS Knapsack P

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

Computability Theory. CS215, Lecture 6,

CS256 Applied Theory of Computation

Principles of Knowledge Representation and Reasoning

Chapter 7: Time Complexity

Review of Basic Computational Complexity

Lecture 24: Randomized Complexity, Course Summary

Polynomial Space. The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem

More Complexity. Klaus Sutner Carnegie Mellon University. Fall 2017

Lecture 5: The Landscape of Complexity Classes

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

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

Computability Theory

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

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}

Advanced Topics in Theoretical Computer Science

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

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

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

CSCI 1590 Intro to Computational Complexity

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

Homework Assignment 6 Answers

Boolean circuits. Lecture Definitions

Exam Computability and Complexity

Complexity (Pre Lecture)

The Complexity of Optimization Problems

where Q is a finite set of states

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

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

Computational Models Lecture 11, Spring 2009

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

Theory of Computation Time Complexity

Further discussion of Turing machines

CS154 Final Examination

Computability and Complexity

Lecture 16: Time Complexity and P vs NP

Introduction to Complexity Classes. Marcin Sydow

Review of unsolvability

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

Time to learn about NP-completeness!

CSCI 1590 Intro to Computational Complexity

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

Transcription:

CS5371 Theory of Computation Lecture 23: Complexity VIII (Space Complexity)

Objectives Introduce Space Complexity Savitch s Theorem The class PSPACE

Space Complexity Definition [for DTM]: Let M be a DTM that halts on all inputs. The space complexity of M is a function f: N N, where f(n) is the maximum number of tape cells that M scans on any input of length n If the space complexity of M is f(n), we say M runs in space f(n)

Space Complexity (2) Definition [for NTM]: Let M be an NTM that all branches halt on all inputs. The space complexity of M, f(n), will be the maximum number of tape cells that M scans on any branch of its computation for any input of length n Again, if the space complexity of M is f(n), we say M runs in space f(n)

Space Complexity Classes Definition: Let f: N R be a function. We define two notation for describing space complexity classes as follows: SPACE(f(n)) = { L L is a language decided by a DTM M that runs in f(n) space } NSPACE(f(n)) = { L L is a language decided by an NTM M that runs in f(n) space }

Example 1 Theorem: SAT is in SPACE(n) Proof: The following DTM M decides SAT: M = On input F, 1. For each truth assignment, (a) Evaluate F on that truth assignment 2. If F is evaluated to TRUE in some case, accept. Otherwise, reject. The space usage is O(length of F ). Why??

Example 2 Let ALL NFA be the language { M M is an NFA and L(M) = * } Theorem: ALL NFA is in co-nspace(n). I.e., the complement of ALL NFA is in NSPACE(n) Note that we still do not know if ALL NFA is in NP, or in co-np.

Example 2 (cont.) Proof Idea: We shall construct an NTM S that decides the complement of ALL NFA Question: When will an NFA M belongs to the complement of ALL NFA? Answer: when it rejects some string (of length at most 2 q, where q = # of states in M) Based on this idea, the NTM S in the next slide decides the complement of ALL NFA :

S = On input M, Example 2 (cont.) 1. Place a marker on start state of NFA 2. Guess an input string w of length 2 q where q = number of states in M 3. Simulate the running of M on w, by updating the set of states with marker after reading a character from w 4. If at some point no accept states of M is marked, accept. Otherwise, reject.

Example 2 (cont.) Question 1: Why is the previous decider correctly decides the complement of ALL NFA? Note that currently, only strings of length 2 q is examined Question 2: Is the space complexity O(length of input)?

Example 2 (cont.) The previous NTM S has space problem We now modify it a bit to give S in the next slide, which decides the complement of ALL NFA in O(length of input) space:

S = On input M, Example 2 (cont.) 1. Place a marker on start state of NFA 2. Repeat 2 q times, where q = # of states in M (a) Guess the next input symbol and update the set of states with marker to simulate reading of that symbol 3. If at some point no accept states of M is marked, accept. Otherwise, reject. Guess symbols one by one, instead of guess whole string at the beginning

Savitch s Theorem Theorem: Let f: N R be a function, with f(n) n. Then, NSPACE(f(n))µSPACE((f(n)) 2 ) Proof: Suppose language A can be decided by an NTM in k f(n) space, for some constant k. We shall show that it can be decided by a DTM in O((f(n)) 2 ) space

Savitch s Theorem (2) A naïve approach is to simulate all branches of the NTM s computation, one by one, using DTM. To do so, we need to keep track of which branch we are testing (that is, the choices made in each branch). Unfortunately, a branch in the NTM may have 2 O(f(n)) steps (though it uses O(f(n)) space), so that we may need 2 O(f(n)) space NOT GOOD

Savitch s Theorem (3) Instead, we solve the yieldability problem, such that given two configurations c 1 and c 2 of the NTM N, we want to decide whether c 2 can be yielded from c 1, in some number of steps For this purpose, let us define a recursive function, called CAN_YIELD(c 1,c 2,t), the checks if c 1 can yield c 2 in t steps as follows (next slide)

Function CAN_YIELD(c 1,c 2,t) { } 1. If t = 1, test whether c 1 = c 2 or whether c 1 yields c 2 in one step using the rule of NTM N. Accept if either test succeeds; Reject otherwise. 2. For each config c m using k f(n) space: a. Run CAN_YIELD(c 1,c m,t/2) b. Run CAN_YIELD(c m,c 2,t/2) c. If both accept, accept 3. If haven t accept yet, reject

Savitch s Theorem (4) We modify N a bit, and define some terms: We modify N so that when it accepts, it clears the tape and moves the tape head to leftmost cell. We denote such a configuration c accept Let c start = start configuration of N on w Select a constant d such that N has at most 2 d f(n) configurations (which is the upper bound of N s running time)

Savitch s Theorem (5) Based on this new N, there exists a DTM M that simulates N as follows: M = On input w, 1. Output the result CAN_YIELD(c start,c accept, 2 d f(n) ) Question: What is space usage of M?

Savitch s Theorem (6) When CAN_YIELD invokes itself recursively, it needs to store c 1, c 2, t, and the configuration c m it is testing (so that these values can be restored upon return from the recursive call) Each level of recursion uses O(f(n)) space Height of recursion: df(n) = O(f(n)) Total space = O((f(n)) 2 )

PSPACE and NSPACE Definition: PSPACE is the class of languages that are decidable in polynomial space by a DTM. In other words, PSPACE =[ k SPACE(n k ) Similarly, we can define NPSPACE to be the class of languages that are decidable in polynomial space by a NTM. So, what is the relationship between PSPACE and NPSPACE?

PSPACE = NPSPACE Theorem: PSPACE = NPSPACE Proof: By Savitch s Theorem.

PSPACE = co-npspace Theorem: PSPACE = co-npspace We first prove PSPACEµco-NPSPACE: We see that PSPACE = co-pspace (why?), and co-pspaceµ co-npspace (why?) We next prove co-npspaceµpspace: We see that PSPACE = co-pspace, and co-npspaceµ co-pspace (Savitch)

P, NP, and PSPACE Theorem: P µ PSPACE Proof: If a language is decided by some DTM M in f(n) time, M cannot see more than f(n) cells. Thus, TIME(f(n))µ SPACE(f(n)), so that Pµ PSPACE Theorem: NP µ PSPACE

PSPACE and EXPTIME Theorem: PSPACE µ EXPTIME Proof: If a language is decided by some DTM M in f(n) space (where f(n) n), M can visit at most f(n) 2 O(f(n)) configurations (why?) Thus, M must run in f(n) 2 O(f(n)) time. In other words, SPACE(f(n))µTIME(2 O(f(n)) ), so that PSPACEµ EXPTIME

Summary PµNPµPSPACE = NPSPACEµ EXPTIME It is shown in Chapter 9 that P EXPTIME, so that we know at least one of the above containment (µ) must be proper (½) Unfortunately, at this moment, we still don t know which one(s) is proper. What most researchers believe is all are proper.

Next Time PSPACE-complete L and NL NL-complete