CMPS 260 Spring 2022
Homework #4: Regular Expressions
Due: 2pm, Friday March 11

Where r is a regular expression, L(r) denotes the language (i.e., set of strings) described by r.

1. Present a list containing precisely those strings of length six that are members of L( a(ba + c)* ). Arrange the strings in alphabetical order.


2. Present a list containing precisely those strings of length five or less that are members of

L( (ba + a)*bb(a + ab)* ).

Arrange the strings from shortest to longest; within each group of strings having the same length, put them in alphabetical order.


3. Present a regular expression describing LR (the reverse of L), where L is the language described by the regular expression

(b + λ)(abb + b)*ba(ab + a)*

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

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

L contains precisely those strings having at least one a followed by an odd number of b's and is described by the regular expression aa*b(bb)*.


5. Present a regular expression describing the language over {0,1} containing precisely those strings having exactly two occurrences of 11 and no occurrences of 111. As an aid, provided is the regular expression

(0 + 10)*(1 + λ)

describing the language over {0,1} containing precisely those strings having no occurrences of 11.

For a small bonus, present a second regular expression describing the language as described above, but allowing for the occurrence of 111. Such an occurrence counts as two overlapping occurrences of 11.


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

(a) { ba2k  |  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}* ∧  na(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.