

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


22C:111 — Fall 2005
page 1 of 2
Homework I
1. [15 points]
Take character set C = {a, b}, and languages S = {b, aba} and T = {e, bb}.
(a) what is the language T
2
?
(b) what is the language T
(c) what is the language S•T
? [note: this means S•(T
) not (S•T)
(d) what is the language (S•T)
(e) what is the language (S
2. [20 points]
Take character set C = {a, b}, and consider languages R = { a
2
even nos. 'a'), S = {a}•{ a
2
each of the following questions:
(a) what is the language R»S?
(b) what is the language R•S?
(c) what is the language R
(d) what is the language S
3. [30 points]
For C = {a, b}, write a regular expression that describes each of the languages
below, and justify that your answer describes exactly the required strings --
these are set equality demonstrations, every required string must be described
by your regular expression, and no other string can be.
(a) {e, a
3 , a
5 , a
6 , a
9 , a
10 , a
12 , a
15 , … } -- all and only strings of 'a's whose
length is either a multiple of 3 or a multiple of 5
(b) all and only strings that either (i) begin with 'aa' and have no 'a' following a
'b', or (ii) begin with 'bb' and have no 'b' following an 'a'
(c) {a, a
2 , a
4 , a
5 , a
7 , a
8 , … } -- all and only strings of 'a's whose length is not a
multiple of 3.
4. [15 points]
For the BNF definition X ::= b | aaaXa | aaXaa, determine whether or not the
string below is in L(X), and justify your answer — either a derivation if yes, or
what makes it impossible if no.
(a) a
7
ba
5
(b) a
6
ba
4
(c) a
8
ba
4
22C:111 — Fall 2005
page 2 of 2
5. [20 points]
Given the BNF definition X ::= e | XaXbX, determine whether or not each of the
following strings are in L(X) and justify your answer -- either a derivation if yes, or
what makes it impossible if no.
(a) aabbab
(b) abaaab
(c) abbaab
(d) aaabbb