[UMN logo]

CSci 4011: Formal Languages and Automata Theory
Fall 2008, University of Minnesota
Homework 3


Posted: Sept 30, 2008
Due: Oct 16, 2008

Reminder: Assignments are due in class before the start of class on the day indicated.


Problem 1

Provide context-free grammars for each of the languages below:
  1. { w ∈ {a,b}* | w has twice as many bs as as}.

  2. Balanced parentheses and square brackets. Thus, ()(), [][] and (([])[()]) would be legal expressions of this language but ([)] and [(()] would not.

  3. Balanced parentheses and brackets where a closing bracket also closes any outstanding open parentheses up to the previous open bracket. Thus [(()] is a legal expression in this language but ([(()] is not. As a hint, think of modifying the grammar in part (1) to allow expressions that have extra left parentheses at the outermost level to be generated and then allow such expressions to appear within brackets.

  4. The language in Exercise 2.6, part d, in the book.


Problem 2

Consider the grammar given by the rules
   S --> a S b | b Y | Y a
   Y --> b Y | a Y | ε
This is the grammar given to you in Problem 2.19 in the book. Prove that
L(G) = { w ∈ {a,b}* | w is not of the form anbn for n ≥ 0 }.


Problem 3

Describe pushdown automata for recognizing the languages in Problem 1 subparts (1) and (4). Your description of these PDAs should be precise but you may use the graphical state diagram notation discussed in the book and the class to present their transition functions.


Problem 4

Do Exercise 2.11 from the book. For this problem you should assume that you can write at most single letters on the stack in any one move, i.e., you must not use the shorthand discussed in the proof of Lemma 2.21 that allows strings to be written onto the stack.


Problem 5

Do Exercise 2.14 from the book.


Problem 6

Do Exercise 2.16 from the book.


Problem 7

Do Exercise 2.2 from the book.


Problem 8

Suppose that language L is context-free and that R is regular. Show then that
  1. L - R must be context free; assume Problem 2.18 part a, from the book when doing this part.

  2. R - L may not be context-free. When I thought about this part, I found Problem 7 above useful.


Problem 9

Use the pumping lemma to show that the following languages are not context free:
  1. The language that consists of the set of all palindromes over {0,1} that contain an equal number of 0s and 1s. In case you have not encountered this word before, a palindrome is a string that is the same whether read backwards or forwards.

  2. {ai bj ck | (i = k and j ≥ i) or (j = k and i ≥ j)}

  3. The language described in Problem 2.30, part d, in the book.


Problem 10

Do Problem 2.44 from the book. Hint: Think of constructing a PDA for A &loz B from the DFAs that are known to exist for A and B.


Last updated on September 30, 2008 by gopalan atsign cs dot umn dot edu.