Space Complexity




CS254

Chris Pollett

Oct. 17, 2011

Outline

Introduction

Definition of Space-Bounded Computation

Definition. Let `S:NN -> NN` and `L subseteq {0,1}^star`. We say that `L in SPACE(s(n))` if there is a constant `c` and a TM `M` deciding `L` such that at most `c cdot s(n)` locations on `M`'s work tapes are ever visited by `M"s` head during its computation on every input of length `n`. Similarly, we say `L in NSPACE(s(n))` if there is an NDTM `M` deciding `L` that never uses more than `c cdot s(n)` nonblank tape locations on length `n` inputs, regardless of its nondeterministic choices.

Notice we are only counting the work-tapes not the read-only input tape in the above definition. So it makes sense to take about sub-linear space. We do require that `s(n) > log n`; otherwise, we can't keep track of the index on the work tape we're reading from.

Definition. A function `s: NN -> NN` is space-constructible if there is a TM that computes `s(|x|)` in `O(s(|x|))` space given `x` as input.

We will mainly be interested in `s`'s which are space constructible.

Relationships

Theorem. For every space constructible `s:NN -> NN`:
`DTIME(s(n)) subseteq SPACE(s(n)) subseteq NSPACE(s(n)) subseteq DTIME(2^(O(s(n)))).`
`NTIME(s(n)) subseteq NSPACE(s(n))`

Quiz

Which of the following is true?

  1. If `f(n) = n` and `g(n) = n log log n` then the deterministic time hierarchy theorem says the `DTIME(f(n))` is strictly contained in `DTIME(g(n))`.
  2. Ladner's Theorem gives us an oracle relative to which `P^A ne NP^A`.
  3. Let `\log^star n` denote number of times the logarithm function must be iteratively applied before the result is less than or equal to 1. If `f(n) = n - 1` and `g(n) = n log^star n` then the nondeterministic time hierarchy theorem says the `NTIME(f(n))` is strictly contained in `NTIME(g(n))`.

Configuration Graphs

Properties of Configuration Graphs

Claim. Let `G_(m,x)` be the configuration graph of a space `s(n)` machine `M` on some input `x` of length `n`, then:

  1. Every vertex in `G_(m,x)` can be described using `c cdot s(n)` bits for some constant `c`. So `G_(M,x)` has at most `2^(c cdot s(n))` nodes.
  2. There is a `O(s(n))`-size CNF formula `phi_(M,x)` such that for every two strings `C, C'`, `phi_(M,x)(C,C') = 1` iff `C` and `C'` encode two neighboring configurations in `G_(M,x)`

Proof. (1) follows from observing that a configuration is completely described by giving the contents of all work tapes, the position of the head, and the TM state. (2) follows using similar ideas as in the proof of the Cook-Levin Theorem. There we showed deciding whether two configurations are neighbors can be expressed as the AND of many checks, each depending on only a constant number of bits, and such checks can be expressed by constant-sized CNF formulas by an earlier Claim. The number of variables will be proportional to the workspace.

Proof of Theorem

Clearly, `DTIME(s(n)) subseteq SPACE(s(n)) subseteq NSPACE(s(n))`. So it suffices to show `NSPACE(s(n)) subseteq DTIME(2^(O(s(n))))`. By enumerating over all possible configuration, we can construct the graph `G_(M,x)` in `2^(O(s(n)))`-time and check whether `C_(s\t\a\r\t)` is connected with `C_(a\c\c\e\p\t)`, using a standard breadth-first connectivety algorithm.

Common Space Complexity Classes

Definition.
`PSPACE = cup_(c>0) SPACE(n^c)`
`NPSPACE = cup_(c>0) NSPACE(n^c)`
`L = cup_(c>0) SPACE(c cdot log n)`
`NL = cup_(c>0) NSPACE(c cdot log n)`

Examples