Store the start nonterminal symbol on a stack. An epsilon transition nondeterministically replaces its top nonterminal symbol by a production rule right-hand side. A top terminal symbol can be removed only while consuming the same input symbol. With a protected stack bottom marker, enter a final control state when that marker is exposed. Requiring all input to have been read implements acceptance by final state. The stack records the unprocessed suffix of a leftmost derivation, proving equality of the recognized and generated formal languages.
Finite automaton emptiness test 2026-10-31
A finite-state automaton recognizes a nonempty formal language exactly when some accepting automaton state is reachable from an initial automaton state. Reachability in a graph decides this in a finite transition graph. For an Epsilon-NFA, include its epsilon transitions; the non-epsilon labels of a successful graph path give an accepted word.
A nondeterministic finite automaton, allowing the epsilon transitions used in this paper, is a tupleHere is a nonempty finite set of automaton states, is a finite alphabet, is the power set of , is the initial automaton state, and is the set of accepting automaton states. The symbol denotes the empty word. Membership permits an automaton transition from to consuming when , or consuming nothing when .
The recognized formal language isThe label of a graph path is the concatenation of its labels with all occurrences of omitted. Thus acceptance requires consuming the entire input word; a single successful choice of automaton transitions suffices. A path of length zero is allowed, so the empty word is accepted whenever , or an accepting automaton state is reachable by epsilon transitions. If epsilon transitions are excluded from the definition of a nondeterministic finite automaton, the displayed version is called an Epsilon-NFA.
For , there is an accepting graph pathIts nonempty labels spell , and its last automaton state is accepting. Therefore is accepted. The last epsilon transition matters: finishing the consumed input at does not prevent a subsequent move to .
For , track all possible automaton states, including their epsilon closure, after each input prefix:
| Input prefix | Possible automaton states after epsilon closure |
|---|---|
The final set contains no accepting automaton state, and has no outgoing epsilon transition. Therefore is rejected.
A nondeterministic pushdown automaton is a tupleHere is a nonempty finite set of control states, a finite input alphabet, a finite stack alphabet, the initial control state, the initial stack symbol, and the final control states. The notation requires each transition to have only finitely many choices. Since the domain is finite, the whole transition specification is finite.
A pushdown automaton configuration is , recording the control state, unread input word, and stack contents. Write the top of the stack on the left. For , the one-step relation isAn epsilon transition instead hasThus a move replaces the top stack symbol by the word , whose leftmost symbol becomes the new top. It consumes one input symbol or no input symbol. Under this convention there is no move from an empty stack.
For acceptance by final state, the recognized formal language isHere allows any finite number of moves, including zero. The entire input must have been consumed; the final stack need not be empty. Acceptance requires at least one such run of the nondeterministic pushdown automaton.