An ε-nondeterministic finite automaton (ε-NFA for short) is another tool that can be used to recognize strings as part of a regular language.
The following is an example of an ε-NFA:
It contains 6 states and 5 state transitions.
State s0 is the initial state, while s3 and s5 are accepting states.
State s1 illustrates a construction that is not allowed in an NFA but is allowed in an ε-NFA: transitions with ε as input. These ε transitions do not consume an input symbol.
This ε-NFA accepts the language represented by the following regular expression:
a(b ∪ c)
In general, an ε-NFA consists of:
In an ε-NFA, we have essentially no inherent structural restrictions, with the following key notes about its construction:
To determine whether s = {σ1σ2...σn} belongs to the language recognized by ε-NFA with states S, transitions T[si, t], initial state si:
Informally, we perform the NFA parsing algorithm but in addition, whenever a state is added to a set we are considering, we also add all states reachable directly or indirectly through ε transitions from it.
Note that this parsing algorithm is becoming somewhat complicated and is not often used in practice. We will later show how to reduce ε-NFAs into NFAs and then DFAs to simplify the parsing algorithm.
Example
For s = a
States | Input symbol | Action |
---|---|---|
{s0} | a | Transition to {s1, s2, s4} (since s2 and s4 are reachable via ε transition) |
{s1, s2, s4} | $ (end of string) | Reject (since Scurrent does not contain an accepting state) |
Example
For s = ab
States | Input symbol | Action |
---|---|---|
{s0} | a | Transition to {s1, s2, s4} (since s2 and s4 are reachable via ε transition) |
{s1, s2, s4} | b | Transition to {s3} |
{s3} | $ (end of string) | Accept (since Scurrent contain s3 which is an accepting state) |
GitHub Repository: https://github.com/bprollinson/ripal
Copyright © 2017 Brendan Rollinson-Lorimer