Homework 6

CS 3810 – Summer 2008

  1. Write a context-free grammar for each set below. (14 points)

    1. {vvRwwR | v∈{a,b}*, w∈{a,b}*} [wR indicates w-reversed]

    2. { ambm+ncn | m,n ≥ 0 }

    3. {ambn | 2m = n or m = 2n }

    4. 01{0n10n+11}*

    5. { akblambn | k = m or l = n }

    6. The set of all strings of a's and b's not of the form ww. [Hint: For even-length strings, there have to be two characters that disagree; think about what the rest of the string looks like.]

    7. The set of all strings not in { anbncn | n≥1 }.

  2. Exercise 5.1.4 [Right-linear CFG = regular] (4 points)