HW 1
HW 1
Homework 1
Due: October 11, 2013 17.00
Questions
1. (12pts) State whether the following statements are true or not. You must give a brief explanation
or show a counter example to receive full credit.
(a) (3pts) If infinitely many subsets of a language are regular then the language itself is also
regular.
(b) (3pts) Any NFA with all accept states accepts Σ∗ .
(c) (3pts) r and s being regular expressions, (rs + r)∗ r = r(sr + r)∗ .
(d) (3pts) With pumping lemma, we can prove that L = {w : w = 1} is a regular language.
2. (16pts) Give a DFA for each of the following languages.
(a) (8pts) L = {w ∈ {0, 1}∗ : (2n0 (w) + 2n1 (w)) mod 3 < 1}.
(b) (8pts) L = {w ∈ {0, 1}∗ : w, when read, as a binary number, is a multiple of 3}.
The alphabet is Σ = {0, 1}; hence the strings are binary strings. The strings can be separated by
any kind of whitespaces, i.e., tab, space, newline etc.
Answers for questions 1-5 should be returned in hard copy to your TA. The answer (perl script)
for question 6 should be e-mailed to your TA at acer@cs.bilkent.edu.tr, with the subject line
cs476hw1, as an attachment zip file named NameSurname.zip including NameSurname.pl. Good
luck to all.