0

Assuming $L$ is defined as follows:

$$ L = \{ 0^n1^{n^2} | n \ge 0 \} $$

I'm trying to either prove/disprove whether $L$ is CFL or not.

My intuition tells me its not CFL since I cannot express the power $n^2$ by itself using CFL, but I'm having trouble proving so using the pumping lemma. Also, I failed to create any such PDA (which my intuition says its impossible).

Taylor
  • 11
  • 2

1 Answers1

1

Let $h\colon \{0,1\} \to \{0\}$ be the homomorphism given by $h(0) = \epsilon$ and $h(1) = 0$. If $L$ were context-free, so would $h(L) = \{ 0^{n^2} : n \geq 0 \}$ be. Since $h(L)$ is a unary language, it would be regular. However, a unary language is regular iff it is eventually periodic, which it isn't. Therefore $L$ cannot have been context-free.

More generally, if $L$ is context-free then:

  1. The set of lengths of words in $L$ is eventually periodic.
  2. The set of number of occurrences of a symbol in $L$ is eventually periodic.

The most general statement of this kind is Parikh's theorem.

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