Minimizing DFAs By Partitioning 1 Minimizing DFAs Lots
Minimizing DFA’s By Partitioning 1
Minimizing DFA’s • Lots of methods • All involve finding equivalent states: – States that go to equivalent states under all inputs (sounds recursive) • We will use the Partitioning Method 2
Minimizing DFA’s by Partitioning Consider the following dfa (from Forbes Louis at U of KY): • Accepting states are yellow • Non-accepting states are blue • Are any states really the same? 3
• S 2 and S 7 are really the same: Both Final states Both go to S 6 under input b Both go to S 3 under an a • S 0 and S 5 really the same. Why? • We say each pair is equivalent Are there any other equivalent states? We can merge equivalent states into 1 state 4
Partitioning Algorithm • First – Divide the set of states into Final and Non-final states Partition II S 0 S 1 S 3 S 4 S 5 S 6 *S 2 *S 7 a S 1 S 5 S 3 S 1 S 3 S 3 b S 4 S 2 S 3 S 4 S 7 S 6 5
Partitioning Algorithm • Now – See if states in each partition each go to the same partition • S 1 & S 6 are different from the rest of the states in Partition I (but like each other) • We will move them to their own partition S 0 S 1 S 3 S 4 S 5 S 6 *S 2 a S 1 S 5 S 3 S 1 S 3 *S 7 S 3 I I I I S 4 S 2 S 3 S 4 S 7 S 6 b I II I S 6 I 6
Partitioning Algorithm S 0 S 5 S 3 S 4 S 1 S 6 *S 2 *S 7 a S 1 S 3 S 1 S 5 S 3 S 3 b S 4 S 3 S 4 S 2 S 7 S 6 7
Partitioning Algorithm • Now again – See if states in each partition each go to the same partition – In Partition I, S 3 goes to a different partition from S 0, S 5 and S 4 – We’ll move S 3 to its own partition S 0 S 5 S 3 S 4 S 1 S 6 *S 2 *S 7 a S 1 III S 3 I S 1 III S 5 I S 3 I b S 4 I S 3 I S 4 I S 2 II S 7 II S 6 III 8
Partitioning Algorithm Note changes in S 6, S 2 and S 7 S 0 S 5 S 4 S 3 S 1 S 6 *S 2 *S 7 a S 1 III S 3 IV S 5 I S 3 IV b S 4 I S 3 IV S 2 II S 7 II S 6 III 9
Partitioning Algorithm • Now S 6 goes to a different partition on an a from S 1 • S 6 gets its own partition. • We now have 5 partitions • Note changes in S 2 and S 7 S 0 S 5 S 4 S 3 S 1 S 6 *S 2 *S 7 a S 1 III S 3 IV S 5 I S 3 IV b S 4 I S 3 IV S 2 II S 7 II S 6 V 10
Partitioning Algorithm • All states within each of the 5 partitions are identical. • We might as well call the states I, II III, IV and V. S 0 S 5 S 4 S 3 S 1 S 6 *S 2 *S 7 a S 1 III S 3 IV S 5 I S 3 IV b S 4 I S 3 IV S 2 II S 7 II S 6 V 11
Partitioning Algorithm Here they are: I *II IV V a III IV IV b I V II IV II 12
b b a b a V a b 13
- Slides: 13