CS 341 Automata Theory
Elaine Rich
Homework 10
Due Thursday, Nov. 9 at 11:00
1)
Determine, for each of the following languages, whether it is (I) Regular, (II) Context free but not regular, or
(III) not context free.
Prove your answer.
a)
L
= {
ww
R
w
:
w
∈
{
a
,
b
}*}.
b)
L
= {
w
:
w
=
uu
R
or
w
=
u
a
n
:
n
= 
u
,
u
∈
{
a
,
b
}*}.
c)
L
= {
a
n
b
2
n
c
m
}
∩
{
a
n
b
m
c
2
m
}.
d)
L
*, where
L
= {
0
*
1
i
0
*
1
i
0
*
}.
Hint: This one is tricky.
Be very careful in your analysis of
L
*.
e)
L
= {
w
∈
{0, 1}* : #
1
(
w
) = (#
0
(
w
))
2
}
f)
L
= {
x
∈
{
a
,
b
}* : 
x
 is even and the first half of
x
has one more
a
than does the second half}
2)
Let
L
1
= {
a
n
b
m
:
n
≥
m
}.
Let
R
1
= {(
a
∪
b
)* : there is an odd number of
a
's and an even number of
b
's}.
Use
the construction described in the book to build a PDA that accepts
L
1
∩
R
1
.
3)
Suppose that
L
is context free and
R
is regular.
Is
R

L
necessarily context free?
Prove your answer.
4)
Show that the contextfree languages are closed under letter substitution.
5)
Let
alt
be a function that maps from any language
L
over some alphabet
Σ
to a new language
L
′
as follows:
alt
(
L
) = {
x
:
5
y,n
(
y
∈
L
, 
y
 =
n
,
n
> 0,
y
=
a
1
…
a
n
,
2200
i
≤
n
(
a
i
∈
Σ
), and
x
=
a
1
a
3
a
5
…
a
k
, where
k
= (if even
(
n
) then
n
1 else
n
))}
a)
Consider
L
=
a
n
b
n
.
Clearly describe
L
1
=
alt
(
L
).
b)
Are the context free languages closed under the function
alt
?
Prove your answer.
6)
Let
chop
be a function that maps from any language
L
over some alphabet
Σ
to a new language
L
′
as follows:
chop
(
L
) = {
x
:
5
y
∈
L
(
y
=
uvw
,
u
,
w
∈
Σ
*,
v
∈
Σ
, 
u
 = 
w
, and
x
=
uw
)}
In other words, the strings in
chop
(
L
) are the odd length strings in
L
with the middle character chopped out.
Prove that the context free languages are not closed under
chop
.