Does the following transformation preserve context-freeness?

70 Views Asked by At

I encountered this problem involving manipulating a context-free language. Let $L$ be a context-free language. Define $L^{\#} = \{ x : x^i \in L$ for every $i=0,1,2,...\}$. Is $L^{\#}$ always context-free?
My guess is that it will preserve context-freeness. Can anyone provide an elementary proof of this?

1

There are 1 best solutions below

4
On

Take $\Sigma$ = {$a,b,c$} and $L=${$a^nb^nc(a^*b^*c)^*:n\geq0$}.

Now, L is clearly context-free since its a concatenation between a context free language and a regular language.

However, $L$#={$(a^nb^nc(a^*b^*c)^*)^k:n\geq0,k\geq0$}, which can be shown, using the pumping lemma, not to be context free.

So, the claim is false.

I hope my reasoning is correct.