L9-DFA Minimization
L9-DFA Minimization
L9-DFA Minimization
DFA Minimization
Course Instructors:
Div 1: Praveen Pawar (Div 1)
Div 2: Jibi Abraham (Div 2)
1
Polling - 1
What is 0 transition of the converted DFA start
state?
A. ᵠ
B. [A]
C. [B]
D. [C]
E. [AB]
F. [BC]
G. [AC]
H. [ABC] 2
DFA Minimization
Are these two DFAs equivalent?
What is the language?
DFA Minimization: The Idea
• “Minimal”?
• DFA with Minimal number of states
4
Equivalent States
Build equivalence relation on states:
pq (w S*, ̂ (p, w)F ̂ (q, w)F)
pq (w S*, ̂(p, w)∉F ̂ (q, w) ∉ F)
5
Distinct States
If two states are not equivalent, then they are distinct
6
Example - 1
8
DFA Minimization: Algorithm
1. Create lower-triangular table, initially blank (unmarked and
with no dependences)
10
Example-1
q1
q2
q3
q4
1. Initialize table entries:
Unmarked, empty list q0 q1 q2 q3
11
Example-1
q1
q2
q3
q4
2. Mark pairs of final and
non-final states q0 q1 q2 q3
12
Example-1
q1
(q0,a) ? (q1,0) = ?
(q0,b) ? (q1,b) = ?
q2
q3
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
13
Example-1
(q0,a) ? (q1,a) = ?
q1
(q0,b) ? (q1,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
14
Example-1
(q0,a) ? (q2,a) = ?
q1
(q0,b) ? (q2,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
15
Example-1
(q0,a) ? (q3,a) = ?
q1
(q0,b) ? (q3,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
16
Example-1
(q1,a) ? (q2,a) = ?
q1
(q1,b) ? (q2,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
17
Example-1
(q1,a) ? (q3,a) = ?
q1
(q1,b) ? (q3,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
18
Example-1
(q2,a) ? (q3,a) = ?
q1
(q2,b) ? (q3,b) = ?
q4
3. For each unmarked
pair and symbol, … q0 q1 q2 q3
19
Example-1
({q0, q2}, a) {q1, q1}
({q0, q2}, b) {q2, q2}
q4
q0 q1 q2 q3
q1
q2
q3
q4
4. Combine unmarked
pairs of states q0 q1 q2 q3
21
Example-1
4. Combine unmarked pairs of states
q0 and q2 equivalent, all other states are distinct
5. Delete unreachable states: NIL
22
Polling - 2
Minimal DFA is free from
a. Dead States, Unreachable States
23
Example-2
0 1
0 1 0
a b c d b
1 0 1
0 1
1 1 0
e f g h c
1 0
0
d
e
1. Initialize table entries:
Unmarked, empty list f
a b c d e f g
24
DFA Minimization: Example
0 1
0 1 0
a b c d b
1 0 1
0 1
1 1 0
e f g h c
1 0
0
d
e
2. Mark pairs of final and
non-final states f
a b c d e f g
25
DFA Minimization: Example
(b,0) ? (a,0) = ?
1
0 (b,1) ? (a,1) = ?
0 1 0
a b c d State (g, b) marked?
0 1 b
1 State (c, f) marked?
0 1
1 1 0
e f g h c
1 0
0
d
e
3. For each unmarked
pair and symbol, … f
a b c d e f g
26
DFA Minimization: Example
0 1
0 1 0
a b c d b
1 0 1
0 1
1 1 0
e f g h c
1 0
0
d
e
4. Coalesce unmarked
pairs of states. f
0 1
0 1 g
ae ae bh c
1 0
bh 0
df 1 h
1 df g
0 a b c d e f g
27
DFA Minimization: Example
0 1
0 1 0
a b c d
1 0 1
0 1
1 1 0
e f g h
1 0
0 1
0 1
ae bh c
1 0
0
1
1 df g
0
28
?
29