Week4 Lecture1
Week4 Lecture1
Afsana Afrin
Lecturer
Dept of Computer Science and Engineering
Bangladesh Army University of Science & Technology
Algorithm
Input − DFA
Output − Minimized DFA
Step 1 − Draw a table for all pairs of states (Qi, Qj) not necessarily
connected directly [All are unmarked initially]
Step 2 − Consider every state pair (Qi, Qj) in the DFA where Qi ∈
F and Qj ∉ F or vice versa and mark them. [Here F is the set of
final states]
Step 3 − Repeat this step until we cannot mark anymore states −
If there is an unmarked pair (Qi, Qj), mark it if the pair {δ (Qi, A), δ
(Qj, A)} is marked for some input alphabet.
Step 4 − Combine all the unmarked pair (Qi, Qj) and make them a
single state in the reduced DFA.
Step 1 − Draw a table for all pairs of states (Qi, Qj) not necessarily
connected directly [All are unmarked initially]
Step 4 −
• Increment k by 1.
• Find Pk by partitioning the different sets of Pk-1 .
• In each set of Pk-1 , consider all the possible pair of states
within each set and if the two states are distinguishable,
partition the set into different sets in Pk.
• Two states q1 and q2 are distinguishable in partition Pk for any
input symbol ‘a’, if δ (q1, a) and δ (q2, a) are in different sets
in partition Pk-1.
Step 5 −
• Repeat step-04 until no change in partition occurs.
• In other words, when you find Pk = Pk-1, stop.
Step 6 −
• All those states which belong to the same set are equivalent.
• The equivalent states are merged to form a single state in the
minimal DFA.
a b
→q0 q1 q2
q1 q1 q3
q2 q1 q2
q3 q1 *q4
*q4 q1 q2
P0 = { q0 , q1 , q2 , q3 } { q4 }
P1 = { q0 , q1 , q2 } { q3 } { q4 }
P2 = { q0 , q2 } { q1 } { q3 } { q4 }
P3 = { q0 , q2 } { q1 } { q3 } { q4 }