Outline
- Space-bounded Computation
- Quiz
- Configuration Graphs
- Common Space Complexity Classes
Introduction
- So far we have been looking at complexity classes where we have bounded the runtime of the TMs involved.
- Another natural aspect of a TM to bound is the maximum number of tape-squares it uses.
- As we will see bounding space provides a natural model for what can be done by processors acting in parallel,
so has potential impact on real world phenomena.
- Space-bounded computations are also connected with how hard it is to find winning strategies in two player games such as chess.
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
- In time `DTIME(s(n))` we can visit at most `s(n)` tape squares, so `DTIME(s(n)) subseteq SPACE(s(n))`.
- In nondeteterminstic space `s(n)` we will end up repeating the contents of our tapes after `2^(O(s(n))` time steps.
- So intuitively, the following theorem should seem plausible (we will actually prove it later).
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 statements is true?
- Conflict driven clause learning might add clauses which affect whether or not the original set of clauses was satisfiable.
- The nondeterministic time hierarchy theorem implies `NTIME(n \cdot \log\log n)` strictly contains `NTIME(32 n)`. (We showed `32n` is time constructible and `n\log\log n` is too.)
- The deterministic time hierarchy theorem implies `DTIME(n \cdot \log\log n)` strictly contains `DTIME(32 n)`.
Configuration Graphs
- To prove the theorem of the previous slide we make use of the notion of a configuration graph of a TM.
- Recall a configuration of a TM `M` consists of the contents of all nonblank entries of `M`'s tapes, along with its state and head positions
at a particular point in its execution.
- For every space `s(n)` TM `M` and input `x`, the configuration graph `M` on input `x`, denoted by `G_(M,x)`, is a directed graph whose nodes correspond to all possible configurations of `M` where the graph contains the edge from a configuration `C` to a configuration `C'` if `C'` can be reached from `C` in one step according to `M`'s transition function.
- If we require `M` to erase all its work tapes before halting, we can assume that there is only a single configuration `C_(a\c\c\e\p\t)` on which `M` halts and outputs `1`.
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:
- 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.
- 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
- `3SAT in PSPACE`: In linear space enumerate each truth assignment to the input instance, then in linear time (hence, space), check if it works.
- The grade school algorithms show that the set of even numbers and the graph of multiplication are in `L`.