CS375 Sol2 2023f
CS375 Sol2 2023f
1. For each of the following regular expressions find a language (i.e., a set of strings) that can be
represented/described by that expression. (4 points)
Solution:
Solution:
{𝑏𝑐, 𝑏, 𝑎𝑏𝑐, 𝑏𝑐 2 , … , 𝑎𝑛 𝑏𝑐, 𝑏𝑐 𝑛 , … }
= { 𝑏𝑐, 𝑎𝑏𝑐 … , 𝑎𝑛 𝑏𝑐, … } ∪ {𝑏, 𝑏𝑐, … , 𝑏𝑐 𝑛 , … }
= {Λ, 𝑎, 𝑎𝑎, … , 𝑎𝑛 , … }{𝑏𝑐} ∪ {𝑏}{Λ, 𝑐, 𝑐𝑐, … , 𝑐 𝑚 , … }
= L(𝑎∗ )L(𝑏𝑐) ∪ L(𝑏)L(𝑐 ∗ )
= L(𝑎∗ 𝑏𝑐) ∪ L(𝑏𝑐 ∗ )
= L(𝑎∗ 𝑏𝑐 + 𝑏𝑐 ∗ )
Hence, the regular expression that describes the given language is: 𝑎∗ 𝑏𝑐 + 𝑏𝑐 ∗
3. A regular expression for the language over the alphabet {a, b} with each string having an even
number of a’s is (b*ab*ab*)*b* or b*(b*ab*ab*). Use this result to find regular expressions for the
following languages
a. a language over the same alphabet but with each string having 4n (n>=0) a’s.
(3 points)
b. a language over the same alphabet but with each string having 4n+1 (n ≥ 0) a’s.
(3 points)
Solution:
a. Either one of the following expressions works:
(b*ab*ab*ab*ab*)*b* b*(b*ab*ab*ab*ab*)*
b*(b*ab*ab*ab*ab*)*ab* b*a(b*ab*ab*ab*ab*)*b*
4. If a regular expression for the language over the alphabet {a, b} with no string containing the
substring bb is (a+ba)*(Ʌ+b), then what is the regular expression for the language over the same
alphabet with no string containing the substring bbb or bbbb ? (3 points)
Solution:
If a string does not contain the substring bbb, it would not contain the substring
bbbb either, so we only have to consider the first case. The regular expression
for the language over the same alphabet with no string containing bbb is:
(a + ba + bba)*(Ʌ + b + bb)
5. The following proof shows that
Put the reason for each step in the blank on the right-hand side of that step. If an example in the
notes can be used for a step, quote that example. (5 points)
6. Fill out the blanks in the following figure to make it a DFA that recognizes the expression a + ba*b. (4
points)
7. Fill out the blanks in the following figure to make it a DFA for the expression a*bc* + aac + ac (4 points)
8. Fill out the blanks in the following table to make it the transition function of the given NFA. (3 points)
9. Fill out the blanks in the following figure to make it an NFA for the expression b*a* + b(a+b)* (9 points)