320 COMPUTATIONAL COMPLEXITY
length < s(n) + [lognl + [IQ11 + 2. It is easy to see that we can define a
linear ordering 4 over configurations in CS such that the relation a! 4 /3 can
be verified by a DTM in space O(s( n)).
The construction of the NTM that accepts L(M) is divided into three steps.
First we observe that the predicate reach(a, ,8, Ic) is acceptable by an NTM
A41 in space O(s(n) + log Ic), if a and @ are from CZ. The NTM A41 operates
as follows:
Muchine Ml. Let a0 = QI. For each i = 0,... , k - 2, A41 guesses a
configuration a’i+l E CZ and verifies that atli = ai+l or CQ kM ai+l.
(If neither ai = cra+l nor aa kM ai+l holds, then Ml rejects on
this computation path.) Finally, Ml verifies that cq+1 = p or
ak-1 kM ,9, and accepts if this holds.
Apparently, this NTM Ml uses space O(s(n) + log k) and accepts (a!, p, k)
if and only if reach (a, ,8, Ic).
Next, we apply this machine Ml to construct another NTM A& which, on
any given configuration p, computes the exact number N of configurations in
CX that are reachable from /3, using space O(s(n)). (Note: M2 is an NTM
transducer .)
Let m be the maximum length of an accepting path on input X. Then,
T-L!= ‘J0(44). To computer N, Mz computes iteratively the number Nk
of configurations in CX that are reachable from ,8 in at most k moves, for
k = 0,.. ., nz + 1. When it finds, at stage k + 1, that Nk = Nk+l, it halts and
outputs N = &.
To compute &, we first note that NO = 1, since p is the only configuration
reachable from p in zero move. Next, for k > 0, &+I can be computed from
Nk by the following nondeterministic transducer:
Nondeterministic algorithm for computing Nk+l: