Quiz 12

Nils Anders Danielsson

  1. (1p) Let the context-free grammar G be ({S}, {0, 1}, (S → 0 | 1S1), S). Which of the following languages, if any, do we get if we substitute the language {0, 1} for a, and the language L(G) for b, in the language {bub | u ∈ {a}*}?

    1. {1n01nw1n01n | n ∈ , w ∈ {0, 1}}

    2. {1m01mw1n01n | mn ∈ , w ∈ {0, 1}}

    3. {1n01nw1n01n | n ∈ , w ∈ {0, 1}*}

    4. {1m01mw1n01n | mn ∈ , w ∈ {0, 1}*}

  2. (2p) Which of the following languages, if any, are context-free?

    1. {uuvv | u ∈ {0}+, v ∈ {1}+} ∪ {uvvu | u ∈ {0}+, v ∈ {1}+}

    2. {uuvv | u ∈ {0}+, v ∈ {1}+} ∩ {uvvu | u ∈ {0}+, v ∈ {1}+}

    3. {ssttuvvu | s, u ∈ {0}+, t, v ∈ {1}+}

    4. {uuvvuvvu | u ∈ {0}+, v ∈ {1}+}

    5. {(uvvu)n | u ∈ {0}+, v ∈ {1}+, n ∈ }

    6. {(ab)mc2n(ab)m | mn ∈ }

    7. {uvu | u ∈ {0, 1}*, v ∈ {2, 3}*}

  3. (1p) Construct the CYK table for the context-free grammar ({SA}, {0, 1}, (S → 0 | SA | AA, A → 1 | AS), S), which is in Chomsky normal form, and the string 01101. How many occurrences of the nonterminal A are there in the CYK table?

  4. (1p) Construct the CYK table for the context-free grammar ({SA}, {0}, (S → SS | AA, A → 0), S), which is in Chomsky normal form, and the string 00000. How many occurrences of the nonterminal S are there in the CYK table?