0

I know there are a lot of questions similar to this one, Proving a language is regular is just one example. However, I have not managed to find an answer that really answers my question. I'm currently studying for an exam in automata theory, and hence trying to understand how it all works. So, given the following language, how do I determine whether it is regular or not?

$L_1 = \{uvu^{rev} : u, v \in \{a, b\}^*\ and\ \lvert u \rvert = 2\}$

I'm not quite sure how I should be approaching this issue, and how $u^{rev}$ and $\lvert u\rvert$ affect the regularity of a language. My get instinct would be that a machine could handle the reverse if we know its length, but not otherwise, but I can't tell exactly why that would be true. Or perhaps it is that the middle part must be known and we must know the length of $v$ instead?

Furthermore, the problem continues with a second language

$L_1 = \{uvu^{rev} : u, v \in \{a, b\}^*\ and\ \lvert v \rvert = 2\}$

So the exact same language, but we now know the length of $v$.

It's clear to me that one of the languages is regular and the other not, but I am struggling to find a good explanation as to why that is, and how to properly argue for either.

It should also be noted that the question specifies that

If the expression is regular, a regular expression and/or closure properties should be used to prove this. Otherwise, a proof using the pumping lemma should be given.

I'm not quite sure how to approach this, so any help would be much appreciated, and preferably not just a solution but an explanation for it too!

Phroggyy
  • 103

1 Answers1

1

I’ll get you started. It makes a very great difference whether we restrict the length of $u$ or the length of $v$. Let’s look first at restricting the length of $u$.

Since the alphabet is $\{a,b\}$, when we require that $|u|=2$, we’re actually saying that $u$ must be one of the words $aa,ab,ba$, and $bb$. This means that words of $L_1$ have one of the following four forms, where $v\in\{a,b\}^*$: $aavaa,abvba,bavab$, and $bbvbb$. Can you write regular expressions for each of these forms and then combine them to get a regular expression for $L_1$?

When we require instead that $|v|=2$, we’re saying that $L_2$ consists of the words of the forms $uaau^{rev},uabu^{rev},ubau^{rev}$, and $ubbu^{rev}$, where $u$ can be any word in $\{a,b\}^*$. Getting a regular expression for one of these forms is no easier than getting one for the set of words of the form $uu^{rev}$, and that language is not regular. I’ll get you started on a pumping lemma proof that $L=\big\{uu^{rev}:u\in\{a,b\}^*\big\}$ is not regular; see if you can modify it to show that $L_2$ is not regular.

I’ll assume that you’ve seen the pumping lemma used. Suppose that $L$ is regular, and let $p$ be the pumping length. Let $w=a^pbba^p$; clearly $w\in L$. The pumping lemma says that $w$ can be decomposed as $w=xyz$ in such a way that $|xy|\le p$, $|y|\ge 1$, and $xy^kz\in L$ for each $k\ge 0$. Note that these conditions imply that $y$ is a non-empty substring of the first string of $a$s in $w$; what happens when you pump (i.e., when you change $k$ from $1$ to some other natural number)?

Brian M. Scott
  • 616,228
  • That first explanation was absolutely great! Thanks for making me consider what it looks like in the end, that was really a great help! I'm gonna take a look at the section about the pumping lemma in the morning (it's 2 am here now...), but I feel like grasping that will be a lot easier now that I understand why L_1 is regular and not L_2! To answer the question of what happens when you pump, if I understand correctly, we are pumping up the left side, as xy is contained in u. This means that pumping to k > 1 leads to the left side, u, being larger than the right side, u^rev. |u| > |u^rev|... – Phroggyy Jan 08 '16 at 01:09
  • @Phroggyy: You’re very welcome. Yes, if you take $k>1$, the left side ends up with more $a$s than the right side. (If you drop $k$ down to $0$, something that beginners often forget is possible, you also get something outside of $L$, because now the left side is shorter than the right.) – Brian M. Scott Jan 08 '16 at 23:02