You are on page 1of 73

NFA to DFA

Subset construction algorithm


Subset Construction Algorithm
To perform this operation, let us define two functions:
•The  ε -closure function takes a state and returns the set of states reachable from it based on (one or more)       -
transitions. Note that this will always include the state itself. We should be able to get from a state to any state in
its  ε -closure without consuming any input.
•The function move takes a state and a character, and returns the set of states reachable by one transition on this
character.
We can generalise both these functions to apply to sets of states by taking the union of the application to
individual states.

Eg. If A, B and C are states, move({A,B,C},`a') = move(A,`a’)  U  move(B,`a’)  U  move(C,`a').


Subset Construction Algorithm
The Subset Construction Algorithm
1.Create the start state of the DFA by taking the  ε -closure of the start state of the NFA.
2.Perform the following for the new DFA state:
For each possible input symbol:
1.Apply move to the newly-created state and the input symbol; this will return a set of states.
2.Apply the  ε  -closure to this set of states, possibly resulting in a new set.
This set of NFA states will be a single state in the DFA.
3.Each time we generate a new DFA state, we must apply step 2 to it. The process is complete when applying
step 2 does not yield any new states.
4.The finish states of the DFA are those which contain any of the finish states of the NFA.
(a|b)*ab
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state:
ε – Closure(0)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state:
ε – Closure(0)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state:
ε – Closure(0)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state:
ε – Closure(0)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
A = (0,1,2,4,7)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a}
A = (0,1,2,4,7)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a}
A = (0,1,2,4,7)
= Φ U Φ U {3} U Φ U {8}
= ε – Closure(3) U ε – Closure(8)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a}
A = (0,1,2,4,7)
= Φ U Φ U {3} Φ U {8}

= ε – Closure(3) U ε – Closure(8)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a}
A = (0,1,2,4,7)
= Φ U Φ U {3} Φ U {8}

= ε – Closure(3) U ε – Closure(8)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= Φ U Φ U {3} Φ U {8}

= ε – Closure(3) U ε – Closure(8)
= {1,2,3,4,6,7} U {8}
=(1,2,3,4,6,7,8} =B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
ε – Closure(0) = {0,1,2,4,7} = A
(A,a) = {0,a} U {1,a} U {2,a} U {4,a} U {7,a} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= Φ U Φ U {3} Φ U {8}

= ε – Closure(3) U ε – Closure(8)
= {1,2,3,4,6,7} U {8}
=(1,2,3,4,6,7,8} =B
ε – Closure
ε – Closure(3) {1,2,3,4,6,7,8}
ε

a
2 3
{0,b} = Φ
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
= {1,2,3,4,6,7,8} = B
ε

a
2 3
ε ε
ε a b
ε {1,b} = Φ 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
= {1,2,3,4,6,7,8} = B
ε
{1,b} = Φ

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
= {1,2,3,4,6,7,8} = B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8)
= ε – Closure(5)
= {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(5)
= {1,2,4,5,6,7} = C
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(A,b) = {0,b} U {1,b} U {2,b} U {4,b} U {7,b}

= Φ U Φ U Φ U {5} U Φ
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(5)
= {1,2,4,5,6,7} = C
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,7,8)
= {1,a} U {2,a} U {3,a} U {4,a} U {6,a} U {7,a} U {8,a} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= Φ U {3} U Φ U Φ U Φ U {8}

= ε – Closure(3) U ε – Closure(8) B = (1,2,3,4,6,7,8)


= {1,2,3,4,6,7} U {8} =(1,2,3,4,6,7,8} = B
ε

