Similar questions 2 more →
Context-Free Grammars & Languages

Answer & solution
Official answer: C
Approach: Give a constructive grammar for L2 and a pumping-lemma contradiction for L1.
L2 is generated by S→aSc | aTc and T→bTc | bc. Each use of S adds one a and one trailing c, with at least one a forced before moving to T. Each T production similarly pairs a b with a c and forces at least one b. The derived words are exactly am bn cm+n, so L2 is context-free.
Suppose L1 were context-free with pumping length p. Choose w=ap bp cp+1, which is in L1 with m=p,n=1. In a pumping decomposition w=uvxyz, |vxy|≤p and |vy|>0. The window cannot touch both the a and c blocks, because it would have to span all p b’s between them.
Let Δa,Δb,Δc count those symbols in the pumped parts v and y. If pumping disrupts block order, it already leaves L1. Otherwise, if Δa≠Δb, pumping down or up breaks equality of a and b counts. If Δa=Δb>0, then Δc=0; pumping up makes the common count at least p+1 while c remains p+1, violating the strict requirement c>m. Finally if Δa=Δb=0, then Δc>0; pumping down leaves at most p c’s while a=b=p, again violating c>m.
All possibilities fail. Thus L1 is not context-free, giving C. The unrestricted extra c’s in L1 do not eliminate the need to enforce both equality and a strict count comparison.