CMPS 260 Spring 2019
Homework #4: Regular Expressions
Due: Noon, Saturday, March 23

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 five that are members of L( (a + bb)* ). Arrange the strings in alphabetical order.

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

L( (ab + b)*b(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 regular expression

(ab + b)*b(a + ab)*

4. Present a regular expression describing the complement of the language

L = { a2n b2m+1  :  n≥0 ∧ m≥0 }.

L contains precisely those strings having an even number of a's followed by an odd number of b's.

5. Present a regular expression describing the language over {0,1} containing precisely those strings having exactly one occurrence of 00. Note that the regular expression

(1 + 01)*(0 + λ)

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

6. Present a regular expression describing the language

L = { w ∈ {a,b}*  :  na(w) mod 3 ≠ 0}

7. Use the algorithm described in Section 3.2 of Linz to produce an NFA that accepts the language described by the regular expression

(b + aa)*c*  +  abc

Within reason, you can take a few shortcuts. For example, the sub-NFA accepting abc can be the obvious 4-state NFA rather than the 6-state NFA that following the algorithm literally would produce. However, your final result should make it clear that you cobbled together sub-NFA's corresponding to sub-expressions within the given regular expression in the way described by the algorithm.