6

Question:

L is a language defined as $\ L = \{1^l | l\in primes\}$ (strings of 1s having a prime length). Show that this is not a regular language ($\ L \notin REG$). You may either use the theory of closure or the pumping lemma to prove this.

My try:

So far I have tried to take a word $\ w | w=1^p$ ($\ p$ being the pumping value), but in this case I don't know how to prove that every decomposition of the form $\ w=xy^i z$ is invalid. When $\ |y|=p$ (and therefore $\ x=z= \epsilon $) the lemma is clearly untrue, because when $\ i = 2$, $\ |w'| = 2p$ which is not prime. But in the case that $\ y<p$, and $\ x \neq \epsilon$ and/or $\ z \neq \epsilon$, I don't see a way to prove that $\ w' = x y² z$ is not prime.

Adam
  • 61
  • 1
  • 1
  • 2

1 Answers1

6

Your attempt doesn't work, since you need the word you pick to belong to the language. Therefore I suggest picking $w = 1^p$, where $p$ is a prime which is larger than the pumping constant. The pumping lemma shows that there is a decomposition $w=xyz$, where $y \neq \epsilon$, such that $xy^iz \in L$ for all $i \geq 0$. Let $x=1^r$, $y=1^s$, and $z=1^t$, so that $r+s+t=p$. Then $xy^iz = 1^r 1^{si} 1^t = 1^{r+si+t} = 1^{p+(i-1)s}$. Thus, $p+(i-1)s$ has to be prime for all $i \geq 0$. However, when $i = p+1$, we get $p+(i-1)s = p+ps = p(1+s)$, which isn't prime.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514