Skip to main content

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 (ϵ\epsilon-NFA).

Components of e-NFA

Components

e-NFA has all its parts the same as NFA. But we allow instead of making,

T^({qi},λ as empty sentence)={qi}\hat{\mathcal{T}}(\{q_i\}, \lambda \text{ as empty sentence}) = \{q_i\}

We would allow to accept λ\lambda as a symbol,

T^({qi},λ as a sentence with one symbol)={qj}\hat{\mathcal{T}}(\{q_i\}, \lambda \text{ as a sentence with one symbol}) = \{q_j\}

Please note that, when it comes to T^\hat{\mathcal{T}}, it is the NFA that accepts λ\lambda as a normal symbol instead of the empty sentence. But for e-NFA, we use T\mathcal{T} and it treats λ\lambda an empty sentence.

Because (λ as empty sentence)n=λ as empty sentence  (n0)(\lambda \text{ as empty sentence})^n = \lambda \text{ as empty sentence} \; (n \geq 0), thus,

T({qi},v)=n0,m0T({qi},(λ as empty sentence)nv(λ as empty sentence)m)=n0,m0T^(T^(T^({qi},(λ as a symbol)n),v),(λ as a symbol)m)\mathcal{T}(\{q_i\}, v) = \bigcup_{n \geq 0, m \geq 0} \mathcal{T}(\{q_i\}, (\lambda \text{ as empty sentence})^nv(\lambda \text{ as empty sentence})^m) \\ = \bigcup_{n \geq 0, m \geq 0} \hat{\mathcal{T}}(\hat{\mathcal{T}}(\hat{\mathcal{T}}(\{q_i\}, (\lambda \text{ as a symbol})^n),v), (\lambda \text{ as a symbol})^m)

This seems kind of complex. We can define a concept called the lambdalambda closure of a set of states, the Qiλ\mathcal{Q_i}^\lambda,

Qiλ=n0T^(Qi,λn)\mathcal{Q_i}^\lambda = \bigcup_{n \geq 0} \hat{\mathcal{T}}(\mathcal{Q_i}, \lambda^n)

That is to say, the lambdalambda 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,

T(Qi,v)=T^(Qiλ,v)λ\mathcal{T}(\mathcal{Q_i}, v) = \hat{\mathcal{T}}(\mathcal{Q_i}^\lambda, v)^\lambda

Much easier to understand.

Example

For example,

We test 0101 on this.

The edge with no label is an empty transition.

Firstly, we have qsqs,

Now we take in 00. Before the transition cost, let's find the lambdalambda closure of the current state,

Then we perform the transition,

After the transition of cost, we need to find the lambdalambda closure of the current state as the final result,

So after the transition, the current state is {qs,q1}\{qs, q1\}.

Now let's take in 11, obviously, the closure of the current state is still {qs,q1}\{qs, q1\}.

Then we take in 11, which results in a state set {q1}\{q1\}.

We need to find the λ\lambda closure of the current state as the final result, which is still, {q1}\{q1\}.

Because in the final state set, q1q1 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,

01λ\lambda
qs{qs}\emptyset{q1}
q1*\emptyset{q1}\emptyset

It is very simple- for each element in the table, we use it's λ\lambda closure to replace itself.

The λ\lambda closure of {qs}\{qs\} is {qs,q1}\{qs, q1\}, of {q1}\{q1\} is {q1}\{q1\}, of \emptyset is \emptyset.

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,

{qi}λF\{q_i\}^\lambda \cap \mathcal{F} \neq \emptyset

Then, qiq_i is an accept state in the new NFA.

Thus, we can have a NFA transition table,

01
qs*{qs}{qs, q1}
q1*\emptyset{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,

AaAAaABA \rightarrow aA \\ A \rightarrow a \\ A \rightarrow B

Where ABA \rightarrow B is corresponding to the empty transition.

Because all ABA \rightarrow B can be reduced into,

AaAAaA \rightarrow aA \\ A \rightarrow a \\

We simply find the generated result of BB that is in form of bBbB or bb. Then add the new grammar to replace the old one,

AaBAbA \rightarrow aB \\ A \rightarrow b \\

So that we can get a regular grammar.

Please note that we do not need to consider the case of,

AbBcCA \rightarrow bB | cC

Because e-NFA allows non-deterministic transitions.

Thus, e-NFA also accepts regular language.