0% found this document useful (0 votes)
8 views3 pages

Rishi Dadlani: September 11, 2024

Uploaded by

Rishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Rishi Dadlani: September 11, 2024

Uploaded by

Rishi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

262 HW 1

Rishi Dadlani
September 11, 2024
Rishi Dadlani ;A< September 11, 2024

Problem 1:
Let Σ = {a, b}. Consider the language A consisting of strings w such that w contains the substring aa and ends with
a. Draw the DFA that accepts A. Make sure to clearly mark the initial state and the accepting states.
b

a
q1 b q2 q3
a
a

a b

q4

Problem 2:
Let Σ = {a, b}. Consider the language A consisting of strings w s.t. s contains and odd number of a symbols and at
least two b symbols. Draw a DFA that accepts A. Make sure to clearly mark the initial state and the accepting states.
b b

q5 a q6

a
b b

q3 a q4

a
b b

q1 a q2

Problem 3:
Given an alphabet Σ = {a1 , a2 , . . . , ak } with k symbols, where k > 0, let A be the language of strings w such that at
least one symbol appears consecutively in w, that is, there exists 1 ≤ i ≤ k such that ai ai is a substring of w.

1. Describe a DFA to accept A. How many states does it have, as a function of k?

1
Rishi Dadlani ;A< September 11, 2024

a1 ,...,ak

Accept
ak a1 a2
ak a2

a1
a1 .. a1
.
• ak Start a2 •
..
.
ak
...
• a2
...

We have k +2 states. We have the start state, which is blank, the accept state, which is seen when two characters
have appeared consecutively, and the “intermediate” steps, one for each character (when the previous one was
not the same as the current state). δ maps state qi to the accept state iff the letter it reads is ai , otherwise, if it
reads letter ak (k ̸= i) it maps to state qk .
In the diagram drawn above, we draw the . . . representing the other “arms” for each a3 ≤ ai ≤ ak−1

2. If M is a DFA accepting A, give a precise lower bound (as a function of k) on the number of states of A. Prove
your answer.
We claimed in the previous part that we needed to track at least k + 2 states. To show this, we can show that
for each pair of states, we can find a suffix s.t. concatenation leaves one in the accept state and not the other.
Suppose we consider the start state and any other state. For each of those states, there is some suffix that moves
it directly to the accept state (as seen in the drawing). We can just choose that suffix. For example, if we’re at
the state corresponding to the previous letter being ai , we can choose ai as our suffix.
Now suppose we have the accept state and any other state. All we have to do is choose anything that isn’t the
same as the previous letter seen (or in the case of the start state, anything works). For example, if we’re at the
state corresponding to the previous letter being ai , we can choose anything but ai as our suffix.

Finally, suppose we have two states where neither is the start or accept state. Call them the state where we last
saw ai and the state where we last saw aj (i ̸= j). Simply choose ai as the suffix, and the first string will be
accepted where the second won’t.

You might also like