13.2 Space-Bounded Complexity Classes 187
At this point we want to make a few comments about the class CSL for
those who are familiar with the classes in the Chomsky hierarchy. Context
sensitive languages are defined by context-sensitive grammars (for more infor-
mation see, for example, Hopcroft, Motwani, and Ullman (2001)). Except for
the generation of the empty string, context-sensitive languages are monotone,
that is, the right side of each rule is not shorter than the left side. This allows
the following nondeterministic algorithm that checks if x ∈ L for a context-
sensitive language L.Ontheworktapearegionoflength|x| is marked. This is
where a derivation starting with the start symbol will be nondeterministically
generated. Derivations that do not stay within the space bounds indicated by
the marked cells are terminated and x is rejected. Otherwise, the sequence
generated is compared with the input x after every step. If they are found to
be equal, x is accepted. This shows that
CSL ⊆ NTAPE(n). We will omit the
proof of the other direction but state the result in the following theorem.
Theorem 13.2.3.
CSL = NTAPE(n).
This theorem shows that complexity classes based on space bounds can be
used to characterize important classes of problems.
Connections between time and space bounds are interesting. The basic
idea of the following consideration is simple. If a computation with restricted
space uses too much time, then it must repeat a configuration (see Section 5.4).
A configuration is an instantaneous snapshot of a Turing machine. The set
of all possible configurations for an input of length n can be described by
Q×{1,...,n}×{1,...,s(n)}×Γ
s(n)
, that is, by giving the current state q ∈ Q,
the position i ∈{1,...,n} on the input tape, the position j ∈{1,...,s(n)}
on the work tape, and the contents y ∈ Γ
s(n)
of the work tape. If there is
an accepting computation path, then there is an accepting computation path
that does not repeat any configurations and therefore has length at most
|Q|·n·s(n)·|Γ |
s(n)
=2
O(log n+s(n))
. Since we can count computation steps, we
can terminate computation paths that have not halted after |Q|·n·s(n)·|Γ |
s(n)
steps and reject the input along these paths. The only requirement is that s(n)
can be computed from n in time 2
O(log n+s(n))
.Thisistrueofall“reasonable”
space bounds. So we make the following remark:
Remark 13.2.4. If s(n) can be computed in space s(n) and in time bounded by
2
O(log n+s(n))
, then deterministic Turing machines using at most s(n) space can
be simulated by Turing machines that use space s(n)andtime2
O(log n+s(n))
.
The same is true for nondeterministic Turing machines.
Between space and time there is at most an exponential blow-up if s(n) ≥
log n. Space bounds s(n)=o(log n) are a special case, since the position
on the input tape can serve as auxiliary storage. This explains why some of
the results that follow begin with the assumption that s(n) ≥ log n.From
Remark 13.2.4 it follows immediately that
DTAPE(log n) ⊆ P.