CMPS 260 Spring 2022
HW #5: Regular Languages, Closure Properties, Pumping Lemma
Due: 2pm, March 25

1. Pictured below are two DFA's, M1 and M2.

(a) Use the cross-product construction described in Linz's Theorem 4.1 (also see the web page pertaining to Linz's Chapter 4) to obtain a DFA that accepts L(M1) ∩ L(M2). (Describe it in table form, and make sure to name the states so that their connections to the states in M1 and M2 are obvious.) Feel free to show the transition graph, too.

(b) Describe the relatively minor modification that you would make to the DFA that was your answer to part (a) to get a DFA that accepts L(M1) ∪ L(M2).

(c) Describe the relatively minor modification that you would make to the DFA that was your answer to part (a) to get a DFA that accepts L(M1) − L(M2) (which is the same as L(M1) ∩ (L(M2))c).

M1
M2


2. For a language L, define MAX(L) like this:

MAX(L) = { x ∈ L  |  for no y≠λ is xy ∈ L }

In words, MAX(L) is that subset of L containing those strings that cannot be extended to become longer members of L. Or, if you prefer, it contains every member of L that is not a proper prefix of any member of L.

Give a convincing argument that if L is a regular language, so is MAX(L).

Hint: Assume that L is given in the form of a DFA M and describe how to obtain a new DFA M' from M such that L(M') = MAX(L).


3. For a string x ∈ {a,b,c}*, define ERASE*a(x) to be the set of all strings obtainable from x by erasing zero or more occurrence of a. For example,

ERASE*a(baabcabacb)   = { baabcabacb,
   babcabacb, baabcbacb, baabcabcb,
   bbcabacb, babcbacb, babcabcb, baabcbcb,
   bbcbacb, bbcabcb, babcbcb
   bbcbcb }

Extending the definition to apply to languages, we have

ERASE*a(L) = x∈L ERASE*a(x)

That is, y ∈ ERASE*a(L) iff y is the result of erasing zero or more occurrences of a from some x ∈ L.

Let L be a regular language over the alphabet {a,b,c} (or any other alphabet that includes a). Present two convincing arguments that ERASE*a(L) is regular:


4. For a string x ∈ {a,b,c}*, define ERASE1a(x) to be the set of all strings obtainable from x by erasing exactly one occurrence of a. For example,

ERASE1a(aabcabacbaab) = { abcabacbaab, aabcbacbaab, aabcabcbaab, aabcabacbab }

Note that the string obtained by erasing the first a is the same as that obtained by erasing the second. Similarly for the 5th and 6th occurrences of a. That explains why, even though aabcabacbaab has six occurrences of a, ERASE1(x) contains only four strings rather than six.

Extending the definition to apply to languages, we have

ERASE1a(L) = x∈L ERASE1a(x)

That is, y ∈ ERASE1a(L) iff y is the result of erasing one occurrence of a from some x ∈ L.

Let L ⊆ {a,b,c}* be a regular language. Make a convincing argument that ERASE1a(L) is regular.

Hint: Assume that L is given in the form of a DFA M and describe how to obtain a new DFA (or NFA) M' from M such that L(M') = ERASE1a(L). Suggested is a construction in which, for each (non-dead) state in M there are two states in M'. (After all, each state in M' needs to "know" whether or not an a already has been erased.)


5. (Challenging) Present a convincing argument that, if L is regular, so is the language

L' = { x  |  xxrev ∈ L }.

That is, x ∈ L' iff xxrev ∈ L. For example, if abbabbabba (which is abbab·(abbab)rev) were a member of L, then abbab would be a member of L'.

Hint: Assume that L is provided in the form of an NFA M = (Q, Σ, δ, q0, {qf}). (Without loss of generality, you may assume that M has exactly one final/accepting state, qf.) Define δrev as follows: For every p,q ∈ Q and every a ∈ Σ:

q ∈ δrev(p,a)  iff  p ∈ δ(q,a).)

In other words, δrev describes the same set of transitions as does δ, except that their directions are reversed.

Now let Mrev = (Q, Σ, δrev, qf, {q0}) be the NFA obtained from M by swapping the roles of its initial and final states and by reversing the direction of every transition. Note that L(Mrev) = Lrev (the reverse of L).

Now form M × Mrev (via the cross-product construction described in Linz's Theorem 4.1) The trick is in choosing the correct set of final states.


6. For each of the given decision problems, present a persuasive argument that it is decidable (i.e., there exists an algorithm that solves it). Typically, that would be done by describing such an algorithm, which could be expressed at a high level of abstraction. As examples, statements such as

all would be considered valid algorithmic steps.

(a) Given a regular language L and a string x, determine whether any prefix of x is a member of L.

(b) Given a regular language L and a string x, determine whether any member of L has x as a suffix.

(c) Given a regular language L and a string x, determine whether any member of L has x as a substring.


7. Consider the language L = { akb2k  |  k≥0 }

(a) Use the Pumping Lemma to show that L is not regular.

(b) The language { akbk  |  k is even } is easily shown to be non-regular. Use that fact together with a closure property of regular languages to show that L is not regular.


8. (Optional bonus problem)
Identify a counterexample to the claim that if L is a regular language, then so is { xxrev  |  x ∈ L }.