You are on page 1of 2

ExerciseSet 1

1. Design a DFA which recognizes the following


languages
(a) L
1
= {w {0, 1}

: w contains the string 0101}


(b) L
2
= {w {0, 1}

: w contains at least two 0s and


at most one 1}
Solution
(a) The state diagramof a DFA recognizing L
1
is
a
b
c
d
0
1
0
e
1 0
1
0
1
1 , 0
(b) The state diagramof a DFA recognizing L
2
is
a
b
c
d f
1
e
g
0
1
0
1
1
1
0
0
0
0
0
1
2. Let B
n
= {a
k
: k mod n = 0}. Showthat, for n 1,
B
n
is regular
Solution
Let = {a}. By denition, the language
A =
| {z }
n
is regular. So is the language
A
0
= A

{}
which is B
n
.
3. Which of the following statements are true?
(a) Aniteautomatonrecognizes aninnitelanguage.
(b) If you swap the accepting and non-accepting
states of any nite automaton the newmachine will
recognize the complement of the original language.
(c) All nite languages are regular languages.
Solution
They are all true.

You might also like