Sie sind auf Seite 1von 5

_Computation Theory Lec.

(7)

MSC: Zamen F. Jabr _

Converting NFA into DFA


Three steps :
1- find transition table.
2- drawing new design.
3- remove unreachable states.
Example : convert the following NDFA into DFA

Solution
:

_Computation Theory Lec. (7)

MSC: Zamen F. Jabr _

Note: Any state contains final mark it will be final state


2) drawing new
design.

3) remove unreachable states (marked by dashed circle state q1


and state q3 ) because we cannot reach it.
b

H.W convert the following NFA into DFA


1)

Acceptance of Strings by Non-deterministic Finite


Automata:
2)

Since an NFA is a finite automata in which there may exist more


than one path corresponding to x in S*, and if this is, indeed, the
case, then we are required to test the multiple paths corresponding
to x in order to decide whether or not x is accepted by the NFA,
because, for the NFA to accept x, at least one path corresponding
to x is required in the NFA. This path should start in the initial state

_Computation Theory Lec. (7)

MSC: Zamen F. Jabr _

and end in one of the final states. Whereas in a DFA, since there
exists exactly one path corresponding to x in S*, it is enough to
test whether or not that path starts in the initial state and ends in
one of the final states in order to decide whether x is accepted by
the DFA or not.
Therefore, if x is a string made of symbols in S of the NFA (i.e., x is
in S*), then x is accepted by the NFA if at least one path exists that
corresponds to x in the NFA, which starts in an initial state and
ends in one of the final states of the NFA. Since x is a member of
S* and there may exist zero, one, or more transitions from a state
on an input symbol, we define a new transition function, d1, which
defines a mapping from 2Q S* to 2Q ; and if d1 ({q0},x) = P,
where P is a set
For example, consider the finite automata shown below:
where:

If x = 0111, then to find out whether or not x is accepted by the


NFA, we proceed as follows:

Example : convert the following R.E to NFA fisrtly then to DFA


secondly?
R.E=(a+b)*(aa+bb)(a+b)*
Sol.

_Computation Theory Lec. (7)

MSC: Zamen F. Jabr _

a,b
Q0
q0
e

q1

a
q3

q2

a,b

NFA

To consist DFA We must consist the transition table as follow:


state
q0
q1
q2
q3
{ q0 ,q1}
{q0,q2}
{q0 ,q1,q3}
{q0,q2,q3}

a
{q0 ,q1}
q3

q3
{q0 ,q1,q3}
{q0,q2}
{q0 ,q1,q3}
{q0,q1,q3}

b
{q0,q2}

q3
q3
{q0,q2}
{q0,q2,q3}
{q0,q2,q3}
{q0,q2,q3}

Rename the set of states as:


q4={ q0 ,q1}; q5={ q0 ,q2} ; q6={ q0 ,q1,q3}; q7={ q0
,q2,q3}
State
a
b
q0
q4
q5
q1
q3

_Computation Theory Lec. (7)

MSC: Zamen F. Jabr _

q2

q3
q3
q3
q3
q4
q5
q6
q5
q6
q7


a b

q6

q6

q7

q4

q0-

a
b

q6 +

b
q5

a,b

a
q1

a,b
q2 b

q3

Das könnte Ihnen auch gefallen