16

It is a standard proof in automata courses that for $L = \Sigma^\star$ and $|\Sigma| \ge 2$ that $S(L) = \{ww : w \in L\}$ is not a context-free language.

It is also true that for any finite $L$, $S(L)$ is finite (and therefore a CFL). I'm guessing that $L$ being infinite and regular are not "sufficient" for $S(L)$ being not a CFL. Edit: what about non-CFL $L$?

Is there any characterization of what $L$ have $S(L)$ not being a CFL?

Ryan Dougherty
  • 555
  • 3
  • 19
  • If I understand correctly, the question is to decide, given a regular language $L$, whether $S(L)$ is context-free or not. – J.-E. Pin Oct 30 '16 at 08:55
  • 2
  • Can you tell us more about what kind of characterization you're looking for? Are you looking for an algorithm that, given $L$, decides whether $S(L)$ is context-free? Are you looking for some conditions on $L$ that suffice to ensure $S(L)$ will be context-free? What form would you like a characterization to take? 2. If you don't get any answers after a few days and would prefer to see this on CSTheory.SE, feel free to flag it for moderator attention and ask to have it migrated.
  • – D.W. Oct 30 '16 at 12:58
  • @D.W. 1. Either would be fine, but I would prefer sufficient conditions. 2. Thanks for the tip! – Ryan Dougherty Oct 30 '16 at 15:48
  • 1
    @Ryan just sufficient conditions? Well, here are a couple: (a) L is regular and for every $w$ in $L$, $w = w^R$ (b) L is CF and for all $n$, $L \cap \Sigma^{n}$ is either empty or equal to $\Sigma^{n}$. These are definitely not necessary though. If you do not get answers here, please do move the question to cstheory. I am really curious about necessary and sufficient conditions! – aelguindy Oct 30 '16 at 17:30
  • Infinite and regular $L$ is indeed not sufficient for $S(L)$ not CF. If $\Sigma = {a,b,c},L = a^$ then $S(L) = (aa)^$ which is regular, hence CF. – chi Nov 09 '16 at 14:13
  • Another idea (conjecture) is the following: assuming $\Sigma = {0,1}$, it's enough that the Parick image of the (regular) $L$ contains at least one linear set of the form ${(|w|_0,|w|_1)}={(a_1+b_1 n,a_2+b_2 n),n\in \mathbb{N}}$ and both $b_1,b_2 \neq 0$ where $|w|_0$ (resp. $|w|_1$) is the number of $0$s (resp. $1$s) of $w$. (for larger $\Sigma$ the condition becomes $\exists i \neq j, b_i, b_j \neq 0$)... I'll try to formalize/prove (or fix/delete) it in the next days (monday :-). – Marzio De Biasi Nov 09 '16 at 22:37
  • another conjecture : if $L$ is not regular then $S(L)$ is not a CFL. – Denis Nov 10 '16 at 14:35
  • @Denis I figured that too -- do you have a conjecture as to when the "transition" to being NCFL happens? (Starts off regular/finite with finite $L$, and some infinite $L$ surely have $S(L)$ a CFL, but there has to be a "transition" somewhere...) – Ryan Dougherty Nov 10 '16 at 16:16
  • @Ryan: yes, see my answer, the full conjecture would be: $S(L)$ is not CFL if $L$ is not regular of if there are $x,u,y,v,z$ such that $u,v$ non empty, $x,u,v,z$ are not power of a same word, and $xu^yv^z\subseteq L$. – Denis Nov 13 '16 at 04:10