In this section we briey discuss an extension of the techniques used in Section 3.6, to the case of automata with alternations [14], considered in [43, 30]. Such automata combine the power of nondeterminism with parallelism.
A 2-way alternating automaton (2afa, for short) is dened in the same way as a 2nfa, but now the set of states Q is partitioned in two disjoint sets Q∃ and Q∀, the sets
The acceptance of an input string w by a 2afa A is witnessed as follows. Consider the tree of all possible computation paths, starting from the initial conguration c−.
In this tree, a conguration c = (q,i) is declared to be successful, if (i) the state q is accepting, or (ii) q is existential and at least one successor of c= (q, i) is successful, or (iii) q is universal and all successors of c= (q, i) are successful. The input w is accepted, if the initial conguration c− becomes successful in this way. Notice that nondeterministic
automata are just alternating automata without universal states.
Even for 2afas, we can restrict the use of (both existential and universal) choices as we did for 2nfas, considering 2-way outer-alternating nite automata (2oafas). In this model, the choices can be taken only when the head is scanning one of the endmarkers; a conguration positioned away from the endmarkers can have at most one successor.
Actually, using arguments very similar to those of Lemma 3, we can restrict the use of choices to the left endmarker:9
Lemma 6. For each 2oafa A = (Q∃, Q∀, Σ, δ, q−, F) with n states, there exists an equiv-
alent 2oafa A′ with no more than 3n states that satises the following properties:
both existential and universal choices are taken only when the input head is scanning the left endmarker,
there is a unique accepting state q+ and this state is also halting,
q+ is reachable only at the left endmarker, by stationary moves,
stationary moves are used only at the left endmarker.
Now, consider the alternating graph accessibility problem (AGAP, for short), an al- ternating version of GAP. The instance of the problem is an alternating directed graph, i.e., a graph G= (V∃, V∀, E) with a partition of V = {v1, . . . , vn} in two disjoint sets V∃
and V∀. The question is if the predicate APath(v1, vn) is true, where, for vi, vk ∈ V ,
APath(vi, vk) = true if and only if:
vi = vk, or
vi ∈ V∃ and, for some edge(vi, vj) ∈ E, APath(vj, vk) = true, or
vi ∈ V∀ and, for each edge (vi, vj) ∈ E, APath(vj, vk) = true.
9Notice a small dierence with respect to Lemma 3, in which the stationary moves were allowed only to halt in q+ at the left endmarker. However, here they can be used also for other purposes, but still only at the left endmarker. Due to the presence of both universal and existential states, a complete removal of stationary moves would require a more complicated argument than the simple one used to prove Lemma 3. However, this is not necessary for our purposes.
This problem is known to be complete for the class P, with respect to logarithmic space reductions [40].
As is Section 3.6, the edges in E can be represented by a binary adjacency matrix, of length n× n = n2 bits, but here we also need to specify partitioning of vertices into
V∃ and V∀. This can be given as a string consisting of n additional bits, denoted here by V∃/∀, in which the bit at the position i is equal to 0 or 1 depending on whether vi∈ V∃
or vi∈ V∀. Therefore, a binary represented instance of the problem is in the form E ♯ V∃/∀,
using n2+n bits.
Now we can reduce the language accepted by a given 2oafa A, in normal form of Lemma 6, to AGAP: with each input string w, we associate the alternating graph G(w) = (Q∃, Q∀, E(w)), binary encoded by E(w) ♯ Q∃/∀. Here we assume, without loss of generality, that q−= q1 and q+= qn. The edges are dened in the usual way: (qi, qj) ∈
E(w) if and only if A has a computational segment from qi to qj on the input w. (The
extension of the notion of computational segments to 2afa is obvious.) Since A makes both existential and universal choices only at the left endmarker, w∈ ∣∣A∣∣ if and only if G(w) ∈ AGAP.
Since the deterministic subroutine Reach presented in Section 3.3 depends only on the transition function of the given automaton A but not on the acceptance condition, we can use it to detect segments even in the case of outer 2afas.10 This permits us to
prove the following result:
Theorem 12. If L= P, then each 2oafa A with n states can be replaced by an equivalent 2dfa A′ with a polynomial number of states.
Proof. First, without loss of generality, we can assume that A is in normal form given by Lemma 6. Second, under the assumption that L= P, using also the fact that AGAP is complete for P, there must exist a deterministic Turing machine DAGAP that solves
AGAPin logarithmic space.
Now, for the given n-state 2oafa A, we apply the construction of Theorem 10 but, instead of the machine DGAPon the virtual input E(w), we simulate DAGAPon the virtual
input E(w) ♯ Q∃/∀. Clearly, for each input string w, w∈ ∣∣A∣∣ if and only if G(w) ∈ AGAP,
that is, if and only if DAGAP accepts E(w) ♯ Q∃/∀.
During the simulation, the rst n2 bits forming the string E(w) are tested by calling
the subroutine Reach with appropriate parameters, in the same way as used in the proof of Theorem 10. On the other hand, the last n bits that represent Q∃/∀, partitioning Q
10As mentioned in the previous footnote, we can have stationary moves at the left endmarker. The subroutine Reach(qS, qT) has been implemented considering this possibility. In particular, it returns
true for each qS, qT satisfying qS = qT or (qS,▷, 0, qT) ∈ δ. (See item Handling trivial cases in the
into existential and universal nodes, do not depend on w, but only on Q∃ and Q∀. So,
for the given 2oafa A, this information is xed, and hence it can be encoded in the transition table for our new machine A′. (In the proof of Theorem 11, we encoded this
way the advice string αn2.)
By the same reasoning as in the proof of Theorem 10, we also get that the new machine A′ is a nite-state device, namely, a 2dfa with a polynomial number of states,
accepting the same language as does A.
In a similar way, we can prove the following:
Theorem 13. If NL= P, then each 2oafa A with n states can be replaced by an equiv- alent 2onfa A′ with a polynomial number of states.
Proof. Under the hypothesis NL = P, there exists a nondeterministic Turing machine NAGAP that solves AGAP in logarithmic space.
The rest of the argument is the same as in the proof of Theorem 12, replacing the machine DAGAP by the machine NAGAP. The only dierence from Theorem 12 is that
now the resulting 2-way machine A′ is nondeterministic.
Note also that nondeterministic choices are always made with the input head at the left endmarker, since A′ accesses its input tape only by calling the deterministic subrou-
tine Reach. Hence, A′ is actually 2onfa.