12 State Minimization
12 State Minimization
➢The minimal DFA ensures minimal computational cost for tasks such as
pattern matching and is typically called canonical.
Theorem (Myhill-Nerode):
Let L ⊆ Σ* be a regular language. Then there exists deterministic finite automaton with precisely as
many states as there are equivalence classes in ≈L that accepts L (canonical or minimal deterministic
finite automaton for L)
Proof by Construction:
• K is the set of equivalence classes under ≈L
• S=[e] is the equivalence class of e under ≈L
• F = the equivalence classes of ≈L that are subsets of L
• δ(C1, 𝜎) = C2,where 𝜎 ∈ Σ, 𝑥 ∈ C1 και 𝑥𝜎 ∈ C2
Myhill-Nerode and Regularity
Corollary (Myhill-Nerode): A language L is regular if and only if ≈L has
finitely many equivalence classes
• what it means for a language L to be regular
• way for proving that a language is not regular
1. Unreachable states are the states that are not reachable from the initial
state of the DFA, for any input string. These states can be removed.
2. Dead states are the states from which no final state is reachable. These
states can be removed unless the automaton is required to be complete.
3. Nondistinguishable states are those that cannot be distinguished from
one another for any input string. These states can be merged.
DFA Minimization
DFA minimization is usually done in three steps:
Hopcroft minimization algorithm is the fastest known algorithm for this task for general FSAs
Example: DFA Minimization
Minimize the number of states of the given deterministic automaton
Example: DFA Minimization
Solution:
1. Remove all unreachable states
Example: DFA Minimization
Solution: (E stands for ≡ )
1. ≡0 = {𝑞1 , 𝑞3 }, {𝑞2 , 𝑞4 , 𝑞5 , 𝑞6 }
2. Minimize states 2. ≡1 = {𝑞1 , 𝑞3 }, {𝑞2 } {𝑞4 , 𝑞6 } {𝑞5 }
3. ≡2 = {𝑞1 , 𝑞3 }, {𝑞2 } {𝑞4 , 𝑞6 } {𝑞5 }
Practice: DFA Minimization
Minimize the number of states of the given deterministic automaton
Practice: DFA Minimization
Solution
Practice: DFA Minimization
Minimize the number of states of the given deterministic automaton
Practice: DFA Minimization
Solution
b α, b
α, b
α C α α
F H
A b B E
b α, b
α
b α, b
α D G I
b
α, b J
Practice: DFA Minimization
Solution
1. {A, B, C, D, E}, {F}, {G}, {H, I, J} b F
α α, b
2. {A, B, C, D}, {E}, {F}, {G}, {H, I, J} b
A B C,D α
3. {A, B}, {C, D}, {E}, {F}, {G}, {H, I, J} α, b E
4. {A}, {B}, {C, D}, {E}, {F}, {G}, {H, I, J} b
G
α α,
b
H,I,J
α,
b
References