CMPS 260 Spring 2019
Homework #6: Pumping Lemma, CFG's, and PDA's
Due: 3pm, May 1

1. Prove that the language L = { bjanbn : j,n > 0} is not regular. (Suggestion: Use the Pumping Lemma.)

2. Prove that the language L = { ajbkcn : j=k or k≠n } is not regular. (Suggestion: Use the Pumping Lemma.)

3. Prove that the language L = { w ∈ {a,b}*  :  |w| is not a perfect square } is not regular. (Suggestion: Use closure properties of regular languages together with the result of Linz's Example 4.11.)

4. For each of these statements, either prove it or disprove it.
(a) If both L1 and L2 are non-regular languages, then L1 ∩ L2 is also non-regular.
(b) If both L1 and L2 are non-regular languages, then L1 ∪ L2 is also non-regular.

5. In Example 5.3, Linz shows a CFG that generates the language { anbm : n ≠ m }. His grammar is not linear, however, as the right-hand sides of two of S's productions include multiple occurrences of variables/nonterminals. Devise a linear CFG that generates the same language. (A linear CFG is one in which there is at most one occurrence of a variable/nonterminal in each production's right-hand side.)

6. Devise a context-free grammar that generates the language { am+pbcm+nden+p : m,n,p ≥ 0 }.

7. Eliminate useless symbols from the following context-free grammar (having start symbol S).

SaSa | bB | bAA
Aa | SbA | aB
BAB | CaB
CcC | Sa | bD
DdD | λ

8. Present a Chomsky Normal Form grammar that is equivalent to this one:

SaS | Sb | aAbA
AASbA | ab

For purposes of uniformity, please name your newly-introduced variables/nonterminals Vα, where the intent is for such a variable to generate the string α. For example, a variable named VaSbA would be intended to satisfy VaSbA+ aSbA.

9. Consider the following Chomsky Normal Form grammar G:

SAB | b | c
ABB | AS | a
BBA | b

Use the CYK algorithm to determine whether or not w = bbacb is a member of L(G). Specifically, fill in the relevant cells of the matrix pictured below so that the cell in row i and column j contains Vi,j = { X ∈ {S,A,B} : X ⟹+ wi,j }, where wi,j is the substring of w beginning at its i-th symbol and ending with its j-th symbol. (Your answer is expected to include not only the answer to the question "Is bbacb ∈ L(G)?" but also the correctly filled in table.)

Recall that, for i satisfying 1≤i≤|w|, X ∈ Vi,i iff X → wi,i is a production. Meanwhile, for i and j satisfying 1≤i<j≤|w|, X ∈ Vi,j iff there exists k satisfying i≤k<j such that X → YZ is a production for some Y ∈ Vi,k and Z ∈ Vk+1,j.

     1      2      3      4      5
  +------+------+------+------+------+
  |      |      |      |      |      |
  |      |      |      |      |      |
1 |      |      |      |      |      |
  |      |      |      |      |      |
  +------+------+------+------+------+
         |      |      |      |      |
         |      |      |      |      |
       2 |      |      |      |      |
         |      |      |      |      |
         +------+------+------+------+
                |      |      |      |
                |      |      |      |
              3 |      |      |      |
                |      |      |      |
                +------+------+------+
                       |      |      |
                       |      |      |
                     4 |      |      |
                       |      |      |
                       +------+------+
                              |      |
                              |      |
                            5 |      |
                              |      |
                              +------+

10. Present (in transition graph form) a PDA that accepts the language

{ w ∈ {a,b}*  :  w is a palindrome }

Note that this language includes not only palindromes of even length but also those of odd length.

11. Present (in transition graph form) a PDA that accepts the language

{ w ∈ {a,b}*  :  na(w) = 2·nb(w) }