2

In a nationwide entrance exam conducted in India, the following problem was asked in the year 2007:

Which of the following languages are regular?

(A) $L_1 = \left\{ ww^R \mid w \in \{0, 1\}^+ \right\}$
(B) $L_2 = \left\{ ww^Rx \mid x,w \in \{0, 1\}^+ \right\}$
(C) $L_3 = \left\{ wxw^R \mid x,w \in \{0, 1\}^+ \right\}$
(D) $L_4 = \left\{ xww^R \mid x,w \in \{0, 1\}^+ \right\}$

source - https://gateoverflow.in/1229/gate-cse-2007-question-31

For option (A), it is a standard textbook example of a non-regular language, because it violates the pumping lemma. We can show that the string $s=0^p110^p$ cannot be pumped. The pumping lemma is stated below for convenience. It is taken verbatim from Michael Sipser's Introduction to Theory of Computation, 3e

Theorem 1.70 - Pumping lemma

If $A$ is a regular language, then there is a number $p$ (the pumping length) where if $s$ is any string in $A$ of length at least $p$, then $s$ may be divided into three pieces, $s = xyz$, satisfying the following conditions:

  1. $\text{for each } i \ge 0, xy^iz \in A$,
  2. $|y| \gt 0$
  3. $|xy| \le p$

For option (C), this language is actually regular. The interesting observation here is that $ \text{A string } s \in L_3 \iff s \text{ begins and ends with same character} $. This is easy to show, so I am omitting the proof.

Coming to the question, I am not able to prove that options (B) and (D) are non-regular languages. Since this is an MCQ question (i.e., only 1 choice is correct), I was lucky to get it correct. But how does one go about proving that these are non-regular languages?

For option (B), I tried with $s = (01)^p(10)^p1$, but further steps seem convoluted in my attempt to show that $s$ cannot be pumped. I haven't attempted option (D). Could it be that these languages satisfy Pumping Lemma but are still non-regular?

Thanks for reading.

  • @J.-E.Pin Thanks, looks like I fell short on finding similar questions. I am not familiar with Myhill-Nerode Theorem yet, but I feel that answer will be enough to solve my doubts. There is another option (D), which is not answered in that link, but I think something can be worked out for that since (B) is solved. Should I delete my question, or will someone mark it as a duplicate? – Harsh Pathak Sep 06 '24 at 11:43
  • 1
    Welcome to MSE , with a +1 for the well written question with complete context without confusion ! In Case you are unable to work out (D) , you might want to ask a new question , listing your efforts with Pumping Lemma & Myhill–Nerode theorem. – Prem Sep 06 '24 at 12:49
  • 1
    For (D), just observe that $L_4 = L_2^R$ and use the fact that regular languages are closed under reversal. – J.-E. Pin Sep 06 '24 at 13:44

0 Answers0