Space hierarchy theorem
In computational complexity theory, the space hierarchy theorems are separation results that show that both deterministic and nondeterministic machines can solve more problems in more space, subject to certain conditions. For example, a deterministic Turing machine can solve more decision problems in space n log n than in space n. The somewhat weaker analogous theorems for time are the time hierarchy theorems.
The foundation for the hierarchy theorems lies in the intuition that with either more time or more space comes the ability to compute more functions. The hierarchy theorems are used to demonstrate that the time and space complexity classes form a hierarchy where classes with tighter bounds contain fewer languages than those with more relaxed bounds. Here we define and prove the space hierarchy theorem.
The space hierarchy theorems rely on the concept of space-constructible functions. The deterministic and nondeterministic space hierarchy theorems state that for all space-constructible functions and all,
where SPACE stands for either DSPACE or NSPACE, and refers to the little o notation.
Statement
Formally, a function is space-constructible if and there exists a Turing machine which computes the function in space when starting with an input, where represents a string of n consecutive 1s. Most of the common functions that we work with are space-constructible, including polynomials, exponents, and logarithms.For every space-constructible function, there exists a language that is decidable in space but not in space.
Proof
The goal is to define a language that can be decided in space but not space. The language is defined as :For any machine that decides a language in space, will differ in at least one spot from the language of. Namely, for some large enough, will use space. The algorithm for deciding the language is as follows:
- On an input, compute using space-constructibility, and mark off cells of tape. Whenever an attempt is made to use more than cells, reject.
- If is not of the form for some TM, reject.
- Simulate on input for at most steps. If the simulation tries to use more than space or more than operations, then reject.
- If accepted during this simulation, then reject; otherwise, accept.
The above proof holds for the case of PSPACE, but some changes need to be made for the case of NPSPACE. The crucial point is that while on a deterministic TM, acceptance and rejection can be inverted, this is not possible on a non-deterministic machine.
For the case of NPSPACE, needs to be redefined first:
Now, the algorithm needs to be changed to accept by modifying step 4 to:
- If accepted during this simulation, then accept; otherwise, reject.
- If is not in then will accept it, therefore rejects, therefore is in .
- If is in then will reject it, therefore accepts, therefore is not in .
Comparison and improvements
The space hierarchy theorem is stronger than the analogous time hierarchy theorems in several ways:- It only requires s to be at least log n instead of at least n.
- It can separate classes with any asymptotic difference, whereas the time hierarchy theorem requires them to be separated by a logarithmic factor.
- It only requires the function to be space-constructible, not time-constructible.
- It only requires to be space-constructible, with no constraint on the constructability of.
- However, it is known from results in axiomatic complexity theory that the theorem is false if is not required to be space-constructible.
- It relaxes the space-constructibility requirement. Let be a nondeterministically fully space-constructible function. Let be an arbitrary function, and be a computable function. These functions need not be space-constructible or even monotone increasing. Then and.
- It identifies a unary language, or tally language, which is in one class but not the other. In the original theorem, the separating language was arbitrary.
- It does not require to be at least log n; it can be any nondeterministically fully space-constructible function.
Refinement of space hierarchy
If space is measured as the number of cells used regardless of alphabet size, then because one can achieve any linear compression by switching to a larger alphabet. However, by measuring space in bits, a much sharper separation is achievable for deterministic space. Instead of being defined up to a multiplicative constant, space is now defined up to an additive constant. However, because any constant amount of external space can be saved by storing the contents into the internal state, we still have.Assume that f is space-constructible. SPACE is deterministic.
- For a wide variety of sequential computational models, including for Turing machines, SPACE-ω) ⊊ SPACE. This holds even if SPACE-ω) is defined using a different computational model than because the different models can simulate each other with space overhead.
- For certain computational models, we even have SPACE-ω) ⊊ SPACE. In particular, this holds for Turing machines if we fix the alphabet, the number of heads on the input tape, the number of heads on the worktape, and add delimiters for the visited portion of the worktape. SPACE does not depend on whether the worktape is infinite or semi-infinite. We can also have a fixed number of worktapes if f is either a SPACE constructible tuple giving the per-tape space usage, or a SPACE-ω-constructible number giving the total space usage.
Modify the machine to erase everything and go to a specific configuration A on success. Use depth-first search to determine whether A is reachable in the space bound from the starting configuration. The search starts at A and goes over configurations that lead to A. Because of determinism, this can be done in place and without going into a loop.
It can also be determined whether the machine exceeds a space bound by iterating over all configurations about to exceed the space bound and checking whether the initial configuration leads to any of them.
Corollaries
Corollary 1
For any two functions,, where is and is space-constructible,.This corollary lets us separate various space complexity classes.
For any natural number k, the function is space-constructible. Therefore for any two natural numbers we can
prove.
Corollary 2
Proof
Savitch's theorem shows that, while the space hierarchy theorem shows that. The result is this corollary along with the fact that TQBF ∉ NLsince TQBF is PSPACE-complete.
This could also be proven using the non-deterministic space hierarchy theorem to show that NL ⊊ NPSPACE, and using Savitch's theorem to show that PSPACE = NPSPACE.