GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 16(ii)

Unary prime-length language is not regular

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 1992 paper

GATE 1992, Q16(ii) Descriptive
Report issue

Regular Expressions & Languages

Question 16(ii), GATE 1992: True or false? L={0ⁿ : n is prime} is not regular. Prove your answer.
Question 16(ii), GATE 1992: True or false? L={0ⁿ : n is prime} is not regular. Prove your answer.
Tap to enlarge
Answer & solution

Answer: True. Pump a prime-length q word with i=q+1 to obtain composite length q(1+|y|). (no official key was published)

True. Suppose for contradiction that L is regular, and let p≥1 be its pumping length. There is a prime q≥p, because primes are unbounded. Choose w=0q∈L. For any pumping-lemma decomposition w=xyz with |xy|≤p and |y|≥1, let d=|y|, so 1≤d≤p.

The pumping lemma requires xyi z∈L for every integer i≥0. Choose i=q+1. This word has length
|xz|+(q+1)|y| = (q−d)+(q+1)d = q+qd = q(1+d).
Both factors exceed one: q is prime and therefore q≥2, while d≥1 gives 1+d≥2. The length is composite. Consequently xyq+1z∉L, contradicting the pumping lemma.

The contradiction holds for every valid decomposition, because the same choice i=q+1 works for every positive d. We therefore refute the existence of a pumping length, and L is nonregular. Choosing an arbitrary fixed pump such as i=2 would not suffice: q+d might itself be prime for some decompositions. The deliberately selected exponent makes the resulting length a multiple of q larger than q.

Original paper, page 9