CMPS 260 Spring 2024
HW #2: DFA's and Regular Languages
Due: 2pm, Wednesday, Feb. 14

1. Apply the algorithm illustrated here to the DFA described below to minimize it. Show your work. Present the minimized DFA in tabular form (similar to the left side of the figure below). You could also show the transition graph, if you wish.

The names that you give to the states in the minimized DFA should make clear which set of states each one came from. For example, if you find that {0,3,4} is an equivalence class of the indistinguishability relation of the given DFA, the corresponding state in the minimized DFA should be named {0,3,4}.

δ
stateabInitial?Final?
054  
152   
220  
326  
441  
534   
623   


2. Apply the Cartesian Product Construction upon the two DFAs shown below, M1 and M2, for the purpose of obtaining a DFA that accepts the intersection of L(M1) and L(M2). Present your answer in tabular form rather than (or in addition to, if you want) a transition graph. Each state in your DFA should be named so as to make it clear from which pair of states in M1 and M2 it arises. Feel free to use a name such as [0,2] rather than [q0, r2]. Don't include states that are unreachable from the start state.

M1
Stateδ
Start?Accepting? State IDab
q0q0q1
q1q2q0
q2q2q1

M2
Stateδ
Start?Accepting? State IDab
r0r1r1
r1r2r1
r2r1r0


3. Expressed in terms of the 5-tuple description of DFAs, the Cartesian Product Construction that aids in proving that the regular languages are closed under intersection goes like this:

For i = 1,2, let Mi = (Qi, Σ, δi, qi,0, Fi) be DFAs (with the same alphabet Σ). Then a DFA that accepts L(M1) ∩ L(M2) is M = (Q, Σ, δ, q0, F), where

(a) By changing a small detail of this construction, the language accepted by DFA M would be the difference L(M1) − L(M2) of L(M1) and L(M2) rather than their intersection. (For sets S and T, S−T = { a  |  a ∈S and a ∉ T }.) Describe that small change. Be precise.

(b) Similarly, a different small change in the construction yields a DFA that accepts the symmetric difference of L(M1) and L(M2). The symmetric difference of two sets S and T, sometimes denoted by S Δ T, contains those elements are are members of exactly one among S and T. In other words, S Δ T = (S − T) ∪ (T − S). Describe that small change. Be precise.


4. Let M = (Q, Σ δ, q0, F) be a DFA such that L = L(M) (i.e., M accepts language L).

Consider the language

L' = { x ∈ L  |  for all y ∈ Σ+, xy ∉ L}

Note: The notation Σ+ denotes the set of all non-empty strings over Σ. End of note.

In words, x is a member of L' if and only if x is a member of L but x is not a proper prefix of any member of L.

Describe how to modify M so as to obtain a DFA M' that accepts L'.

Bonus: Assume that M is a minimal DFA (meaning that every state is distinguishable from every other state). Make whatever meaningful observations you can about the accepting states in M'.


5. Let #: {0,1}+ ⟶ ℕ be the function that maps nonempty bit strings to natural numbers in accord with the binary numeral system. For example, #(11001) = 25 and #(100110) = 38. Where it is understood that x ∈ {0,1}+ (i.e., x is a non-empty bit string), a recursive characterization of # is as follows:

#(0)=0(base case)
#(1)=1(base case)
#(x0)=2·#(x)(recursive case)
#(x1)=2·#(x) + 1(recursive case)

Present a DFA that accepts the language consisting of all those bit strings x such that #(x) is one more than a multiple of four. A more formal way to describe this language (using % as the remainder (or modulo) operator) is

{ x ∈ {0,1}+  |  #(x) % 4 = 1 }

Your DFA should have four states, one corresponding to each of the possible remainders of a division by four.