a
2 3
ε ε
ε a b
ε {1Ua} = Φ
8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,7,8)
={(1,a} U {2,a} U {3,a} U {4,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{6,a} U {8,a}
=Φ B = (1,2,3,4,6,7,8)
ε
{2,a} = {3}

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,8)
={(1,a} U {2,a} U {3,a} U {4,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{6,a} U {8,a}
= Φ U {3} B = (1,2,3,4,6,7,8)
ε
{3,a} = Φ

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,7,8)
={(1,a} U {2,a} U {3,a} U {4,a} U {5,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{6,a} U {8,a}
= Φ U {3} U Φ B = (1,2,3,4,6,7,8)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7
{4Ua} = Φ

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,7,8)
={(1,a} U {2,a} U {3,a} U {4,a} U {5,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{6,a} U {8,a}
= = Φ U {3} U Φ U Φ B = (1,2,3,4,6,7,8)
ε

a
2 3
ε ε {6,a} = Φ

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,5,6,8|)
={(1,a} U {2,a} U {3,a} U {4,a} U {5,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{6,a} U {8,a}
= Φ U {3} U Φ U Φ U Φ B = (1,2,3,4,6,7,8)
ε

a
2 3
ε ε {7,a} = {8}

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = (1,2,3,4,6,7,8)
={(1,a} U {2,a} U {3,a} U {4,a} U {6,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a} U {8,a}
= Φ U {3} U Φ U Φ U Φ {8} B = (1,2,3,4,6,7,8)
ε

a
2 3
ε ε {8Ua} = Φ

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = (1,2,3,4,6,7,8)
={(1,a} U {2,a} U {3,a} U {4,a} U {6,a} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a} U {8,a}
= Φ U {3} U Φ U Φ U Φ {8} U Φ B = (1,2,3,4,6,7,8)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,a) = ({1,2,3,4,6,7,8|)
={(1,a} U {2,a} U {3,a} U {4,a} U {7,a} U A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a} U {8,a}
= ε – Closure(3) U ε – Closure(8) B = (1,2,3,4,6,7,8) B
= {1,2,3,4,6,7} U {8}
=(1,2,3,4,6,7,8} =B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
={(1,b} U {2,b} U {3,b} U {4,b} U {6,b} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a} U {8,a}
B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
={(1,b} U {2,b} U {3,b} U {4,b} U {6,b} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a} U {8,a}
B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
={(1,b} U {2,b} U {3,b} U {4,b} U {6,b} U
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,b} U {8,a}
= Φ U Φ U Φ U {5} U Φ U Φ U Φ U {9} B = (1,2,3,4,6,7,8) B
= = ε – Closure(5) U ε – Closure(9)
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}

B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}

B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,4,5,6,7}
B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε {9, ε} = Φ

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,4,5,6,7} U {9}
B = (1,2,3,4,6,7,8) B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,4,5,6,7} U {9}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= {1,2,4,5,6,7,9}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,4,5,6,7} U {9}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= {1,2,4,5,6,7,9}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(B,b) = ({1,2,3,4,6,7,8)
= ε – Closure(5) U ε – Closure(9)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,4,5,6,7} U {9}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= {1,2,4,5,6,7,9}
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1.2.5,6,7,9}

C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
{1,a} = Φ ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}

C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
{1,a} = Φ ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1.2.5,6,7,9}
=ΦU
C = {1,2,4,5,6,7}
ε
{2,a} = {3}

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3}
C = {1,2,4,5,6,7}
ε
{3,a} = Φ

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7
{4,a} = Φ

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7
{5,a} = Φ

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε {6,a} = Φ

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε {7,a} = 8

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ U Φ {8}
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε {7,a} = 8

ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ U Φ {8}
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ U Φ {8}
C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= {1,a}U{2,a} U {3,a} U {4,a} U {5,a} U {6,a} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= Φ U Φ U {3} U Φ U Φ U Φ U Φ {8}
= ε – Closure(3) U ε – Closure(8) C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,a) = ({1,2,3,4,5,6,7)
= ε – Closure(3) U ε – Closure(8)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,2,3,4,6,7} U {8}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
=(1,2,3,4,6,7,8} = B
C = {1,2,4,5,6,7} B
ε
{2,b} = Φ {3,b} = Φ

a
2 3
ε ε {6,b} = Φ {7,b} = Φ

{1,b} = Φ ε a b
ε 8 9
0 1 6 7
{4,b} = 5 {5,b} = Φ

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,b) = ({1,2,3,4,5,6,7)
= {1,b}U{2,b} U {3,b} U {4,b} U {5,b} U {6,b}
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}

