How to prove that there is no algorithm to create context free grammar by the description

87 Views Asked by At

I have following information:

Alphabet $\Sigma$ , where $\Sigma \cap \{T,U\} = \emptyset $
and language $L = L(G) $ over $\Sigma$ generated by context free grammar $G$.

Then I consider another language $L'$ that is defined as follows

$L' = \{w.a | w \in \Sigma^* \land (w \in L \iff a = T) \land (w \notin L \iff a = U) \}$

Based on this information I have to conclude whether there is an algorithm that can create context free grammar $G'$ so that $L(G') = L'$. If there is no such algorithm I should prove it.

I concluded that there is not such algorithm, since I know that context free languages are not closed against complement, therefore the complement of language can be even context-sensitive language.

If I am right, how do I now write down a proof of it? And I am not right, where did I make a mistake?

1

There are 1 best solutions below

0
On

You're right. Pick a specific context free language L whose complement isn't context free. For example, L could be {x : x≠ww for any w}.

We can prove by contradiction that L' is not context free. If L' is context free, then its intersection with any regular language is also context free. So L' intersected with Σ*U is context free. But intersecting with this language produces, basically, the set of all strings in the complement of L. But we already know (or we can prove) that the complement of L is not context free. This completes the proof.