# Proof that language is not context-free with Parikh's theorem

I want to prove that the language $L = \{ a^{n}(ab)^{{n}^{2}}b^{n} \mid n \geq 0 \}$ is not context-free by using Parikh's theorem.

My first assumption is that the $(ab)^{{n}^{2}}$ part cannot be written as a subset of linear vectors. From this it follows that $\psi(L)$ is not semi-linear.

My problem is to show that by a formal proof.

• Welcome to Computer Science! What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for tips on asking questions about exercise problems. If you are uncertain how to improve your question, why not ask around in Computer Science Chat?
– Raphael
Jan 14, 2017 at 16:03

If $L$ were context-free then, applying the homomorphism mapping both letters to $a$, also the following language would be context-free: $$L' = \{ a^{2n^2+2n} : n \geq 0 \}.$$ According to Parikh's theorem, a unary language is context-free iff the corresponding subset of $\mathbb{N}$ is eventually periodic. Yet the sequence $2n^2+2n$ has arbitrarily long gaps, since $2(n+1)^2+2(n+1)-2n^2-2n = 4n+4$. Therefore the set $\{2n^2+2n : n \geq 0\}$ is not eventually periodic, and so $L'$ is not regular or context-free.
• A subset $S$ of $\mathbb{N}$ is eventually periodic if there exist $n_0,p \geq 1$ such that for all $n \geq n_0$, we have $n \in S$ iff $n+p \in S$. The subset corresponding to a unary language has to be eventually periodic due to Parikh's theorem. Jan 14, 2017 at 17:38