a).
Consider the languagewhere,
and
Are the two languages.
If we consider a string of.
Its proper prefixes are strings containing only a's and b's and all strings in
and contain at least .
Hence every string inis in NOPREFIX(L).
If we consider a string in,it is not in NOPREFIX(L) if, there is a proper prefix of it which is in, since no proper prefix of it is in
(the number of bs will not be equal to the number of cs in any proper
prefix), the proper prefix will have to come fromand hence the.
So, the strings in which are in NOPREFIX () are.
Therefore,
NOPREFIX( ) =role="math" localid="1659711270607" .
However, NOPREFIX () is not context-free.
Otherwise NOPREFIX () = { is context-free which is a contradiction.
The unambiguous CFGs context free grammar is a context free grammar by which only one parse tree or only one derivation tree is possible.
Therefore, there exists a context-free languagesuch that NOPREFIX ( ) is not context-free, hence context- free languages are not closed under NOPREFIX operation.
Therefore NOPREFIX() = .
Hence, it is proved that the class of CFLs is not closed under NOPREFIX.