# Prove or disprove: L^2 context free implies L is context free

Clearly we have to disprove this. But I am finding it hard to prove it. I was trying in following way: Considering any non context free language L. I was trying to prove that L^2 is context free which will contradict given statement. But I don't know to how to prove it. Because by pumping lemma we can show only that language is not CFL but converse is not true. Can you please help me. Or is there any other way to prove it. Thanks

• Take $L$ such that $L^2=\Sigma^*$. Does it mean $L$ must be CFL? Can you design such an $L$ that would be, say, undecidable? Nov 30 '14 at 19:49
• @RanG. You should expand this into a (hinted) answer. Nov 30 '14 at 20:54
• possible duplicate of Is $A$ regular if $A^{2}$ is regular? Nov 30 '14 at 21:25
• @Shaull. Especially if one notes that a CFL over a 1-symbol alphabet is regular. Nov 30 '14 at 21:29
• If you need some heavy theory to show one question is a duplicate of another, it probably is a duplicate in the technical sense but not for out intended audience. Nov 30 '14 at 21:43

Ran's hint, with a bit of work, can indeed be used to show that the concatenation of an undecidable language with itself can be decidable. Here's a cute, simple, "almost-proof" of the fact that the concatenation of a non-CFL with itself can be a CFL:

1. The language $L=\{0^p\mid p \text{ is an odd prime}\}$ is not a CFL. This is a standard result, shown in some (but not all) theory texts.
2. Goldbach's conjecture: Any even number greater than 4 is the sum of two odd primes. This is unproven, but has been shown to be true for all even numbers less than $4\times 10^{18}$ and is regarded by many number theorists as likely true in general.

So, if Goldbach's conjecture is true, then $L^2=\{0^{2n}\mid n\ge 3\}$ which is clearly a CFL (being regular), even though $L$ isn't. Bada-bing.

• Thanks. I was thinking about same way with prime numbers. But was not able to prove that L^2 is CFL. Anyways, I Goldbach's conjecture makes sense. Thank you for clearing this. Nov 30 '14 at 22:14
• Given that this is straightforward to prove unconditionally, I don't see why you'd want to prove it conditional on Goldbach. Dec 1 '14 at 0:01
• @DavidRicherby. No excuse except that it's cute. Dec 1 '14 at 1:38

Hint. Let $U\subseteq\mathbb{N}$ be any undecidable set and let $I = \{2u+1\mid u\in U\} \cup \{0, 2, 4, \dots\}$. Let $L = \{a^i\mid i\in I\}$. Now prove that $L^2$ is context-free but $L$ is not.