CMPS 260 Spring 2024
Homework #4: Regular Languages/Expressions & Finite Transducers
Due: 2pm, Monday March 4

1. 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 x,y ∈ Σ*, if x = yz and |z|>0 then y ∉ L }

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

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


2. Let M and N be a pair of DFAs with the same input alphabet Σ. Let their state sets be, respectively, QM and QN, and let their sets of accepting states be, respectively, FM and FN. Suppose that MN is the "trimmed" DFA obtained by applying the Cartesian Product construction to M and N. (For MN to be trimmed means that its state set is that subset of QM × QN containing only those states reachable from its start state.)

(a) Describe how MN can be used to determine whether or not L(M) = L(N).

(b) Describe how MN can be used to determine whether or not L(M) ⊆ L(N).


3. Present a finite transducer that, given a bit string x as input, produces as output the bit string obtained by compressing every run in x to a run having length equal to the minimum of two and the length of that run. (A run is a substring of repeated symbols, extending to the left and right until reaching a different symbol or a string boundary.)

For example, if the input were 00001011111001 (i.e., 041015021), the resulting output would be 021012021. Notice how the runs of lengths four and five were truncated to runs of length two.


4. Present a finite transducer that performs addition on a pair of binary numerals written "backwards". For this purpose, the input alphabet will be Σ ∪ {#}, where Σ = { [0,0], [0,1], [1,0], [1,1]}. The output alphabet is {0,1}.

A string x#, where x ∈ Σ+, is intended to represent an instance of the binary addition problem, but with the bits written from least significant to most significant. The figure below shows an instance of a binary addition problem (on the left) and how that instance corresponds to the input string received and output string produced by the intended finite transducer (on the right).

  101101
+ 000111
  ------
  110100
Input: [1,1][0,1][1,1][1,0][0,0][1,0]#
Output: 001011


5. Present a regular expression r such that the language that it describes, L(r), is the complement of the language L, where

L = { 02m+1 1n  |  m≥0 ∧ n≥1 }.

L contains precisely those bit strings beginning with an odd number of 0's followed by at least one 1 and is described by the regular expression 0(00)*11*.


6. Present a regular expression describing the language over {a,b} containing precisely those strings having exactly two occurrences of bb and no occurrences of bbb. As an aid, provided is the regular expression

(a + ba)*(b + λ)

describing the language over {a,b} containing precisely those strings having no occurrences of bb.

For a small bonus, present a second regular expression describing the language as described above, but allowing for there to be one occurrence of bbb that counts as two overlapping occurrences of bb.


7. Present regular expressions for each of the following languages:

(a) { ba2kb  |  k≥0 }

(b) The set of strings over the alphabet {a,b} in which an even number of a's appear between any two occurrences of b.

(c) { xby  |  x,y ∈ {a,c}* ∧  #a(y) is even }

(d) The set of strings over the alphabet {a,b,c} in which an even number of a's appear between any two occurrences of b.

(e) The set of strings over the alphabet {a,b,c} in which either

The expectation is that the solution to each problem will give you insight (and maybe even a regular expression) that you can use in solving the next one.