Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf ·...

74
Formal Languages and Automata DFA Minimization Ryan Stansifer Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901 http://www.cs.fit.edu/~ryan/ 2 July 2021 FL and Automata (DFA Minimization) © 2 July 2021 1/1

Transcript of Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf ·...

Page 1: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Formal Languages and AutomataDFA Minimization

Ryan Stansifer

Computer SciencesFlorida Institute of Technology

Melbourne, Florida USA 32901

http://www.cs.fit.edu/~ryan/

2 July 2021

FL and Automata (DFA Minimization) © 2 July 2021 1 / 1

Page 2: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Linz 6th, Section 2.4, pages 66–71HMU 3rd, Section 4.4, pages 155–165

Kozen 1997, Lecture 13 & 14, pages 77–88DFA minimization at Wikipedia

FL and Automata (DFA Minimization) © 2 July 2021 2 / 1

Page 3: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Any DFA defines one language, but a language may be defined by differentDFA. For a particular language there are many DFA’s that accept it.

For reasons of simplicity a DFA with the fewest number of state may bepreferred.

FL and Automata (DFA Minimization) © 2 July 2021 3 / 1

Page 4: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

DefinitionA state p of a DFA ⟨Q, Σ, δ, q0, F ⟩ is said to be inaccessible if for all x ∈ Σ∗ itis the case the δ∗(q0, x) ̸= p.

FL and Automata (DFA Minimization) © 2 July 2021 4 / 1

Page 5: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Reach := {q0}New := {q0}loop

New := { delta(q,c) for q in New for c in Sigma } - ReachReach := Reach union Newexit when New is empty

end loop;UnReach = Q - Reach

FL and Automata (DFA Minimization) © 2 July 2021 5 / 1

Page 6: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

DefinitionThe states p and q of a DFA ⟨Q, Σ, δ, q0, F ⟩ are said to be indistinguishable,written p ≈ q, if for all x ∈ Σ∗

δ∗(p, x) ∈ F ↔ δ∗(q, x) ∈ F

If two states are not indistinguishable, then they are distinguishable. Or,equivalently, we may define the following:

DefinitionThe states p and q of a DFA ⟨Q, Σ, δ, q0, F ⟩ are said to be distinguishable iffor some x ∈ Σ∗

δ∗(p, x) ∈ F xor δ∗(q, x) ∈ F

FL and Automata (DFA Minimization) © 2 July 2021 6 / 1

Page 7: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

TheoremThe relation p ≈ q of indistinguishable states is an equivalence relation, i.e., itis reflexive, symmetric, and transitive.

Proof.It is obviously reflexive and symmetric.The proof is by contradiction. Suppose p ≈ q and q ≈ r , but p and r aredistinguishable by some string w . Suppose that δ∗(p, w) ∈ F and so δ∗(r , w)must not be in F . Since p ≈ q, δ∗(q, w) ∈ F . This contradicts the fact that qand r are indistinguishable. Similarly if δ∗(p, w) /∈ F . We conclude p ≈ r .

The significance of this is that the indistinguishable relation partitions the setof states of a DFA into equivalence classes.

[Notation] We write [p]≈ for the set {q ∈ Q | p ≈ q}

FL and Automata (DFA Minimization) © 2 July 2021 7 / 1

Page 8: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

[Definintion] The DFA M/ ≈ is defined from a given DFA M as ⟨Q′, Σ, δ′, q′, F ′⟩where

• Q′ = {[p]≈ | p ∈ Q}• q′ = [q]≈• F ′ = {[p]≈ | p ∈ F}• δ′([p]≈, a) = [δ(p, a)] ≈ for all a ∈ Σ

The DFA M/ ≈ is well-defined since for all a ∈ Σ and all states in Q

p ≈ q ⇒ δ(p, a) ≈ δ(q, a)

FL and Automata (DFA Minimization) © 2 July 2021 8 / 1

Page 9: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

TheoremThe language L(M/ ≈) = L(M).

Proof.

x ∈ L(M/ ≈) iff δ∗() ∈ F ′

IFF [δ∗(s, x)]≈ ∈ F ′

IFF δ∗(s, x) ∈ FIFF x ∈ L(M)

FL and Automata (DFA Minimization) © 2 July 2021 9 / 1

Page 10: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimization Algorithm

Two algorithms1 Hopcroft’s partition refinement2 Brzozowski: reverse edges, convert to DFA, and do it again

FL and Automata (DFA Minimization) © 2 July 2021 10 / 1

Page 11: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimization Algorithm

For a DFA ⟨Q, Σ, δ, q0, F ⟩:1 Remove inaccessible state2 For every pair of states, mark whether or not they are distinguishable.3 Collapse indistinguishable states.

