[15 points] Prove, or disprove by giving a counter-example, each of the following statements.
[5 points] "For arbitrary languages L1, L2, and L3 over an alphabet S, (L1 ÇL2) L3 = (L1 L3) Ç(L2 L3)."
[5 points] "If L* is a regular language, then L is a regular language."
[5 points] (Note: For a context-free grammar G = (V, S, P, S), a variable A Î V is called terminating if A Þ* w for some w Î S*.)
"For a context-free grammar G = (V, S, P, S), if A and B are two variables of V with A Þ* a1 B b1 and
B Þ* a2 A b2 for some a1, b1, a2, b2 Î V*, then A is terminating if and only if B is terminating."
[20 points] Consider the following language:
K = { x $ y | xandyarein {a,b}*,andyisnotapermutationofx }.
Example strings in K are a a a b $, a $ a a a b and b a b a $ a a a b; example strings not in K are a b b a, a b b b a $ a b b b a, and a b b b a $ b a b a b.
[10 points] Prove that the language K is not regular.
[10 points] Construct a context-free grammar that generates the language K. Briefly and precisely describe the strings generated by each variable in the grammar.
[20 points] For each of the following languages, either:
prove that the language is context-free by a direct construction of pushdown automaton accepting it (no conversion from context-free grammar; give brief and precise interpretations of the states and transitions in the machine), or
prove that the language is not context-free by using the pumping lemma.
[10 points] { ai bj ck | i, j, k ³ 1, and j £ max{ i, k } }.
[10 points] { ai bj ck | i, j, k ³ 1, and j ³ max{ i, k } }.
[15 points] Consider the following language:
L = { x Î {a, b}* | #a (x) = #b (x) }.
(Note: #u (v) denotes the number of occurrences of a substring u in a string v.)
Give the formal 7-tuple definition of a deterministic Turing machine that accepts/decides the language L. Briefly and precisely comment on the states and transitions in the machine. You may assume that an input string is left-delimited with $.
File translated from
TEX
by
TTH,
version 3.35. On 10 Feb 2009, 13:39.