0% found this document useful (0 votes)
51 views

Week4 Lecture1

The document discusses two methods for minimizing deterministic finite automata (DFAs): the Myhill-Nerode theorem and the equivalence theorem. The Myhill-Nerode theorem involves constructing a table to mark equivalent state pairs in a DFA until no more pairs can be marked. The equivalent state pairs are then combined into single states in the minimized DFA. The equivalence theorem eliminates dead and inaccessible states, constructs a state transition table, and recursively partitions the DFA's states into equivalences classes until no further partitions are possible, at which point equivalent states are merged.

Uploaded by

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

Week4 Lecture1

The document discusses two methods for minimizing deterministic finite automata (DFAs): the Myhill-Nerode theorem and the equivalence theorem. The Myhill-Nerode theorem involves constructing a table to mark equivalent state pairs in a DFA until no more pairs can be marked. The equivalent state pairs are then combined into single states in the minimized DFA. The equivalence theorem eliminates dead and inaccessible states, constructs a state transition table, and recursively partitions the DFA's states into equivalences classes until no further partitions are possible, at which point equivalent states are merged.

Uploaded by

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

Minimization of DFA

Afsana Afrin
Lecturer
Dept of Computer Science and Engineering
Bangladesh Army University of Science & Technology

19-Jul-20 Minimization of DFA 1


Minimization of DFA

• Myphill-Nerode Theorem ( Table filling Method)


• Equivalence Theorem

19-Jul-20 Minimization of DFA 2


Myhill-Nerode Theorem

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.

19-Jul-20 Minimization of DFA 3


Myhill-Nerode Theorem

19-Jul-20 Minimization of DFA 4


Myhill-Nerode Theorem

Step 1 − Draw a table for all pairs of states (Qi, Qj) not necessarily
connected directly [All are unmarked initially]

19-Jul-20 Minimization of DFA 5


Myhill-Nerode Theorem

19-Jul-20 Minimization of DFA 6


Myhill-Nerode Theorem

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]

19-Jul-20 Minimization of DFA 7


Myhill-Nerode Theorem

19-Jul-20 Minimization of DFA 8


Myhill-Nerode Theorem

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.

19-Jul-20 Minimization of DFA 9


Myhill-Nerode Theorem

19-Jul-20 Minimization of DFA 10


Myhill-Nerode Theorem

Step 4 − Combine all the unmarked pair (Qi, Qj) and


make them a single state in the reduced DFA.

19-Jul-20 Minimization of DFA 11


Myhill-Nerode Theorem

19-Jul-20 Minimization of DFA 12


Equivalence Theorem

Step 1 − Eliminate all the dead states and inaccessible states


from the given DFA (if any).

Step 2 − Draw a state transition table for the given DFA.

Step 3 −Now, start applying equivalence theorem.

•Take a counter variable k and initialize it with value 0.


•Divide Q (set of states) into two sets such that one set
contains all the non-final states and other set contains all
the final states.
•This partition is called P0.

19-Jul-20 Minimization of DFA 13


Equivalence Theorem

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.

19-Jul-20 Minimization of DFA 14


Equivalence Theorem

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.

19-Jul-20 Minimization of DFA 15


Equivalence Theorem

19-Jul-20 Minimization of DFA 16


Equivalence Theorem

a b

→q0 q1 q2

q1 q1 q3

q2 q1 q2

q3 q1 *q4

*q4 q1 q2

19-Jul-20 Minimization of DFA 17


Equivalence Theorem

P0 = { q0 , q1 , q2 , q3 } { q4 }
P1 = { q0 , q1 , q2 } { q3 } { q4 }
P2 = { q0 , q2 } { q1 } { q3 } { q4 }
P3 = { q0 , q2 } { q1 } { q3 } { q4 }

Since P3 = P2, so we stop.


From P3, we infer that states q0 and q2 are equivalent and
can be merged together.

19-Jul-20 Minimization of DFA 18


Equivalence Theorem

19-Jul-20 Minimization of DFA 19


Thank You

19-Jul-20 Minimization of DFA 20

You might also like