The states of the minimized DFA are non-empty, pairwise-disjoint subsets of theoriginal DFA.

FL and Automata (DFA Minimization) © 2 July 2021 11 / 1

Page 12: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Marking Algorithm

For a DFA ⟨Q, Σ, δ, q0, F ⟩ systematically try longer and longer strings to establishthat a pair of states is distinguishable.

1 Mark all unordered pairs {p, q} ∈ Q × Q as indistinguishable.2 Mark {p, q} as distinguishable, if p ∈ F xor q ∈ F .3 Repeat until no further changes: mark {p, q} as distinguishable, if

{δ(p, a), δ(q, a)} is distinguishable for some a ∈ Σ.

FL and Automata (DFA Minimization) © 2 July 2021 12 / 1

Page 13: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

DFA MinimizationAn Example

Combining Indistinquishable StatesLinz 6th, Example 2.18, page 69

DFA Minimization 13 Linz 6th, Example 2.18—1 of 23

Page 14: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFAFind a DFA equivalent to the one below with the minimum number of states.

A

B

C

D

E

a

b

ab

a b

a

b

a, b

Q Σ QA a BA b DB a CB b EC a BC b ED a CD b EE a EE b E

An example DFA. Linz 6th, Figure 2.18, page 69.DFA Minimization 14 Linz 6th, Example 2.18—2 of 23

Page 15: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b AB

CD

E

DFA Minimization 15 Linz 6th, Example 2.18—3 of 23

Page 16: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈B

CD

E

A, B: A and B are both non-final states.

DFA Minimization 16 Linz 6th, Example 2.18—4 of 23

Page 17: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ ×B

CD

E

A, C : A is not final, but C is final.

DFA Minimization 17 Linz 6th, Example 2.18—5 of 23

Page 18: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈B

CD

E

A, D: A and D are both not final.

DFA Minimization 18 Linz 6th, Example 2.18—6 of 23

Page 19: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B

CD

E

A, E : A is not final, but E is final.

DFA Minimization 19 Linz 6th, Example 2.18—7 of 23

Page 20: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B ×

CD

E

B, C : B is not final, but C is final.

DFA Minimization 20 Linz 6th, Example 2.18—8 of 23

Page 21: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈

CD

E

B, D: B and D are both not final.

DFA Minimization 21 Linz 6th, Example 2.18—9 of 23

Page 22: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈ ×

CD

E

B, E : B is final, but E is not final.

DFA Minimization 22 Linz 6th, Example 2.18—10 of 23

Page 23: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈ ×

C ×D

E

C , D: C is final but D is not final.

DFA Minimization 23 Linz 6th, Example 2.18—11 of 23

Page 24: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈ ×

C × ≈D

E

C , E : Both C and E are final.

DFA Minimization 24 Linz 6th, Example 2.18—12 of 23

Page 25: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈ ×

C × ≈D ×

E

D, E : D is not final, but D is final.

DFA Minimization 25 Linz 6th, Example 2.18—13 of 23

Page 26: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A ≈ × ≈ ×B × ≈ ×

C × ≈D ×

E

The resulting partition: {A, B, D}, {C , E}

DFA Minimization 26 Linz 6th, Example 2.18—14 of 23

Page 27: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

All pairs which were marked distinguishable earlier, remain distinguishable from thenon. All the others are re-examined to see if they might become distinguishable.

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × ×B ×

C ×D ×

E

DFA Minimization 27 Linz 6th, Example 2.18—15 of 23

Page 28: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × ×B ×

C ×D ×

E

A, B: a ∈ Σ distinguishes A from B, as δ(A, a) = B /∈ F but δ(B, a) = C ∈ F .

DFA Minimization 28 Linz 6th, Example 2.18—16 of 23

Page 29: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B ×

C ×D ×

E

A, C : a ∈ Σ distinguishes A from D, as δ(A, a) = B /∈ F but δ(D, a) = C ∈ F .

DFA Minimization 29 Linz 6th, Example 2.18—17 of 23

Page 30: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B × ≈

C ×D ×

E

B and D are indistinguishable, as δ(B, a) = δ(D, a) and δ(B, b) = δ(D, b).

DFA Minimization 30 Linz 6th, Example 2.18—18 of 23

Page 31: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B × ≈ ×

C ×D ×

E

a ∈ Σ distinguishes C from E , as δ(A, a) = B /∈ F but δ(D, a) = C ∈ F .

DFA Minimization 31 Linz 6th, Example 2.18—19 of 23

Page 32: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B × ≈ ×

C × ×D ×

E

DFA Minimization 32 Linz 6th, Example 2.18—20 of 23

Page 33: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B × ≈ ×

C × ×D ×

