Consider the following two languages: L_1 = {0^i1^j | gcd(i,j) = 1}. L_2 is…
2016
Consider the following two languages: L_1 = {0^i1^j | gcd(i,j) = 1}. L_2 is any subset of 0^*. Which of the following is correct?
Answer: B. L_1 is not regular and L_2^* is regular — CONCEPTThe Myhill–Nerode theorem says that a language is regular exactly when it has finitely many equivalence classes under indistinguishability by suffixes.…
- A.
L_1is regular andL_2^*is not regular - B.
L_1is not regular andL_2^*is regular - C.
Both
L_1andL_2^*are regular languages - D.
Both
L_1andL_2^*are not regular languages
Attempted by 80 students.
Show answer & explanation
Correct answer: B
CONCEPT
The Myhill–Nerode theorem says that a language is regular exactly when it has finitely many equivalence classes under indistinguishability by suffixes. An infinite family of prefixes separated by suitable suffixes therefore proves non-regularity.
For a unary language, concatenation adds string lengths. Thus the length set of a Kleene star is an additive submonoid of the non-negative integers; every such submonoid is finitely generated, and every nonzero one is eventually periodic. An eventually periodic unary length set is regular.
APPLICATION: THE GCD LANGUAGE
Take the infinite family of prefixes
0^p, one for each primep.For distinct primes
pandq, append the common suffix1^q. Thengcd(p,q)=1, so0^p1^qbelongs toL_1, whereasgcd(q,q)=q≠1, so0^q1^qdoes not.The suffix
1^qdistinguishes0^pfrom0^q. Infinitely many prime-indexed prefixes are therefore pairwise distinguishable, soL_1is not regular.
APPLICATION: THE UNARY STAR
Let
S={k:0^k∈L_2}. The strings inL_2^*have exactly the lengths in the additive submonoidM=⟨S⟩.If
Sis empty or contains no positive length, thenM={0}andL_2^*={ε}, which is regular.Otherwise,
Mis a nonzero submonoid of the non-negative integers. It has a finite generating set; ifdis the gcd of its positive generators, all sufficiently large multiples ofdlie inMand no nonmultiple does. Hence membership is eventually periodic with periodd.A DFA handles the finite initial segment explicitly and then tracks the input length modulo
d. ThereforeL_2^*is regular for every subsetL_2of0^*.
CROSS-CHECK
For
p=2andq=5, the suffix1^5gives gcd values 1 and 5 for the prefixes0^2and0^5, demonstrating the distinguishing-suffix mechanism.For
L_2={0^6,0^10}, the reachable positive lengths include 6, 10, 12, 16, 18, 20, 22, …; 14 is absent, but every even length from 16 onward is reachable, giving eventual period 2.For
L_2={ε}, the star is still{ε}, confirming the zero-length branch.
RESULT
Thus L_1 is not regular and L_2^* is regular, so the saved pair is the correct one.
A video solution is available for this question — log in and enroll to watch it.
Explore the full course: Mppsc Assistant Professor Computer Science Paper 2