You are on page 1of 7

Name : Umar Ali

Roll Number : 522

Class # : BS (CS) – 6th


Semester

Assignment # : 05

Submitted to : Sir Tawab

Subject : “CS-515-Theory of
Automate”
Q#1.
Problem-01:
Convert the following Non-Deterministic Finite Automata (NFA) to Deterministic Finite
Automata (DFA)-

Solution-

Transition table for the given Non-Deterministic Finite Automata (NFA) is-

Step-01:
Let Q’ be a new set of states of the Deterministic Finite Automata (DFA).
Q={qo , q2 , q3 }
Sub= 23 =8
Let T’ be a new transition table of the DFA.

Step-02:
Add transitions of start state q0 to the transition table T’.

State / Alphabet a b
→q0 q0 {q0, q1}

Step-03:
New state present in state Q’ is {q0, q1}.
Add transitions for set of states {q0, q1} to the transition table T’.

State / Alphabet a b

→q0 q0 {q0, q1}

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

Step-04:
New state present in state Q’ is {q0, q1, q2}.
Add transitions for set of states {q0, q1, q2} to the transition table T’.

State / Alphabet a b

→q0 q0 {q0, q1}

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

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

Step-05:
Since no new states are left to be added in the transition table T’, so we stop.
States containing q2 as its component are treated as final states of the DFA.
Finally, Transition table for Deterministic Finite Automata (DFA) is-

State / Alphabet a b
→q0 q0 {q0, q1}

{q0, q1} q0 *{q0, q1, q2}

*{q0, q1, q2} q0 *{q0, q1, q2}

Now, Deterministic Finite Automata (DFA) may be drawn as-


Q#2.

Note: eps = ∈
Solution:

Step 1:
 The start state of equivalent DFA is
 -closure(1), which is = {1,2,4}
 these are exactly the states reachable from state 1 via -transition.
state1 :  -closure(1) = {1,2,4}

Step 2:

Mark DFA state1 input {a,b}

  -closure(move(state1 ,a))

  -closure(3,4) = {3,4,6}

State2 : -closure(3,4) = {3,4,6}

  -closure(move(state1 ,b))

  -closure(5) ={4,5,6}

State3 : -closure(5) ={4,5,6}


Mark DFA State2 input {a,b}

  -closure(move(State2 ,a))

  -closure(4) = {4}

 State4 :  -closure(4) = {4}


  -closure(move(State2 ,b))

 State -closure(3,5) = {3,4,5,6}

Mark DFA State3 input {a,b}

  -closure(move(State3,a))

 State4 :  -closure(4) = {4} (loop state)


  -closure(move(State3,b))

 State3 : -closure(5) ={4,5,6} (loop or dead state and final state )

Mark DFA State4 input {a,b}

  -closure(move(State4 ,a))

Again

 State4 :  -closure(4) = {4} (loop or dead state)


  -closure(move(State4 ,b))

Also

 State3 : -closure(5) ={4,5,6} (loop state and final state )

Mark DFA State input {a,b}

  -closure(move(State ,a)) (loop state same as state 4 final state)

  -closure(move(State ,b)) (loop state and may be final state and same as
state 5)

Step 3: Transition Table


State/input a b
1 2 3
2 4 5
3 4 3
4 4 3
5 4 5
Step 4: Resulting DFA

a a

1 2 4
b b a
b a a

3 5
b b

You might also like