0

Question

Is $L=\left \{ wxw \,\,|\,\,w,x \,\in \left ( a+b \right )^{+}\right \}$ regular?

My Understanding/Doubt

We can say that Language

$L_{2}=\left \{ wxw \,\,|\,\,w,x \,\in \left ( a+b \right )^{*}\right \}$ is regular

By making $x=(a+b)^{*}$ and $w=\epsilon$

Based on above Understanding , i can say that $L$ is regular?


My regular expression will be-: $L=a(a+b)^{+}a+b(a+b)^{+}b+a(a+b)^{+}b+b(a+b)^{+}a$ Am i right?

laura
  • 327
  • 1
  • 3
  • 12

2 Answers2

2

When is a string of the form $a^*ba^*b$ in the language $L$, i.e., of the form $wxw$, for nonempty $w,x$?

Or, to be more explicit, what is the language $L \cap a^*ba^*b$?

Hendrik Jan
  • 30,578
  • 1
  • 51
  • 105
0

The answer previously provided here is wrong. Counter example is $ab a ab$, see comment section below

Your conclusions are correct, but your regular expression also accepts the strings $aab$ or $abb$, which are not in $L$.

$a(a + b)^+a + b(a + b)^+b$ accepts a string $s$ if and only if $s \in L$, so $L$ is regular.

Mike B.
  • 1,368
  • 8
  • 11