The regular languages are known to be closed under the operation "left half": $$ \operatorname{left}(L) = \{ x \in \Sigma^* : xy \in L \text{ for some } y \in \Sigma^* \text{ s.t. } |x|=|y| \} $$ What about the context-free languages?
Asked
Active
Viewed 456 times
1
-
1Does this answer your question? If L is context-free, must FH(L) be context-free? Well, OK, took me quite some time to actually find that question. – Hendrik Jan Apr 29 '21 at 18:25
1 Answers
1
Let $L = \{a^nb^na^mbba^{3m} : n,m \geq 1 \}$, which is clearly context-free. Then $$ \operatorname{half}(L) \cap a^+b^+a^+b = \{ a^nb^na^nb : n \geq 1\}, $$ which is not context-free. Hence $\operatorname{half}(L)$ is not context-free.
(If $L$ is a unary context-free language then $L$ is regular, and so $\operatorname{half}(L)$ is regular.)

Yuval Filmus
- 276,994
- 27
- 311
- 503