ECS 120: Intoduction to the Theory of Computation
Homework 5
Due Nov 5, at the beginning of the lecture or by 1pm in Kemper 2131
Problem 1.
Find a decision procedure which determines if a given CFG (with alphabet
{
a, b
}
) accepts at least one string which containts exactly 4
b
’s (you can assume that
you have procedures that can convert PDAs into CFGs and CFGs into PDAs).
This problem was dropped from HW5. A solution will be given in the HW6 sols.
Problem 2. (a)
Prove that context free languages are closed under the operation
*
(Kleene closure).
If
G
= (
V,
Σ
, R, S
) is a context free grammar then the grammar
G
= (
V,
Σ
, R , S
)
where
R
=
R
∪ {
S
→
SS
} ∪ {
S
→
}
derives the language (
L
(
G
))
*
. That this is
true is almost obvious by the definition of
*
since the rule
S
→
SS
generates any
number of repetitions of strings from
L
(
G
). The empty string is accounted for with
the second added rule.
(b)
Assume that you know that
L
=
{
a
n
b
n
c
n

n
≥
0
}
is not context free. Prove that
context free languages are not closed under intersection.
The languages
L
1
=
{
a
i
b
i
c
j

i, j
≥
0
}
and
L
2
=
{
a
j
b
i
c
i

i, j
≥
0
}
are both context free
because we can generate them, respectively, with the following grammars:
G
1
:
S
→
BC
B
→
aBb

C
→
cC

.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 Filkov
 Formal language, Contextfree grammar, CFL, context free languages, L1 L2, language L1 L2

Click to edit the document details