Theory of Computation · Epsilon NFA and Conversions
Epsilon Closure of a State
Overview
An epsilon NFA (ε-NFA) can change state without reading any input symbol, on epsilon (the empty string).
The epsilon closure of a state collects every state reachable from it using epsilon transitions only, and this construction is the key to showing that ε-NFAs, NFAs and DFAs all have the same power.
Key concepts
- ε-NFA: an NFA in which, from a particular state, a transition is possible without reading any input symbol, i.e. on seeing epsilon (the empty string).
From a state A, without seeing anything, the machine may still move to some other state. - Epsilon closure of a state, written : the set of all states reachable from A using epsilon transitions only, with no input symbol consumed.
- Transitivity: if A reaches B on epsilon and B reaches C on epsilon, then C is in . Epsilon moves are followed repeatedly until no new states are found.
- Self-membership: A is always in its own epsilon closure, because on seeing epsilon A can reach A.
How it works
To compute :
- Put A in the set: A is always in its own epsilon closure, since on seeing epsilon A can reach A.
- From A, follow every epsilon transition. Any state B reachable from A on epsilon is in .
- From each such B, follow epsilon transitions again; every state reachable from B on epsilon is also in (the closure is transitive).
- The result is the complete set of states reachable from A by a sequence (possibly empty) of epsilon moves.
Drawing the diagram…
Formulas
-
-
— the state whose epsilon closure is being computed
-
— any state reachable from A using epsilon transitions only, with no input symbol consumed
Worked examples
Computing
- Step 1: A reaches A on epsilon, so .
- Step 2: A reaches B on epsilon, so .
- Step 3: B can reach further states on epsilon; every such state is also added to .
- Result: , where "" are all states reachable from B (and onward) by epsilon moves only.
Comparison
| Model | Epsilon moves allowed? | Power |
|---|---|---|
| DFA | No | Equivalent to NFA |
| NFA | No | Equivalent to DFA |
| ε-NFA | Yes | Equivalent to NFA (and hence to DFA) |
Reasoning for equivalence:
- DFA and NFA are already known to be equivalent in power: every DFA is an NFA (so DFA → NFA is trivial), and there is a known method to convert NFA → DFA.
- Every NFA is an ε-NFA (an NFA is just an ε-NFA with no epsilon transitions), so NFA → ε-NFA is trivial; the nontrivial direction is ε-NFA → NFA, done by eliminating epsilon transitions using epsilon closures.
- Therefore, if ε-NFA → NFA conversion is possible, then NFA and ε-NFA are equivalent, and by extension DFA, NFA and ε-NFA all have the same power.
Revision summary
- uses epsilon transitions only: zero or more epsilon moves, no input consumed.
- A state is always in its own epsilon closure.
- The closure is transitive: keep following epsilon moves until no new states are found.
- Every NFA is an ε-NFA with no epsilon moves, so NFA → ε-NFA is trivial.
- To prove ε-NFA ≡ NFA, convert ε-NFA → NFA; then DFA, NFA and ε-NFA are all equivalent in power.
Previous-year exam insights
- Extended transition function for ε-NFA: δ̂(q, ε) = ε-closure(q), and δ̂(q, wa) = ε-closure( ∪_{p ∈ δ̂(q,w)} δ(p,a) ) — i.e. after each input symbol take the union of the direct transitions, then take the epsilon closure of the result.
Asked inGATE 2017 - ε-closure of a set of states is the union of the ε-closures of its members: ε-closure(P) = ∪_{q ∈ P} ε-closure(q);
this is what makes the subset construction work.
Asked inGATE 2017 - ε-NFA → NFA conversion: new NFA state set is the same;
new transition δ'(q,a) = ε-closure( ∪_{p ∈ ε-closure(q)} δ(p,a) );
new start state is ε-closure(q0);
a state is final in the NFA if its ε-closure contains any final state of the ε-NFA.
Asked inGATE 2017 - A string w is accepted by an ε-NFA from q iff δ̂(q,w) contains a final state; equivalently, the ε-closure of the reached set must intersect the set of final states.
Asked inGATE 2017 - ε-closure computation is a reachability/graph search (BFS/DFS) over epsilon edges only; it can be computed in O(|Q|·|δ|) time and always contains the state itself (zero epsilon moves allowed).
- ε-transitions never increase expressive power: ε-NFA, NFA and DFA all accept exactly the regular languages, and the subset construction (with ε-closures) converts any ε-NFA to an equivalent DFA.