# 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? – Ran G. Nov 30 '14 at 19:49
• @RanG. You should expand this into a (hinted) answer. – Rick Decker Nov 30 '14 at 20:54
• possible duplicate of Is $A$ regular if $A^{2}$ is regular? – Shaull Nov 30 '14 at 21:25
• @Shaull. Especially if one notes that a CFL over a 1-symbol alphabet is regular. – Rick Decker 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. – Hendrik Jan Nov 30 '14 at 21:43

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.
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.