E

The resulting partition: {A}, {B, D}, {C}, {E}

DFA Minimization 33 Linz 6th, Example 2.18—21 of 23

Page 34: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA

Repeating the step creates no changes. The partition {A}, {B, D}, {C}, {E} cannotbe further refined. This can be seen from the fact the state B and D go to theidentical states on all symbols of the alphabet.

A

B

C

D

E

a

b

ab

a b

a

b

a, b A × × × ×B × ≈ ×

C × ×D ×

E

DFA Minimization 34 Linz 6th, Example 2.18—22 of 23

Page 35: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Minimize a DFA (Solution)The minimized DFA has a state for each equivalence class produced by the markingalgorithm. (One state fewer.) The equivalence class with the original start state isthe start state of the minimized DFA. Final states are those in which appears a finalstate of the original DFA.

A BD C E

a, b ab

a

b

a, b

Q Σ QA a BDA b BD

BD a CBD b EC a BDC b EE a EE b E

DFA Minimization 35 Linz 6th, Example 2.18—23 of 23

Page 36: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

DFA MinimizationAn Example

Combining Indistinquishable StatesFrom notes from U of Innsbruck

DFA Minimization 36 Linz 6th, Example 2.18—1 of 40

Page 37: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Example

Design a DFA over {a, b} containing at least three occurrences of three consecutiveb’s, overlapping permitted.

Creating a DFA for this language is not so hard. Then minimize it.

DFA Minimization 37 Linz 6th, Example 2.18—2 of 40

Page 38: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Here is a DFA over {a, b} containing at least three occurrences of three consecutiveb’s, overlapping permitted.

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

Now find an equivalent DFA with the minimum number of states.DFA Minimization 38 Linz 6th, Example 2.18—3 of 40

Page 39: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ≈ ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

The first iteration merely separates the final from the non-final states. The resultingpartition:

{A, B, C , D, E , F , G , H, I, J , K}, {L}DFA Minimization 39 Linz 6th, Example 2.18—4 of 40

Page 40: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ×B ≈ ≈ ×

C ≈ ≈ ×D ≈ ≈ ×

E ≈ ≈ ×F ≈ ≈ ×

G ≈ ≈ ×H ≈ ×

I ≈ ×J ≈ ×

K ×L

DFA Minimization 40 Linz 6th, Example 2.18—5 of 40

Page 41: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

for all s, s ′ ∈ {B · · · G , I, H} and for ⋆ ∈ a, b, δ(s, ⋆) and δ(s ′, ⋆) are non-final.DFA Minimization 41 Linz 6th, Example 2.18—6 of 40

Page 42: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, H:DFA Minimization 42 Linz 6th, Example 2.18—7 of 40

Page 43: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, D:DFA Minimization 43 Linz 6th, Example 2.18—8 of 40

Page 44: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, E : A and D are both non-final states.DFA Minimization 44 Linz 6th, Example 2.18—9 of 40

Page 45: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 45 Linz 6th, Example 2.18—10 of 40

Page 46: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Second Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

The resulting partition: {A, B, C , D, E , F , G , I, J}, {H, K}, {L}DFA Minimization 46 Linz 6th, Example 2.18—11 of 40

Page 47: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ×B ≈ ≈ ×

C ≈ ≈ ×D ≈ ≈ ×

E ≈ ≈ ×F ≈ ≈ ×

G ≈ ≈ ×H ≈ ×

I ≈ ×J ≈ ×

K ×L

DFA Minimization 47 Linz 6th, Example 2.18—12 of 40

Page 48: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

for all s, s ′ ∈ {B · · · G , I, H} and for ⋆ ∈ a, b, δ(s, ⋆) and δ(s ′, ⋆) are non-final.DFA Minimization 48 Linz 6th, Example 2.18—13 of 40

Page 49: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, H:DFA Minimization 49 Linz 6th, Example 2.18—14 of 40

Page 50: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, D:DFA Minimization 50 Linz 6th, Example 2.18—15 of 40

Page 51: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 51 Linz 6th, Example 2.18—16 of 40

Page 52: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 52 Linz 6th, Example 2.18—17 of 40

Page 53: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Third Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

The resulting partition: {A, B, C , E , F , I}, {D, G , J}, {H, K}, {L}DFA Minimization 53 Linz 6th, Example 2.18—18 of 40

Page 54: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ×B ≈ ≈ ×

C ≈ ≈ ×D ≈ ≈ ×

E ≈ ≈ ×F ≈ ≈ ×

G ≈ ≈ ×H ≈ ×

I ≈ ×J ≈ ×

K ×L

DFA Minimization 54 Linz 6th, Example 2.18—19 of 40

Page 55: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

