CS381
Second Mid Term
Friday, Nov. 4, 2005
Fall 2005
Olin 155
9:059:55 am
1.
Is the language
{ }
1
,
1
jj
ii
La
b
c
d
i
j
=≥
≥
a contextfree
language?
If yes give a Chomsky normal form contextfree
grammar for it.
If not use the pumping lemma to prove that it is
not a contextfree language.
No it is not a contextfree language.
Assume it is.
Let n be the
integer of the pumping lemma.
Select
nnn n
z abcd
=
. Write
z=uvwxy with
vwx
n
≤
.
Then vx cannot contain both a’s and c’s
nor can it contain both b’s and d’s. Thus
22
uv wx y
has an unequal
number of a’s and c’s or an unequal number of b’s and d’s and is
not in L, a contradiction.
Therefore L is not a contextfree
language.
2.
What is the specific class of languages defined by grammars in
which each production is of one of the following forms:
A variable goes to epsilon
A
ε
→
A variable goes to a terminal
A
a
→
A variable goes to a string consisting of two terminals
A
ab
→
A variable goes to a string consisting of a terminal followed by
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 '05
 HOPCROFT
 Formal language, Formal languages, Contextfree grammar, contextfree language

Click to edit the document details