Theory of Computation Quiz
Theory of Computation Quiz
1. (a) Let L be a CFL generated by a CFG G. That is L = L(G), G = (V, Σ, P, S). A student gives
the following simple proof that CFLs are closed under the star operation. That is if L is a CFL
then L? is also a CFL.
Proof. Add the rule S → SS to P to yield P 0 = P ∪ {S → SS} then the grammar G0 =
(V, Σ, P 0 , S) generates the language L? . G0 is clearly a CFG so CFLs are closed under the star
operation.
Is the above proof correct? If yes explain why and if not say why not and correct it (don’t give
a totally different proof).
(b) Let L be any language. Define the language suffix(L) = {v | uv ∈ L, for some u}. So, the suffix
of L contains all strings that are suffixes of any string in L. Argue that if L is a CFL suffix(L) is
also a CFL.
[3,7=10]
2. Show that the language L = {c0m 1n | m 6= n, m, n ≥ 0} ∪ {d0m 12m | m ≥ 0} is a DCFL. What happens
if c and d are not there?
[8,2=10]
3. Consider the grammar G with productions: S → 0S1 | SS | ε, where Σ = {0, 1} and S is the
start symbol.
(a) Describe the language L(G) informally (i.e. in English) and formally (i.e. as a set of strings
following certain constraints).
(b) Is G a DCFG? If yes justify. If not say why not.
[4,6=10]
4. Let L be a language over alphabet Σ. The homomorphism operation h maps symbols in Σ to strings
over Σh including ε. h can be extended to strings as follows: h(w = σ1 . . . σk ) = h(σ1 ) . . . h(σk ) and
then to languages by: h(L) = {h(w) | w ∈ L}.
(a) Argue that CFLs are closed under the homomorphism operation.
(b) Argue that DCFLs are not closed under homomorphism.
[4,6=10]