You are on page 1of 19

AT3: Automata Theory

Colin Campbell
Engineering Mathematics Department

C.Campbell@bris.ac.uk

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Converting eNFAs to equivalent DFAs

An eNFA is an NFA containing one or more e-transitions.


This raises a question: how do we convert a NFA to a DFA if e
transitions are present? Well, this is a more complex procedure.
Basically, we convert the eNFA to an equivalent NFA without
e-transitions. We then do the same process as above of converting
this NFA to its equivalent DFA. For the first step (converting the
eNFA to an equivalent NFA without e-transitions) we must
introduce the concept of:

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


e-closure

The e-closure of a state q is defined as the set of states


reachable from the given state q by e-transitions only. It will
include the node representing q itself.
We can write the corresponding transition function as:

δ(q, e) = e − closure (q )

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


The transition diagram

Thus consider the transition diagram:

0 1 0,1

e e
q0 q1 q2

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Comments

Then we would write:


e-closure(q0 ) = {q0 , q1 , q2 }
e-closure(q1 ) = {q1 , q2 }
e-closure(q2 ) = {q2 }
Let’s see how we can use this idea to convert an eNFA to an
equivalent NFA without e-transitions:

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Example

Convert the following eNFA to an equivalent DFA:

0 e
q0 q1 q2

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Example

To convert an eNFA to an equivalent NFA without e-transitions we


first calculate the e-closure of every state:
e-closure(q0 ) = {q0 }
e-closure(q1 ) = {q0 , q1 , q2 }
e-closure(q2 ) = {q0 , q2 }
. . . we recall that the e-closure includes the node itself in the given
set.

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Example

For the given eNFA, its transition function, which we write as δN is:

δN (q0 , 0) = {q1 }
δN (q0 , e) = {φ}
δN (q1 , 0) = {φ}
δN (q1 , e) = {q2 }
δN (q2 , 0) = {φ}
δN (q2 , e) = {q0 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


The New NFA

Now we can define our new NFA, without the e, as follows:

N 0 = Q 0 , Σ, δ0 , q00 , F 0


where:

Q 0 = ({q0 }, {q0 , q1 , q2 }, {q0 , q2 })


Σ = {0, 1}
q00 = {q0 }
F 0 = ({q0 , q1 , q2 })

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Comments

There is one final accepting node {q0 , q1 , q2 }, which is that node,


or nodes, containing the final accepting state of the eNFA, namely
q1 . The transition function δ0 is then:

δ0 ({q0 }, 0) = e − closure (δN ({q0 }, 0))


= e − closure (q1 )
= {q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


and . . .

δ0 ({q0 , q1 , q2 }, 0) = e − closure (δN ({q0 , q1 , q2 }, 0))


= e − closure (δN (q0 , 0) ^ δN (q1 , 0) ^ δN (q2 , 0)
= e − closure ({q1 } ^ {φ} ^ {φ})
= e − closure (q1 )
= {q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


and . . .

δ0 ({q0 , q2 }, 0) = e − closure (δN ({q0 , q2 }, 0))


= e − closure (δN (q0 , 0) ^ δN (q2 , 0))
= e − closure ({q1 } ^ {φ})
= e − closure (q1 )
= {q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


so . . .

State 0
→ q0 ?{q0 , q1 , q2 }
?{q0 , q1 , q2 } ?{q0 , q1 , q2 }
{ q0 , q2 } ?{q0 , q1 , q2 }
As no new states are appearing, we stop there. We can now
construct the transition table:
State 0
→ q0 ?{q0 , q1 , q2 }
?{q0 , q1 , q2 } ?{q0 , q1 , q2 }
{ q0 , q2 } ?{q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


NFA without the e

So the NFA without the e is as follows:

0
0
q0 {q 0 ,q 1 ,q 2 }

{q 0 ,q 2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


The equivalent DFA

Now we proceed to the second step of finding the equivalent DFA.


The starting point is q0 , as before, and we have:

δD ({q0 }, 0) = δ0 (q0 , 0) = {q0 , q1 , q2 }


and we also have:

δD ({q0 , q1 , q2 }, 0) = δ0 ({q0 , q1 , q2 }, 0) = {q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


The equivalent DFA

so the transition table is simply:

State 0
→ q0 ?{q0 , q1 , q2 }
?{q0 , q1 , q2 } ?{q0 , q1 , q2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


The equivalent DFA

and the transition diagram is:

0
0
q0 {q 0 ,q 1 ,q 2 }

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Summary

Since a NFA has an equivalent DFA, there is then no advantage to


a NFA.

However, not all computational tasks can be computed using the


DFAs we have been discussing. An example would be a language L
in which the accepting state is the set of all strings of the form
0n 1n for any n, that is 01 (n = 1), 0011 (n = 2), etc. This
problem seems similar to the problems we have considered but it is
actually not computable by a DFA. This means the DFA cannot be
a universal computing machine.

This brings us to the Turing Machines of the next chapter.

Colin Campbell Engineering Mathematics Department AT3: Automata Theory


Summary

Though not part of the course, you may want to read further
within this interesting topic and look at pushdown automata,
Moore and Mealy machines and related topics.

Colin Campbell Engineering Mathematics Department AT3: Automata Theory

You might also like