You are on page 1of 3

CSCI 272 Formal Languages Spring 2024 - Homework Exercise 2

This homework assignment is worth 24 points total.

Answer the following questions to the best of your ability, writing your answers by hand on
white paper. Don't write too small, and use clear handwriting. You may use a pencil or pen,
but not one that uses red ink.

You will need to submit your solutions both physically and digitally. The digital copy should be
submitted to Moodle by Tuesday, February 13 by 23:59. The hard copy will be due on
Wednesday, February 14, at 12:00 – turn these in right before the second lecture session in
7E.429. The physical copy must match what was submitted digitally.

Scanning Guidelines:
• Make a good quality scan. Phone pictures (CamScanner) are acceptable, as long as
they are in focus and readable.
• Before submitting, verify that you can read your own scans.
• Scan the pages in the correct orientation (not rotated over 90 degrees.)
• You may submit your scans in a single .pdf file with the solutions presented in the same
order as the questions, or collect them into a single archive file (.zip, .gzip, or .rar) with
your files numbered in such a way that they appear in the right order.

1. (4 points total; 2 points each) Using either approach shown in the lessons, minimize the
states of the following DFAs:
a) b)
2. (10 points total; 2 points each) Determine whether the following languages are:
a) Regular
b) Context free, but non-regular.
c) Non-context free
If regular, provide a DFA, NFA, or a regular expression for the language.
If context free but not regular, provide a grammar or PDA for the language AND prove it is non-
regular using the pumping lemma for regular languages.
If non-context free, prove it using the pumping lemma or what you already know about non-
regular languages.
a) {a𝑛 b2𝑛 | 𝑛 ≥ 1}
b) { 𝑐𝑤𝑐 | 𝑐 ∈ {0, 1}, 𝑤 ∈ {0,1}∗ }
c) { a𝑘 | 𝑘 = 2𝑛 , 𝑛 ∈ 𝑁}
d) { 𝑠𝑡 |s, t ∈ {0,1}∗ , where 𝑠 is a substring of 𝑡 }
e) { 𝑠#𝑡 |s, t ∈ {0,1}∗ , where 𝑠 is a substring of 𝑡 }

3. (10 points total; 2 points each) Determine which of the following context free languages are
regular. If regular, provide a DFA, NFA, or a regular expression for the language. If it is not
regular, prove it is non-regular using the pumping lemma for regular languages.

a) The language with terminal alphabet {a, b, c} generated by the grammar:


S → SaSb
| c
b) The language with terminal alphabet {a, b, c} generated by the grammar:
S → AB
| cc
A → ac
B → bcB
| bbB
| cS
c) The language with terminal alphabet {a, b, c} generated by the grammar:
S → SabS
| c
d) The language with terminal alphabet {a, b} generated by the grammar:
S → aA
A → Bb
B → S
| ε
e) The language with terminal alphabet {a, b} generated by the grammar:
S → bAa
A → aSb
| A

You might also like