21CS51 - Automata Theory and Compiler Design
Module 1 - Question 3 Detailed Answer
3. Difference Between DFA, NFA, and ε-NFA [Marks: 5]
1. DFA (Deterministic Finite Automaton)
----------------------------------------
A DFA is a 5-tuple: DFA = (Q, Σ, δ, q₀, F)
Where:
- Q = Finite set of states
- Σ = Input alphabet
- δ = Transition function: δ: Q × Σ → Q
- q₀ = Start state
- F = Set of accepting (final) states
Key Features:
- For each state and input symbol, exactly one transition exists.
- No ε-transitions (no transition without input).
- The computation path is unique for any input string.
- Simple to implement.
2. NFA (Nondeterministic Finite Automaton)
------------------------------------------
NFA is a 5-tuple: NFA = (Q, Σ, δ, q₀, F)
Here, δ: Q × Σ → P(Q)
Key Features:
- For a given state and input, can have multiple transitions, or none.
- No ε-transitions allowed.
- Several computation paths may be followed in parallel.
- A string is accepted if at least one path ends in a final state.
- Easier to construct than DFA.
3. ε-NFA (Epsilon-NFA / ε-Transitions NFA)
------------------------------------------
This is an extension of NFA allowing ε-moves.
Transition function: δ: Q × (Σ ∪ {ε}) → P(Q)
Key Features:
- Can move between states without consuming any input (ε-transitions).
- Like NFA, may have multiple transitions per symbol.
- Requires ε-closure computation during processing.
- Used in lexical analysis and automaton construction.
- More flexible but complex to simulate directly.
Comparison Table:
| Feature | DFA | NFA | ε-NFA |
|--------------------|------------------------|-------------------------|----------------------------|
| Transition | One per symbol | Zero or more per symbol| Zero or
more + ε-moves |
| Determinism | Deterministic | Non-deterministic |
Non-deterministic |
| ε-Moves | Not allowed | Not allowed | Allowed
| Implementation | Simple | Moderate complexity | Complex
(ε-closure needed) |
| Language Power | Regular languages | Regular languages |
Regular languages |
Key Point:
All three – DFA, NFA, and ε-NFA – recognize only regular languages and are
equivalent in power.