# CMPSCI 250 Discussion #10: Minimizing Two DFA's

#### 24/26 April 2006

We went over the procedure to find a minimal DFA equivalent to a given DFA, and then practiced this on two examples.

• Question 1: The given DFA has six states {0,1,2,3,4,5}, input alphabet {0,1}, start state 0, only final state 0, and the following transition function: δ(i,0) = 2i % 6 and δ(i,1) = (2i + 1) % 6. As we discussed, this DFA accepts a binary string if and only if it denotes a natural that is divisible by six.

The initial partition is F = {0} and N = {1,2,3,4,5}. Looking at N, we find that 3 goes to F on 0 and to N on 1, while the other four go to N on either 0 or 1. So we must split N,

So our second partition is F = {0}, X = {3}, and Y = {1,2,4,5}. We look at N and find that states 1 and 4 go to Y on 0 and to X on 1, while states 2 and 5 go to Y on both 0 and 1. So we must split Y.

Now our third partition has F = {0}, X = {3}, U = {1,4}, and V = {2,5}. We must look at both U and V. For U, both states go to V on 0 and to X on 1. For V, both states go to U on 0 and to V on 1. So we have reached our final partition.

The final DFA has four states. F is the start state and only final state, and we have δ(F,0) = F and δ(F,1) = U. We also have

• δ(X,0) = F, δ(X,1) = U (but note that we can't merge F and X because one is final and the other isn;t)
• δ(U,0) = V, δ(U,1) = X
• δ(V,0) = U, δ(V,1) = V
• Question 2: The second DFA is similar except that the state set is {0,1,2,3,4,5,6,7} and the δ function divides by 8 instead of by 6. This DFA accepts a binary string if and only if it denotes a natural that is divisible by eight. These strings are exactly those that either consist entirely of zeros or end in at least three zeros -- a regular expression is 0* + (0+1)*000.

The initial partition has F = {0} and n = {1,2,3,4,5,6,7}. Looking at N, we find that 4 goes to F on 0 and to N on 1, while the other six states always go to N. So we must split N.

The second partition has F = {0}, X = {4}, and Y = {1,2,3,5,6,7}. Looking at Y, we find that states 2 and 6 go to X on 0 and to Y on 1, while the other four states always go to Y. So we must split Y.

The third partition has F = {0}, X = {4}, U = {2,6}, and V = {1,3,5,7}. We must look at U and V. We find that both states 2 and 6 go to X on 0 and to V on 1. We find that all four states in V go to U on 0 and to V on 1. So we have our final partition.

The DFA has four states {F,X,U,V}. F is the start state and only final state, and δ is as follows:

• δ(F,0) = F, δ(F,1) = V
• δ(X,0) = F, δ(X,1) = V
• δ(U,0) = X, δ(U,1) = V
• δ(V,0) = U, δ(V,1) = V
It's easy to see that this DFA can also be interpreted as counting the number of 0's seen in the input since the last 1: F means either no 1 yet or three or more 0's since the last 1, X means exactly two 0's since the last 1, Y means exactly 1 0 since the last 1, and X means the last input letter was 1.

Last modified 15 May 2006