Theory of Computation 5. Assignment by yaoyufang


									                              Theory of Computation                                              Problem 4      (Closure properties) [6 points]

                                       5. Assignment                                                Suppose L is context-free and R is regular. Are the following languages necessarily context-
                                                                                                    free? If yes, prove it; if not, give a counter-example.
                                         Due April 8
                                                                                                   (a) L ∩ R
                                                                                                   (b) L − R
Rudolf Fleischer                                                                                   (c) R − L

Spring 2011
                                                                                                 Problem 5      (Pumping Lemma) [2 points]

                                                                                                    Show that L = {an bm an | n < m} is not context-free.
Problem 1       (PDA) [6 points]

   If the stack is empty when the input word has been completely read we say the PDA accepts     Problem 6      (Self-embedding variables) [4 points]
   by empty stack (i.e., we do not distinguish between accepting and non-accepting states).
   Consider the following PDA. It has three states, the initial state s and states f and g. It      Let G = (Σ, V, R, S) be a CFG. A variable A of G is called self-embedding if and only if
   has the following transitions:                                                                   A ⇒+ uAv for some u, v ∈ (Σ ∪ V )∗ .

   (1) ((s, a, ), (s, a))                                                                          (a) Give an algorithm to test whether a specific variable A is self-embedding.
   (2) ((s, b, ), (s, b))                                                                          (b) Show that if G has no self-embedding variable, then L(G) is regular.
   (3) ((s, , ), (f, ))
   (4) ((f, a, a), (f, ))                                                                        Challenge Problem E        (A game)    [1 bonus point]
   (5) ((f, b, b), (f, ))
                                                                                                    Consider the following game played on words over a finite alphabet Σ. If a word w is of
   (6) ((f, , ), (g, ))                                                                             the form w = uck v, where c ∈ Σ, k ≥ 2, u, v ∈ Σ , u does not end with c, and v does not
                                                                                                    start with c, then we can contract w to w = uv. In other words, we can remove a maximal
   (a) [2 points]
                                                                                                    subsequence of equal letters (of length at least two) from w. A word is solvable if and only
       Trace the PDA on the following strings. Does it accept the input by empty stack?             if there is a sequence of contractions leading to the empty string.
        1. abba                                                                                     Show that a word w is solvable if and only if w is generated by the context-free grammar
        2. abb
   (b) Which language is accepted by the PDA?                                                                                      S → | SS | aSa | aSaSa ,

                                                                                                    for all a ∈ Σ.
Problem 2       (PDA II) [4 points]

   (a) Construct a PDA accepting by empty stack the language generated by the CFG

                                       S → aS, S → aSb, S →
   (b) Which language is generated by this CFG?

Problem 3       (PDA III) [2 points]

   Construct a PDA that accepts the language {an bm | n ≤ 2m} by empty stack.

                                              1                                                                                                2

To top