For a language $A$ which is a subset $Sigma^*$, define the language $A_+$ as $qquaddisplaystyle A_+ = {xyz | yin Sigma wedge xz in A}$. Prove that the set of context-free languages is closed under the $+$ operator.
So $A_+$ contains all strings that can be obtained by inserting one symbol into a string in $A$. Show that the class of context-free languages is closed under the operation $+$ (i.e., show that if $A$ is context free, then $A_+$ is also context free). Note that this is not a homework question. Examples of closure proofs are sparse online and in my textbook. First, let’s think about the different ways to prove closure of CFLs:
- Constructing a “template” Push Down Automata that can incorporate any other Push Down Automata and add on a part to the beginning, middle, or end of the PDA and still be able to accept the language accepted by the original CFL, with the new operation on it. Basically, if for any given PDA P, if a PDA P’ can be created which accepts the language of P with the new operation (in our case, the “+” operator) performed on it, then that operation must be under closure. Solving the problem in this manner is quite simple to think about. Imagine a PDA P which accepts strings from the CFL L. In application to our problem, this would be a PDA which can successfully read in the string ‘xz’, where x and z are simply any string conforming to our alphabet. The PDA P’ would similarly have the ability to read xz, but each state of the PDA could have an additional self loop which reads the character in the string y.
I have selected the answer which I find to be most appropriate for this question. It simply involves using the “tempate PDA” strategy which I outline above; however, my construction did not achieve the goals of the new language (think about why before looking at the answer below).
Asked By : Musicode
Answered By : Yuval Filmus
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/22834