- Automata Theory Tutorial
- Automata Theory - Home
- Automata Theory Introduction
- Deterministic Finite Automaton
- Non-deterministic Finite Automaton
- NDFA to DFA Conversion
- DFA Minimization
- Moore & Mealy Machines

- Classification of Grammars
- Introduction to Grammars
- Language Generated by Grammars
- Chomsky Grammar Classification

- Regular Grammar
- Regular Expressions
- Regular Sets
- Arden's Theorem
- Constructing FA from RE
- Pumping Lemma for Regular Grammar
- DFA Complement

- Context-Free Grammars
- Context-Free Grammar Introduction
- Ambiguity in Grammar
- CFL Closure Properties
- CFG Simplification
- Chomsky Normal Form
- Greibach Normal Form
- Pumping Lemma for CFG

- Pushdown Automata
- Pushdown Automata Introduction
- Pushdown Automata Acceptance
- PDA & Context Free Grammar
- PDA & Parsing

- Turing Machine
- Turing Machine Introduction
- Accepted & Decided Language
- Multi-tape Turing Machine
- Multi-Track Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- Linear Bounded Automata

- Decidability
- Language Decidability
- Undecidable Language
- Turing Machine Halting Problem
- Rice Theorem
- Post Correspondence Problem

- Automata Theory Useful Resources
- Automata Theory - Quick Guide
- Automata Theory - Useful Resources
- Automata Theory - Discussion

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

**Input** − DFA

**Output** − Minimized DFA

**Step 1** − Draw a table for all pairs of states (Q_{i}, Q_{j}) not necessarily connected directly [All are unmarked initially]

**Step 2** − Consider every state pair (Q_{i}, Q_{j}) in the DFA where Q_{i} ∈ F and Q_{j} ∉ 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 (Q_{i}, Q_{j}), mark it if the pair {δ (Q_{i}, A), δ (Q_{i}, A)} is marked for some input alphabet.

**Step 4** − Combine all the unmarked pair (Q_{i}, Q_{j}) and make them a single state in the reduced DFA.

Let us use Algorithm 2 to minimize the DFA shown below.

**Step 1** − We draw a table for all pair of states.

a | b | c | d | e | f | |

a | ||||||

b | ||||||

c | ||||||

d | ||||||

e | ||||||

f |

**Step 2** − We mark the state pairs.

a | b | c | d | e | f | |

a | ||||||

b | ||||||

c | ✔ | ✔ | ||||

d | ✔ | ✔ | ||||

e | ✔ | ✔ | ||||

f | ✔ | ✔ | ✔ |

**Step 3** − We will try to mark the state pairs, with green colored check mark, transitively. If we input 1 to state ‘a’ and ‘f’, it will go to state ‘c’ and ‘f’ respectively. (c, f) is already marked, hence we will mark pair (a, f). Now, we input 1 to state ‘b’ and ‘f’; it will go to state ‘d’ and ‘f’ respectively. (d, f) is already marked, hence we will mark pair (b, f).

a | b | c | d | e | f | |

a | ||||||

b | ||||||

c | ✔ | ✔ | ||||

d | ✔ | ✔ | ||||

e | ✔ | ✔ | ||||

f | ✔ | ✔ | ✔ | ✔ | ✔ |

After step 3, we have got state combinations {a, b} {c, d} {c, e} {d, e} that are unmarked.

We can recombine {c, d} {c, e} {d, e} into {c, d, e}

Hence we got two combined states as − {a, b} and {c, d, e}

So the final minimized DFA will contain three states {f}, {a, b} and {c, d, e}

If X and Y are two states in a DFA, we can combine these two states into {X, Y} if they are not distinguishable. Two states are distinguishable, if there is at least one string S, such that one of δ (X, S) and δ (Y, S) is accepting and another is not accepting. Hence, a DFA is minimal if and only if all the states are distinguishable.

**Step 1** − All the states **Q** are divided in two partitions − **final states** and **non-final states** and are denoted by **P _{0}**. All the states in a partition are 0

**Step 2** − Increment k by 1. For each partition in P_{k}, divide the states in P_{k} into two partitions if they are k-distinguishable. Two states within this partition X and Y are k-distinguishable if there is an input **S** such that **δ(X, S)** and **δ(Y, S)** are (k-1)-distinguishable.

**Step 3** − If P_{k} ≠ P_{k-1}, repeat Step 2, otherwise go to Step 4.

**Step 4** − Combine k^{th} equivalent sets and make them the new states of the reduced DFA.

Let us consider the following DFA −

q | δ(q,0) | δ(q,1) |
---|---|---|

a | b | c |

b | a | d |

c | e | f |

d | e | f |

e | e | f |

f | f | f |

Let us apply the above algorithm to the above DFA −

- P
_{0}= {(c,d,e), (a,b,f)} - P
_{1}= {(c,d,e), (a,b),(f)} - P
_{2}= {(c,d,e), (a,b),(f)}

Hence, P_{1} = P_{2}.

There are three states in the reduced DFA. The reduced DFA is as follows −

Q | δ(q,0) | δ(q,1) |
---|---|---|

(a, b) | (a, b) | (c,d,e) |

(c,d,e) | (c,d,e) | (f) |

(f) | (f) | (f) |

Advertisements