
A Nondeterministic Finite Automaton (NFA) is a type of finite state machine used in automata theory to recognize regular languages. Unlike Deterministic Finite Automata (DFA) , NFAs...
A Nondeterministic Finite Automaton (NFA) is a type of finite state machine used in automata theory to recognize regular languages. Unlike Deterministic Finite Automata (DFA), NFAs allow multiple possible transitions for a given state and input symbol, including ε-transitions (moves without consuming input).
An NFA is defined as a 5-tuple:
Where:
An NFA accepts a string if at least one of its computation paths leads to a final state.
Consider an NFA that accepts strings ending in "01" over the alphabet {0,1}:
| State | Input = 0 | Input = 1 | ε (Epsilon) |
|---|---|---|---|
| q0 | {q0, q1} | {q0} | - |
| q1 | - | {q2} | - |
| q2 | - | - | Accepting State |
The NFA can take multiple paths simultaneously due to nondeterminism.
| Feature | NFA | DFA |
|---|---|---|
| Transitions per Input | Can have multiple transitions | Only one transition per input |
| Epsilon (ε) Transitions | Allowed | Not allowed |
| Deterministic Behavior | Nondeterministic (multiple paths) | Fully deterministic (one path per input) |
| Implementation Complexity | Simpler to define, harder to implement | Harder to define, easier to implement |
| Efficiency | Can be exponentially smaller than an equivalent DFA | Requires more states in some cases |
Theorem: Every NFA has an equivalent DFA, but the DFA may have exponentially more states than the NFA (subset construction method).
An NFA is a powerful computational model that generalizes DFAs by allowing multiple transitions per input and ε-moves. While NFAs may seem more flexible, they are not more powerful than DFAs in terms of language recognition, as any NFA can be converted into an equivalent DFA. However, NFAs are easier to construct and widely used in practical applications such as regex processing and lexical analysis.
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.