Search code examples
regular-languagefinite-automatacomputation-theory

W(WR)* regular?


L= {W(WR)* },w=(a+b)* where WR is reverse of W. Is this language regular?

According to me it should not be regular as there can be case when we can have W(WR) which is not regular but in the book the answer is regular.

Can anyone explain this ?


Solution

  • The trick is the star. (WR)* includes the empty word. Thus L includes all words W catenated with the empty word, i.e. all words W. And the set of all words is, of course, regular.

    For W(WR)^+ things would look quite different. But with the star all the reverses are just some of the many, many words of the language.