Nondeterministic finite automaton

from Wikipedia, the free encyclopedia
Graphic representation of an NEA

A non-deterministic finite state machine ( NEA ; English nondeterministic finite automaton , NFA ) is a finite state machine , in which there are several equivalent ways to state transition. In contrast to the deterministic finite automaton , the possibilities are not unique, so the automaton is not given which transition to choose.


Formally, an NEA can be defined as a quintuple (5-tuple) . The following applies here:

  • is a finite, non-empty set of states ( ).
  • is a finite, non-empty input alphabet .
  • is the transition relation (or transition relation).
  • is the start state.
  • is a (finite) set of possible accepting states (final states). If the automaton fails in one state after reading the input word , it is part of the language .


If the NEA reads the input symbol in one state , then it changes non-deterministically to a successor state that is given by the transition relation. The automaton has the choice between all states for which applies.

If there is no such status, the machine stops prematurely and rejects the entry.

An input word is considered accepted if there is a change of state for a given sequence in which the machine does not stop prematurely and the last state is an accepting state.

Transition as a function

Alternatively, the transitions can also be defined by a transition function , which is then mapped into a number of states:


Since the function can also map to the empty set, so that it can apply, a premature stop is also possible here.

Epsilon transitions

An NEA that recognizes language for language

NEAs can also be defined in such a way that state transitions are possible in which no input character is read. Before or after reading a character, an NEA can randomly change its state. The states that can be changed are connected by transitions that read the empty word (sometimes also ) instead of a symbol . These state changes are called transitions or steps . In graphical representations of NEAs, the transitions are shown as edges labeled with (or ) and are therefore also called edges.

Formally, these transitions are made possible by extending the transition relation:

It must be ensured that in is not already present, but only represents the empty word.

NEAs with epsilon transitions cannot recognize more words than without this extension. For an NEA with epsilon transitions there is always an equivalent NEA without epsilon transitions. But you can simplify the construction of some machines. For example, one can construct an automaton for an NEA with little effort that accepts Kleene's envelope of the language of , that is .

Multiple starting states

A NEA with a new start state that connects the start states of partial automations with epsilon transitions

It is also possible to allow several start states.

The automaton is then defined as having .

Such automatons can be converted into NEAs with exactly one start state by means of transitions, by introducing a new state from which the original start states can be reached through transitions.

In this way one can two machines a NEA create, whose language is the union of the languages of the other two machines, so . In the case of disjoint sets of states of and one only has to introduce a new start state which is connected to the start states of the two automata via epsilon transitions. The set of accepting states is the union of the accepting states of the two automata.


NEAs, DEAs and type 3 grammars (see Chomsky hierarchy ) describe the same language class . NEAs can be converted into equivalent DEAs using power set construction.

The main difference between the NEA and the deterministic finite automaton (DEA) lies in the fact that several subsequent states are possible or can be completely absent. However, these are not two different types, but a DEA is a special form of the NEA.

In order to convert a regular expression into an NEA, certain rules must be followed. This process is called inductive construction or Thompson's construction .

See also


  1. Katrin Erk, Lutz Priese: Theoretical Computer Science: A Comprehensive Introduction. 3. Edition. Springer, 2008, ISBN 3-540-76319-8 , page 67
  2. Hans Werner Lang:
  3. ^ Alfred V. Aho , Ravi Sethi, Jeffrey Ullman : Compilers: Principles, Techniques and Tools. Addison-Wesley, 1986


Web links