The Nonterminal Symbols of Gx
The Production Rules of Gx
In some cases it is of interest to study the limitations of some subclasses of P. The motivation might be theoretical, as in the case of the subclass NLOG of P, or practical, as in the case of the subclass U_NC of the problems in P that can be solved by efficient parallel programs (see Section 7.5). In such cases the notion of the "hardest" problems in P is significant.
Specifically, a problem K1 is said to be logspace reducible to a problem K2 if there exist logspace-bounded, deterministic Turing transducers Tf and Tg that for each instance I1 of K1 satisfy the following conditions.
By the definitions above, the P-complete problems are the hardest problems in P, and
by Section 7.5 NLOG U_NC
P . Consequently, NLOG contains a P-complete
problem if and only if P = NLOG, and U_NC contains a P-complete problem
if and only if P = U_NC. It is an open problem whether P equals NLOG or
U_NC.
Theorem 5.6.1 The emptiness problem for context-free grammars is P-complete.
Proof
Consider any context-free grammar G =< N, , R, S >. The emptiness of L(G) can be
determined by the following algorithm.
To show that the emptiness problem for context-free grammars is P-hard, consider any
problem K in P. Assume that M = <Q, ,
,
, q0, B, F> is a deterministic Turing
machine that decides K in T(n) = O(nk) time and that Q
(
{¢, $}) = Ø. Let m
denote the number of auxiliary work tapes of M, and let r denote the cardinality of
.
Then K can be reduced to the emptiness problem for context-free grammars
by a logspace-bounded, deterministic Turing transducer TK of the following
form.
TK on input x outputs a context-free grammar Gx such that
TK constructs the grammar Gx to describe the computation of M on input x.The nonterminal symbols of Gx represent the possible characteristics of the computation of M on input x. Specifically, Gx has the following nonterminal symbols (t is assumed to denote the value T(|x|)).
The production rules of Gx describe how the characteristics of the computation of M
on input x are determined. Specifically, the characteristic that is represented by a
nonterminal symbol A holds for the computation if and only if A *
in Gx. The
production rules of Gx are as follows.
for each X, Y, Z, W, , such that fr(Y, Z, W,
) = X. fr(Y, Z, W,
) is
assumed to be a function that determines the replacement X of Z for the rth
tape when Y is to the left of Z, W is to the right of Z, and
is the transition
rule in use. The left "boundary symbols" Ai-1,0,-1,Y , . . . , Ai-1,m,-1,Y ,
Ai-1,0,|x|+4,W and the right ones Ai-1,1,2t+2,W , . . . , Ai-1,m,2t+2,W are
assumed to equal the empty string
.
for each 0 i
t, a nonaccepting state q, and a, b1, . . . , bm such that
(q, a, b1, . . . , bm) = Ø (i.e., M has no next move).
for each transition rule = (q, a, b1, . . . , bm, p, do, c1, d1, . . . , cm, dm) of the
Turing machine M.
Since M is deterministic, for a given i there exists at most one such that
Ai,
*
.
for each 1 j0
|x| + 2, and 1
jr
2t with 1
r
m.
Example 5.6.1 Let M be the deterministic Turing machine of Figure 5.3.3(a), x = ab, and assume the notations in Theorem 5.6.1.
The following production rules of Gx determine the input segment in the initial configuration of M on x.
The production rules that determine the segment of the auxiliary work tape in the initial configuration have the following form.
The following production rules determine the second configuration from the first.
The production rule A1,1
B0,0,q0,aB0,1,q0,B determines the transition rule used in
the first move.
The following production rules determine the state of M and the symbols scanned by the heads of M, in the first configuration.