The first theorem of this section provides a generalization of the decidability of the emptiness problem for finite-state automata.
Theorem 3.6.1 The emptiness problem is decidable for pushdown automata.
Proof
Consider any pushdown automaton M1 = <Q, ,
,
1, q0, Z0, F>. Let c be a new
symbol not in
. Let
2 be
1 with each transition rule of the form (q,
,
, p,
) being
replaced with a transition rule of the form (q, c,
, p,
). Let M2 be the pushdown
automaton <Q,
{c},
,
2, q0, Z0, F>.
Intuitively, we see that M2 is the pushdown automaton M1 modified to read the symbol c whenever M1 is to make a move that reads no input symbol. By construction, M1 can reach configuration (uqv, w) in t moves if and only if there exists uc such that M2 can reach configuration (ucqv, w) in t moves, where uc is a string obtained from u by insertion of some c's and |uc| = t. Thus, T(M1) = Ĝ if and only if T(M2) = Ĝ.
Denote m as the constant that the pumping lemma for context-free languages implies for L(M2). The shortest string x in L(M2) cannot be longer than m. Otherwise, a contradiction would arise because by the pumping lemma if x is in L(M2) and if its length is at least m, then a shorter string is also in L(M2).
On input x the pushdown automaton M2 can have at most |x| moves. Consequently,
the emptiness of L(M2) or, equivalently, of L(M1) can be checked by considering all the
possible execution sequences of M2 or, equivalently, of M1 that consist of no more than
m moves.
The decidability of the emptiness problem for pushdown automata can be used for showing the decidability of some problems for finite-state transducers. One such example is the decidability of the equivalence problem for deterministic finite-state transducers. For the general class of finite-state transducers as well as the class of pushdown automata the problem is undecidable (Corollary 4.7.1 and Corollary 4.7.2, respectively). On the other hand, for deterministic pushdown automata and for deterministic pushdown transducers the problem is open.
Corollary 3.6.1 The equivalence problem is decidable for deterministic finite-state transducers.
Proof Consider any two deterministic finite-state transducers M1 and M2. From M1 and M2 a finite-state automaton M3 can be constructed such that M3 accepts the empty set if and only if L(M1) = L(M2). The construction can be as in the proof of Theorem 2.6.4.
On the other hand, one can also construct from M1 and M2 a pushdown automaton M4 that accepts a given input if and only if both M1 and M2 accept it, while providing different outputs. That is, M4 accepts the empty set if and only if M1 and M2 agree in their outputs on the inputs that they both accept.
A computation of M4 on a given input consists of simulating in parallel, as in the proof of Theorem 3.5.1, the computations of M1 and M2 on such an input. The simulation is in accordance with either of the following cases, where the choice is made nondeterministically.
The uniform halting problem is undecidable for pushdown automata (Corollary 4.7.3). However, the decidability of the emptiness problem for pushdown automata can be used to show the decidability of the uniform halting problem for deterministic pushdown automata.
Theorem 3.6.2 The uniform halting problem is decidable for deterministic pushdown automata.
Proof
Consider any deterministic pushdown automaton M1. From M1 a deterministic pushdown
automaton M2, similar to that in the proof of Lemma 3.5.1, can be constructed. The only
difference is that here M2 accepts a given input if and only if it determines that M1
reaches a simple loop. By construction, M2 accepts an empty set if and only if M1 halts
on all inputs.
The proof of the last theorem fails for nondeterministic pushdown automata because accepting computations of nondeterministic pushdown automata can include simple loops, without being forced to enter an infinite loop.
Theorem 3.6.3 The halting problem is decidable for pushdown automata.
Proof Consider any pair (M, x) of a pushdown automaton M and of an input x for M. From x, a finite-state automaton Mx can be constructed that accepts only the input x. However, from M, a pushdown automaton M1 can be constructed to accept a given input if and only if M has a sequence of transition rules that leads M to a simple loop on the input. The construction can be similar to the proof of Theorem 3.6.2.
From M and Mx, a pushdown automaton Ma,x can be constructed that accepts the
intersection of L(M) with L(Mx) (see Theorem 3.5.1). By construction, Ma,x accepts a
nonempty set if and only if M accepts x. By Theorem 3.6.1 it can be determined if Ma,x
accepts a nonempty set. If so, then M is determined to halt on input x. Otherwise, in a
similar way, a pushdown automaton M1,x can be constructed to accept the intersection of
L(M1) and L(Mx). By construction, M1,x accepts the empty set if and only if M has
only halting computations on input x. The result then follows from Theorem 3.6.1.