for all s, s ′ ∈ {B · · · G , I, H} and for ⋆ ∈ a, b, δ(s, ⋆) and δ(s ′, ⋆) are non-final.DFA Minimization 55 Linz 6th, Example 2.18—20 of 40

Page 56: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, H:DFA Minimization 56 Linz 6th, Example 2.18—21 of 40

Page 57: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 57 Linz 6th, Example 2.18—22 of 40

Page 58: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 58 Linz 6th, Example 2.18—23 of 40

Page 59: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 59 Linz 6th, Example 2.18—24 of 40

Page 60: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Fouth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

The resulting partition: {A, B, E}, {C , F , I}, {D, G , J}, {H, K}, {L}DFA Minimization 60 Linz 6th, Example 2.18—25 of 40

Page 61: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ×B ≈ ≈ ×

C ≈ ≈ ×D ≈ ≈ ×

E ≈ ≈ ×F ≈ ≈ ×

G ≈ ≈ ×H ≈ ×

I ≈ ×J ≈ ×

K ×L

DFA Minimization 61 Linz 6th, Example 2.18—26 of 40

Page 62: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

for all s, s ′ ∈ {B · · · G , I, H} and for ⋆ ∈ a, b, δ(s, ⋆) and δ(s ′, ⋆) are non-final.DFA Minimization 62 Linz 6th, Example 2.18—27 of 40

Page 63: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

A, H:DFA Minimization 63 Linz 6th, Example 2.18—28 of 40

Page 64: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 64 Linz 6th, Example 2.18—29 of 40

Page 65: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 65 Linz 6th, Example 2.18—30 of 40

Page 66: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

DFA Minimization 66 Linz 6th, Example 2.18—31 of 40

Page 67: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Firth Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A ≈ ≈ ≈ ≈ ≈ ≈ × ≈ ≈ × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I ≈ ≈ ×J ≈ ×

K ×L

The resulting partition: {A}, {B, E}, {C , F}, {D, G}, {I}, {J}, {H, K}, {L}DFA Minimization 67 Linz 6th, Example 2.18—32 of 40

Page 68: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Sixth And Final Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A × × × × × × × × × × ×B ≈ ≈ ×

C ≈ ≈ ×D ≈ ≈ ×

E ≈ ≈ ×F ≈ ≈ ×

G ≈ ≈ ×H ≈ ×

I × × ×J × ×

K ×L

DFA Minimization 68 Linz 6th, Example 2.18—33 of 40

Page 69: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Sixth And Final Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A × × × × × × × × × × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × ≈ ×

I × × ×J × ×

K ×L

for all s, s ′ ∈ {B · · · G , I, H} and for ⋆ ∈ a, b, δ(s, ⋆) and δ(s ′, ⋆) are non-final.DFA Minimization 69 Linz 6th, Example 2.18—34 of 40

Page 70: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Sixth And Final Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A × × × × × × × × × × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I × × ×J × ×

K ×L

DFA Minimization 70 Linz 6th, Example 2.18—35 of 40

Page 71: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

Sixth And Final Iteration

A B C D

EFGH

I J K L

a

b

a

b

a

b

ab

b

aabb

aa b

ba

b b

aa, b

A × × × × × × × × × × ×B ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

C ≈ ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×D ≈ ≈ ≈ ≈ ≈ ≈ ≈ ×

E ≈ ≈ ≈ ≈ ≈ ≈ ×F ≈ ≈ ≈ ≈ ≈ ×

G ≈ ≈ ≈ ≈ ×H × × ≈ ×

I × × ×J × ×

K ×L

The resulting partition: {A}, {B}, {C}, {F}, {D, G}?, {I}, {J}, {H, K}, {L}DFA Minimization 71 Linz 6th, Example 2.18—36 of 40

Page 72: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

DFA MinimizationAn Example

Combining Indistinquishable StatesHMU 3rd, Example 4,18, page 156

The example ignores an inaccessible state which, in this case, goes way

DFA Minimization 72 HMU 3rd, Example 4.18—1 of 22

Page 73: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

A B C D

E

F G H

0 1 0

10 1

0

11 0

0 1

10

1

0

DFA Minimization 73 HMU 3rd, Example 4.18—1 of 22

Page 74: Formal Languages and Automata - DFA Minimizationryan/cse4083/notes/min.pdf · AnyDFAdefinesonelanguage,butalanguagemaybedefinedbydifferent DFA.ForaparticularlanguagetherearemanyDFA’sthatacceptit

AE BH C

FD G

0 1

10

0

10

1

1

0

The final partition {A, E}, {B, H}, {C}, {F , D}, {G}.

DFA Minimization 74 HMU 3rd, Example 4.18—1 of 22