Asst 1 Q
Asst 1 Q
Assignment #1, due Monday September 19th by 12pm (noon), via GradeScope.com.
Submission procedure: You will need to create an account at GradeScope.com, and you will
need a Course Entry Code, which was given in class and posted on Piazza. You can submit either
images (i.e., photos of handwritten work) or PDFs.
[12] 1. For each of the following languages, provide a DFA that accepts it. You should define each
DFA by drawing it as a directed graph with accepting states marked by double concentric
circles. You do not need to justify your answers.
Your DFAs should not have any undefined transitions. Any transitions that are intended for
immediate rejection should be sent to infinite looping states (as in the solution to Exercise
1.4 (b) in the textbook).
Your solution does not need to give the smallest possible DFA, but marks may be deducted
if your solution is unnecessarily complicated. For each of the questions there is a DFA with
less than 10 states.
[4] a. The language L1 = { x ∈ {a, b, c}∗ : x has exactly one occurrence of the substring ab }.
[4] b. The language L2 = { x ∈ {0, 1}∗ : x is nonempty and begins and ends with the same symbol }.
[4] c. The language L3 = { x ∈ {0, 1}∗ : the 3rd from last symbol in x is 1 }.
[10] 2. [5] a. Show that if M is a DFA that recognizes language B, swapping the accept and
nonaccept states in M yields a new DFA recognizing the complement of B. Conclude
that the class of regular languages is closed under complement.
[5] b. Show by giving an example that if M is an NFA that recognizes language C, swapping
the accept and nonaccept states in M doesn’t necessarily yield a new NFA that
recognizes the complement of C. Is the class of languages recognized by NFAs closed
under complement? Explain your answer.
[10] 3. For each claim below, state whether it is true or false, and prove your answer.
[5] a. Is it true that, for all languages A and B, we have (A∗ ∩ B ∗ )∗ = (A ∩ B)∗ ?
[5] b. Is it true that, for all languages A and B, we have (A∗ ∪ B ∗ )∗ = (A ∪ B)∗ ?
[12] 4. Give regular expressions for the following languages. You do not need to justify your answers.
For convenience, you can use the following notation:
• (x)+ (which matches one or or occurrences of the pattern x)
• (x)? (which matches zero or one occurrences of the pattern x)
• Σ (which matches any single character in Σ)
The alphabet is always Σ = {0, 1}.
[3] a. The set of strings that begin with a 1 and end with a 0.
[3] b. The set of all strings that contain at least three 1s.
[3] c. The set of all strings that do not contain 110 as a substring.
[3] d. The set of nonempty strings that do not contain two consecutive occurrences of the
same symbol.
1
[15] 5. OPTIONAL BONUS QUESTION: Let Σ = {0, 1}. Let
[6] a. Show that, for each k, any DFA that recognizes SSk must have at least 2k states.
[9] b. Describe a much smaller NFA for SSk , the complement of SSk . (The number of
states should at most a polynomial in k.)
Let
Lk = { xy : x, y ∈ Σ∗ and |x| = |y| = k and x 6= y } .
If you’d prefer to solve the problem for Lk instead of SSk , that is ok too.