GATE / CS ARCHIVE

GATE CSE 2025 SET 1 / QUESTION 44

Separating two repeated-border languages

Theory of Computation · Regular Expressions & Languages · Full GATE CSE 2025 Set 1 paper

GATE 2025 Set 1, Q44 2 marks · MCQ
Report issue

Regular Expressions & Languages

Question 44, GATE 2025: Over {a,b}, define L1={αβα | α∈{a,b}+ and β∈{a,b}+}, and L2={αβα | α∈{a}+ and β∈{a,b}+}. Both α and β must be nonempty. Which is correct? A both regular; B only L1 regular; C only L2 regular; D neither regular.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Approach: Simplify L2 directly, then prove L1 nonregular using intersection with a carefully chosen regular language.
Every L2 word begins and ends in a and has length at least three. Conversely any such word can use α=a and the nonempty intervening substring as β. Hence L2=a(a|b)+a, which is regular.
For L1 intersect with R={abr aabs:r,s≥1}. R is regular. A word in R has exactly three a’s. If it equals αβα, the two disjoint copies of α cannot each contain two a’s; because α starts at the initial a, it contains exactly one a. It also ends in b, and its suffix copy must start at the third a: starting at the second a would include two a’s. Thus α=abs. This is a prefix exactly when r≥s. The remaining β=br−sa is nonempty. Therefore L1∩R={abr aabs:r≥s≥1}.
If this intersection were regular with pumping length p, choose w=abp aabp. Any pumpable nonempty substring within the first p positions either includes the initial a or consists only of b’s from the first block. Pumping it down in the first case destroys the required initial a; in the second case it reduces r below s. Every permitted decomposition fails, contradicting the pumping lemma.
Regular languages are closed under intersection, so L1 cannot be regular. L2 is regular and L1 is not: C. A repeated substring does not automatically prove nonregularity; the explicit restriction and pumping argument supply the proof.

Original paper, page 44 · Answer key