Paper 3, Section I, 4F4 F

Automata and Formal Languages
Part II, 2016

(a) Define what it means for a context-free grammar (CFG) to be in Chomsky normal form (CNF). Can a CFG in CNF ever define a language containing ϵ\epsilon ? If GChom G_{\text {Chom }} denotes the result of converting an arbitrary CFG GG into one in CNF, state the relationship between L(G)\mathcal{L}(G) and L(GChom )\mathcal{L}\left(G_{\text {Chom }}\right).

(b) Let GG be a CFG in CNF, and let wL(G)w \in \mathcal{L}(G) be a word of length w=n>0|w|=n>0. Show that every derivation of ww in GG requires precisely 2n12 n-1 steps. Using this, give an algorithm that, on input of any word vv on the terminals of GG, decides if vL(G)v \in \mathcal{L}(G) or not.

(c) Convert the following CFG GG into a grammar in CNF:

SaSbSSϵS \rightarrow a S b|S S| \epsilon

Does L(G)=L(GChom )\mathcal{L}(G)=\mathcal{L}\left(G_{\text {Chom }}\right) in this case? Justify your answer.