Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am trying to use the Pumping Lemma to prove that the following language is not context free:

$$\{0^n\mid \text{$n$ is prime}\}$$

I am having a really difficult time with Pumping Lemma. Up until now I was proving that a language is not regular using the Pumping lemma, but I am not sure how to begin to use the pumping lemma to prove that a language is not Contex-Free.

I appreciate any suggestions,

Many thanks in advance!

share|cite|improve this question

marked as duplicate by arjafi, Davide Giraudo, Amzoti, rschwieb, Brian M. Scott Mar 13 '13 at 15:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Let $s = uvxyz$, then $|s| = |uvxyz| = |u|+|v|+|x|+|y|+|z|$ Now for any $n$ we have: $|uv^nxy^nz| = |u|+n*|v| + |x| + n*|y| + |z| = |u|+ |x|+|z| + n*(|v|+|y|)$

Setting $n = |u|+|x|+|z|$ gives us $$|u|+ |x|+|z| + (|u|+|x|+|z|)\cdot(|v|+|y|) = (|u|+|x|+|z|)\cdot(|v|+|y|+1)$$.

Now if we pick $s$ such that |s| is a prime number strictly larger than the pumping length, and such that $|uz| \geq 2$, we get that $|u|+|x|+|z| \geq 2$. furthermore, $|vy| \geq 1$ and thus $|v|+|y|+1 \geq 2$, which implies that $|uv^nxy^nz|$ is composite, and thus not prime.

share|cite|improve this answer

With this sort of language pumping lemma for context free languages is no different from pumping lemma for regular languages. Simply take any bit of $0^n$ and repeat it $n+1$ times to make the resulting string of length divisible by $n$.

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.