C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7
{4,b} = 5

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,b) = ({1,2,3,4,5,6,7)
= {1,b}U{2,b} U {3,b} U {4,b} U {5,b} U {6,b} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= = Φ U Φ U Φ U {5} U Φ U Φ U
= ε – Closure(5) C = {1,2,4,5,6,7}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε
Starting with the start state: State a b
(C,b) = ({1,2,3,4,5,6,7)
= {1,b}U{2,b} U {3,b} U {4,b} U {5,b} U {6,b} A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
{7,b}
= = Φ U Φ U Φ U {5} U Φ U Φ U B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= ε – Closure(5)
= {1,2,4,5,6,7} = C C = {1,2,4,5,6,7} B C
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,a}U{2,a} U {4,a} U {5,a} U {6,a} U
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{7,a} U {9,a}
C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9}
ε
{2,a} = 3

a
2 3
ε ε {7,a} = 8
{6,a} = Φ
ε a b
ε {1,a} = Φ 8 9
0 1 6 7
{4,a} = Φ {5,a} = Φ

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,a}U{2,a} U {4,a} U {5,a} U {6,a} U {7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,a}

C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9}
ε
{2,a} = 3

a
2 3
ε ε {7,a} = 8
{6,a} = Φ
ε a b
ε {1,a} = Φ 8 9
0 1 6 7
{4,a} = Φ {5,a} = Φ

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,a}U{2,a} U {4,a} U {5,a} U {6,a} U {7,a}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,a}
= ε – Closure(3) U ε – Closure(8) C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(3) U ε – Closure(8)
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}

C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(3) U ε – Closure(8)
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}

C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9}
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(3) U ε – Closure(8)
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= {1,2,3,4,6,7} U {8}
=(1,2,3,4,6,7,8} =B C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,a) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= ε – Closure(3) U ε – Closure(8)
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= {1,2,3,4,6,7} U {8}
=(1,2,3,4,6,7,8} =B C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,b) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,b}U{2,b} U {4,b} U {5,b} U {6,b} U {7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,b}

C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε
{2,b} = Φ

a
2 3
ε ε {6,b} = Φ {7,b} = Φ
{9,b} = Φ

ε a b
ε {1,b} = Φ 8 9
0 1 6 7
{5,b} = Φ
{4,b} = 5

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,b) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,b}U{2,b} U {4,b} U {5,b} U {6,b} U {7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,b}
= Φ U Φ U {5} U Φ U Φ U Φ U Φ C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,b) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,b}U{2,b} U {4,b} U {5,b} U {6,b} U {7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,b}
= Φ U Φ U {5} U Φ U Φ U Φ U Φ C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,b) = ({1,2,4,5,6,7,9) A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,b}U{2,b} U {4,b} U {5,b} U {6,b} U {7,b}
B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
{9,b}
= Φ U Φ U {5} U Φ U Φ U Φ U Φ C = {1,2,4,5,6,7} B C

D = {1,2,4,5,6,7,9} B
ε

a
2 3
ε ε
ε a b
ε 8 9
0 1 6 7

ε 4 5 ε
b

ε State a b
Starting with the start state:
(D,b) = ({1,2,3,4,5,6,7)
A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}
= {1,b}U{2,b} U {3,b} U {4,b} U {5,b} U {6,b}
{7,b} B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}
= = Φ U Φ U Φ U {5} U Φ U Φ U
= ε – Closure(5) C = {1,2,4,5,6,7} B C
= {1,2,4,5,6,7} = C
D = {1,2,4,5,6,7,9} B C
NFA to DFA State a b

A = (0,1,2,4,7) B = (1,2,3,4,6,7,8) C = {1,2,4,5,6,7}

b B = (1,2,3,4,6,7,8) B D = {1,2,4,5,6,7,9}

C = {1,2,4,5,6,7} B C
C D = {1,2,4,5,6,7,9} B C
a
b
a b
a
A B

a
b

You might also like