| CS150 | October 30, 2001 |
| Youssef |
Problem 1: (20 points)
Construct a PDA for each of the following languages:
a) L={a 3n b n | n > 0}. Construct the PDA
without going through grammars.
b) L={a n b n+m a m | n > 0, m> 1}.
Again, do not go through grammars.
c) The languages in Problem 2 in Homework 3.
For these
languages, use the GNF grammars (developed in
Problem 5 of Homework 3)
to construct the PDA's using the standard method.
Problem 2: (24 points)
Show that the following languages are not CFL's.
a) L={a n 3 | n > 0}
b) L={a p | p is a prime number}.
c) L={a n b m c m | m>n}.
d) L={a n! | n> 0}.
e) L={a n b n 2 | n > 0}.
f) L={a n b m c n 2 +m 2 | n > 0, m > 0}.
Problem 3: (16 points)
Using the closure properties of CFL's, show that the following languages
are CFL's:
a) L={a n b n | n > 0 and n is not a multiple of 3}
b) L={a i b j | i < j or i=j+2}
c) L={a i b j c k | i < j or j < k}
d) L= the complement of {a n b n | n > 0}.
Problem 4: (20 points)
Design Turing machines to recognize the following languages.
Your design (in this Problem and in Problem 5)
should start with a clear algorithmic description and end with a
formal definition of the delta function (with enough comments).
a) {a 2n b n | n > 0}.
b) {a n b m c n+m | n>0, m>0}.
Problem 5: (20 points)
a) Build a TM that takes as input 0n
and gives output 0 2n.
b) Build a TM that takes as input 0n10m
and gives output 0 max(n,m) .