Computation Theory · Automata
Alternating Automata: Universal Branching and the Cost of Free Complementation
What happens when a state may demand that all successors accept rather than one, how the acceptance game is played, and why one-way alternation shrinks descriptions without changing the exponential determinization bound.
Nondeterminism gives a state a choice: it accepts when some successor accepts. The definition is an existential quantifier over the transition relation, and every construction in this cluster so far has been built on it. Alternation adds the dual quantifier. A state may also require that all successors accept, and it may mix the two, nesting one inside the other.
The addition looks small and is not. Alternating finite automata accept exactly the regular languages, so nothing new is recognized, but the descriptions can be exponentially more compact than any nondeterministic one, and converting an alternating machine to a deterministic one costs an exponential in the number of states on top of that. The extra power is entirely in the description, and the price is paid at determinization.
A transition is a formula, not a set
In an NFA, δ(q, a) is a set of states and the acceptance condition is a disjunction over that set. In
an alternating automaton, δ(q, a) is a positive boolean formula over Q: the connectives are ∨ and
∧, and the atoms are states. A transition like (p ∧ q) ∨ r means: on symbol a, either both p and
q must accept the remaining input, or r must.
The formula can be put in disjunctive normal form, giving a set of sets: a disjunction of conjunctions. Each conjunction is a branch that must succeed entirely; the disjunction is the choice among branches. A machine whose formulas are all disjunctions of atoms with at most one atom per disjunct is an NFA. A machine whose formulas are all conjunctions of atoms is a universal automaton, the dual case where every branch must succeed.
The run is no longer a path. It is a tree, and the tree’s branching is controlled by the formulas: a ∧
node requires every child subtree to accept, a ∨ node requires one. The acceptance condition is
evaluated on the whole tree, and the tree is finite in depth because the input is finite. This is why
alternating automata terminate on finite words without any fairness condition: every path consumes one
symbol per step, so every path has length |w|.
# Formula nodes: ('atom', q), ('or', f, g), ('and', f, g)
def accepts(delta, accept, q, w, i):
"""True when state q accepts w[i:] under direct game evaluation."""
if i == len(w):
return accept[q]
f = delta[q][w[i]]
return ev(f, w, i + 1)
def ev(f, w, i):
k = f[0]
if k == 'atom': return accepts(delta, accept, f[1], w, i)
if k == 'or': return ev(f[1], w, i) or ev(f[2], w, i)
return ev(f[1], w, i) and ev(f[2], w, i) # and: both must hold
Evaluating that recursion directly is exponential in the input length, because the same (q, i) pair
can be visited along many tree paths. The fix is the same one that turns a recursive matcher into a
dynamic program: memoize on (q, i). With memoization the evaluation is O(|Q| · |w| · |δ|), which is
the cost of simulating the machine on the input without determinizing it. The memo table is
|Q| · (|w| + 1) bits, and it is exactly the table a subset simulation would build, transposed.
The acceptance game
The recursion above is a two-player game, and naming the players makes the structure clearer. One player
tries to make the machine accept; the other tries to make it reject. At an ∨ node the first player
chooses a branch. At a ∧ node the second player chooses a branch. At an atom the play moves to the
named state on the next symbol. At the end of the input, the accepting states are winning for the first
player and the rejecting states for the second.
The machine accepts exactly when the first player has a winning strategy. That is what the existential
and universal quantifiers mean, and it is why the alternating machine is a compact description of a
game rather than a compact description of a set of paths. The dual machine, in which ∨ and ∧ are
swapped and accepting states become rejecting, describes the complementary game: the second player wins
in the dual exactly when the first player loses in the original.
This duality is the property that makes alternating automata useful. Complementing an alternating machine requires no construction at all: swap the connectives in every transition formula and swap the accepting and rejecting sets. The state count does not change. Compare that with the deterministic case, where complement is a relabelling only if the table is total, and with the nondeterministic case, where complement requires determinization. The alternating representation makes complement a syntactic operation on the description.
What determinization costs
To run an alternating machine without the memo table, it must be converted to a deterministic one, and the construction goes through a nondeterministic intermediate that is exponentially larger.
That intermediate tracks, for each state of the alternating machine, whether the requirement that it
accepts the remaining suffix is still outstanding. A configuration is therefore a set of states, an
element of 2^Q, and the run of the intermediate may itself branch. Its states are sets of configurations,
so the subset construction applied on top produces up to 2^{2^{|Q|}} deterministic states in the
two-way case.
The bound is 2^{2^n} states for an n-state two-way alternating machine, and it is not an artifact of a
clumsy construction. The classic family is over two-way machines: languages are known whose deterministic
one-way machines need 2^{2^n} states, which is the reason Meyer and Fischer’s paper is titled around
economy of description. The result is the automata-theoretic counterpart of the doubly exponential lower
bound for translating certain temporal logics into automata, and it is why tools that manipulate
alternating descriptions avoid determinizing them.
Plain one-way alternation over finite words does not force the second exponent. Its accept condition at the
end of the input is a monotone boolean formula evaluated over the states’ verdicts, so the exponential
determinization bound is 2^n, of the same order as for nondeterminism, and the gain is descriptive rather
than asymptotic. The second exponent belongs to models that add a second-way head, and the table below
states the bounds for the one-way machines this article describes.
| Machine | States | Complement | Simulation cost |
|---|---|---|---|
| DFA | n | relabel, needs totality | one load per symbol |
| NFA | n | determinize, up to 2^n | loop over live set |
| Alternating | n | swap ∧/∨, free | memoized game, linear in states times input |
The table is the summary of the cluster: each row buys expressiveness of description with cost somewhere else, and the alternating row is the extreme case in both directions.
Where alternation is the right description
Model checking is the main consumer. A temporal-logic formula is translated into an alternating
automaton whose states correspond to subformulas, with ∧ for conjunction of requirements and ∨ for
disjunction, and the machine accepts exactly the paths satisfying the formula. The translation is
linear in the formula size, which is the whole point: the formula is small, the automaton is small, and
the expensive step is checking the product of that automaton with the system’s state graph. The emptiness
check on the product is a graph search, and it does not require determinizing the alternating machine.
The second consumer is decision procedures for logics over trees and for fixed-point calculi. The
alternating machine’s game semantics matches the semantics of the logic directly, so the translation
preserves structure that a nondeterministic translation would destroy. When the logic has a universal
quantifier over successors, the alternating machine has a ∧, and the correspondence is exact.
The third is the theory of succinctness. An alternating machine is a compressed description, and the question of how much compression it achieves is a question about the gap between description size and machine size. A doubling of the description bound translates into an exponential gap, so every decision procedure that consumes such descriptions must either work on them directly, as the memoized game evaluation does, or accept the cost of expanding them.
Simulation without expansion
The memoized evaluation above is the practical answer for finite inputs. It runs the game on the input
directly and never builds the deterministic machine. Its cost is O(|Q| · |w|) cells, each holding a
bit, and each cell is filled once. The recursion order can be arranged bottom-up from the end of the
input, which turns the memo table into a rolling pair of columns: the verdicts for position i + 1 are
enough to compute the verdicts for position i, so the memory is O(|Q|) bits rather than
O(|Q| · |w|).
That reduction is the alternating analogue of the set-based simulation in simulating an NFA without determinizing it, and it has the same shape: carry a summary of the machine’s state across the input rather than a path or a table. For an NFA the summary is a set of live states; for an alternating machine it is a vector of booleans, one per state, giving the verdict for the suffix already consumed.
The cost per symbol is the cost of evaluating the transition formulas against that vector, which is proportional to the total size of the formulas. A machine whose formulas are large pays at every step, which is the alternating version of the NFA’s per-symbol loop over live states. Neither representation escapes the trade: compact description, expensive step.
The boundary of the model
Alternating finite automata sit exactly at the regular languages, so nothing here extends the class. The gain is descriptive, and it is real: a language whose minimal DFA has a million states may have an alternating description of a few dozen states, and the description is what a person writes and a tool checks. The same phenomenon appears in the deterministic direction, where the Myhill-Nerode theorem fixes the smallest deterministic machine and says nothing about the smallest description in any other formalism.
Two restrictions are worth naming. Alternation over infinite words needs an acceptance condition on the run tree, because a run is a tree rather than a path and there is no single sequence of states to apply a final-state test to; the condition becomes a parity condition on the states visited infinitely often, which is why the standard treatments of alternating automata over infinite words pair the transition formulas with a parity labelling. And a one-way machine that may stay in place, or that carries a two-way head, has an acceptance condition over configurations that are no longer ordered by a single consumed prefix, so the results about the resulting classes must be stated for each combination of features separately. The finite, one-way, read-once alternating machine described here is the clean case: same language class, radically different description size, and an exponential determinization cost that explains why the description is worth having.
References
- Economy of Description by Automata, Grammars, and Formal Systems — Meyer and Fischer, 12th Annual Symposium on Switching and Automata Theory, 1971
- Introduction to Automata Theory, Languages, and Computation — Hopcroft, Motwani, and Ullman; Addison-Wesley
- Alternation — Chandra, Kozen, and Stockmeyer, Journal of the ACM, 1981