CS4311: Introduction to Computation Theory hw4
CS 4311 Introduction to Computation Theory
Homework 5: Chapters 1,2
Due: Wednesday, 10/11/06, beginning of class
(Assigned: Wednesday, 10/4/06)
You are required to turn in answers to all the questions. However, only a random
subset of the questions will be graded.
While discussion with others is permitted and encouraged, the final work
should be done individually. You are not allowed
to work in groups.
The answers, comments, and programs (if any) must be the original
work of the author.
You are allowed to build on material supplied in the class. If you use
any other source than the current class notes and the textbook, specify it
clearly.
1. Use the pumping lemma to show that the following languages
are not regular:
a. { bn an+3 | n ≥ 0}
b. { a2 n | n ≥ 0}
2. For each of the following languages, determine if the
language is regular and prove your answer:
a. { w | w has an odd number of a's}
b. { w | w has an odd number of a's and even number of b's}
c. { w | w has two more a's than b's}
3. Consider the grammar G below.
E -> E + E | E * E | ( E ) | T
T -> a | b
Give two different parse trees and derivations for the string a * b
+ a. How many parse trees are there for a * ( b + a )?
Is G ambiguous? Why?
4. (parts of Problem 2.4) Give CFGs that generate the
following languages. In all parts the alphabet Σ is
{0,1}.
a. { w | w contains at least three 1s}.
b. { w | w contains at most three 1s}.
c. { w | w starts and ends with the same symbol}.