0% found this document useful (0 votes)
23 views19 pages

Lesson 17 (NFA & NFA To DFA Conversion

Uploaded by

fairykomal993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views19 pages

Lesson 17 (NFA & NFA To DFA Conversion

Uploaded by

fairykomal993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

Task

 Determine the regular expression of the


following NFA-Λ
Λ
2 4+

a
1- a a

Λ, b
3 b a
5

1
Solution of the Task
Λ
2 4+

a
1- a a

Λ, b
3 b a
5

To eliminate state 5 the above NFA-Λ may be


reduced to the following

2
Solution continued …

2
a Λ+aa*a

1- a 4+

Λ+b ba*a
3

To eliminate state 2 the above NFA-Λ may be


reduced to the following

3
Solution continued …
1-

Λ+b a(Λ+aa*a)

a(Λ+aa*a)

3 4+
ba*a

To eliminate state 3 the above NFA-Λ


may be reduced to the following

4
Solution continued …

a(Λ+aa*a)+(Λ+b)(a(Λ+aa*a)+ba*a)
1- 4+

Hence the RE is

a(Λ+aa*a)+(Λ+b)(a(Λ+aa*a)+ba*a)

5
Task

 Build an FA corresponding to the


following NFA which accepts the
language of strings containing bb
a, b a, b

b b
1- 2 3+

6
Solution of the Task
a, b a, b

b b
1- 2 3+

b a
a b a
(1,2,3) +
1- (1,2) b
(1,3)+
a b

It may be noted that the above method


seems to be complicated, hence an easier
method discussed by Martin, follows as 7
NFA to FA continued …
Method 3:

As discussed earlier that in an NFA, there


may be more than one transition for a
certain letter and there may not be any
transition for certain letter, so starting
from the initial state corresponding to
the initial state of given NFA, the
transition table along with new labels of
states, of the corresponding FA, can be
built introducing an empty state for a
letter having no transition at certain
state and a state corresponding to the
combination of states, for a letter having
more than one transitions. Following are
the examples
Example

 Consider the following NFA which accepts


the language of strings containing bb
a, b a, b

x1- b x2 b
x3 +

Using the method discussed earlier, the


transition table corresponding to the required FA
may be constructed as
Example continued …
New States after reading
Old States
a b
z1≡x1 x1≡z1 (x1,x2)≡z2
z2≡(x1,x2) (x1 , ∅)≡x1≡z1 (x1 ,x2,x3) ≡z3
z3+≡(x1,x2,x3) (x1,x3)≡z4 (x1 ,x2,x3)≡z3
z4+≡ (x1,x3) (x1,x3)≡z4 (x1 ,x2,x3)≡z3

The corresponding transition diagram follows as


Example continued …

b a
a b a

z1 - z2 b z3+ z4+
a b
Convert the following NFA into FA

12
13
Example :
Next State
Present State
0 1
→{q0} {q2} Φ
{q2} {q0, q1} {q0}
{q0, q1} {q2} {q0, q2}
{q0, q2} {q0, q1, q2} {q0}
{q0, q1, q2} {q0, q1, q2} {q0, q2,}

Next State
Present
State 0 1

→q0 {q2} Φ
1
q1 Φ {q0, q2}
q2* {q0, q1} {q0}
Example : State 0 1

→[q0] [q0] [q1]

[q1] [q1, q2] [q1]

*[q2] [q2] [q1, q2]

*[q1, q2] [q1, q2] [q1, q2]

State 0 1

→q0 q0 q1

q1 {q1, q2} q1

*q2 q2 {q1, q2}


The state q2 can be
eliminated because q2
is an unreachable state.
Example :

State 0 1

→[q0] [q0, q1] [q1]


*[q1] ϕ [q0, q1]
*[q0, q1] [q0, q1] [q0, q1]

State 0 1

→q0 {q0, q1} {q1}


*q1 ϕ {q0, q1}
Example :

NFA

DF
A
Example :

NFA DFA
Task:
Converting the following NFA to DFA.

You might also like