Non-Deterministic Finite Automaton With Empty Transitions
We have nullable regular languages, and so we have nullable NFA, that is, NFA with empty transitions, also called e-NFA (-NFA).
Components of e-NFA
Components
e-NFA has all its parts the same as NFA. But we allow instead of making,
We would allow to accept as a symbol,
Please note that, when it comes to , it is the NFA that accepts as a normal symbol instead of the empty sentence. But for e-NFA, we use and it treats an empty sentence.
Because , thus,
This seems kind of complex. We can define a concept called the closure of a set of states, the ,
That is to say, the closure of a set of states is the set of states that can be reached by a sequence of empty transitions.
So the e-NFA transition function is,
Much easier to understand.
Example
For example,
We test on this.
The edge with no label is an empty transition.
Firstly, we have ,
Now we take in . Before the transition cost, let's find the closure of the current state,
Then we perform the transition,
After the transition of cost, we need to find the closure of the current state as the final result,
So after the transition, the current state is .
Now let's take in , obviously, the closure of the current state is still .
Then we take in , which results in a state set .
We need to find the closure of the current state as the final result, which is still, .
Because in the final state set, is an accept state, so the string is accepted.
Removing the Empty Transitions
e-NFA is more easier to design compared to NFA. And we need a way to convert it to NFA, so that it can be made into a minimized DFA. For the minimized DFA, we can write the most efficient program to recognize the language.
How to remove the empty transitions? Let's consider the transition table of the e-NFA,
0 | 1 | ||
---|---|---|---|
qs | {qs} | {q1} | |
q1* | {q1} |
It is very simple- for each element in the table, we use it's closure to replace itself.
The closure of is , of is , of is .
Then, because some state can transit to accept state with no cost. In the new NFA, it should be an accept state as well. That is to say, if,
Then, is an accept state in the new NFA.
Thus, we can have a NFA transition table,
0 | 1 | |
---|---|---|
qs* | {qs} | {qs, q1} |
q1* | {q1} |
We can draw that as,
Grammar of e-NFA
We can take a similar rule to convert from e-NFA to its grammar. So in the end, we will have,
Where is corresponding to the empty transition.
Because all can be reduced into,
We simply find the generated result of that is in form of or . Then add the new grammar to replace the old one,
So that we can get a regular grammar.
Please note that we do not need to consider the case of,
Because e-NFA allows non-deterministic transitions.
Thus, e-NFA also accepts regular language.