An alternating Turing machine (ATM) is a nondeterministic TM where states are classified as existential (∃-states: accept if any branch accepts) or universal (∀-states: accept only if all branches accept), mirroring quantifier alternation. Alternation depth k defines ATIME(f(n)) and ASPACE(f(n)) classes. A key result: ATM with one level of alternation matches nondeterministic TM power. ATMs formalize the polynomial hierarchy via alternating quantifiers, providing clean models for understanding quantified complexity classes.
You already understand that a standard Turing machine follows one deterministic computation path, and a nondeterministic Turing machine (NTM) can branch into many paths and accepts if *any* branch accepts. An alternating Turing machine generalizes this by allowing two different kinds of branching states — and the interplay between them is what makes ATMs so powerful.
In an ATM, every state is labeled as either existential (∃) or universal (∀). An existential state behaves exactly like a nondeterministic state: the machine branches, and it accepts if *at least one* branch leads to acceptance. A universal state is the mirror image: the machine branches, but it accepts only if *every* branch leads to acceptance. Think of existential states as asking "can I find a way to succeed?" and universal states as asking "does this work no matter what happens?" A standard NTM is just an ATM where every state is existential; a co-nondeterministic TM is one where every state is universal.
The real insight is that alternation between ∃ and ∀ states mirrors the alternation of quantifiers in mathematical logic. The statement "∃x ∀y ∃z: φ(x,y,z)" says "there exists an x such that for all y there exists a z making φ true." An ATM that starts in an ∃-state, transitions to a ∀-state, then to an ∃-state is performing exactly this kind of reasoning — first guessing x nondeterministically, then checking that every possible y works, then finding a suitable z. The number of times the machine switches between ∃ and ∀ states is called the alternation depth, and this depth directly corresponds to levels of the polynomial hierarchy. Specifically, Σₖᴾ corresponds to polynomial-time ATMs that start existential and alternate k times.
This connection yields some of the cleanest results in complexity theory. An ATM using polynomial time with no alternation is exactly NP. With one alternation (∃ then ∀), it captures Σ₂ᴾ. The full polynomial hierarchy PH equals the union of all constant-alternation polynomial-time ATM classes. Even more striking, ATIME(f(n)) = DSPACE(f(n)) — alternating time equals deterministic space — which means ATMs reveal deep structural connections between time and space complexity that are invisible in the standard TM model. Understanding ATMs thus provides the conceptual scaffolding for the entire polynomial hierarchy and the relationships between major complexity classes.