0

I am practicing for an exam. I am trying to convert a language to a regular expression. The language and my solution is as follows:

$L=\{w∈\{a,b\}^+│|w|≥4\ and\ the\ second\ symbols\ from \ the \ front\ and\ the\ back\ are\ equal\}$

Solution: $(a+b)x(a+b)^* x(a+b) \ \ where\ x=(a+b)$

Is this correct? If not, can someone correct me. also, am I allowed to use variables in regular expressions?

Thanks in advance

Amine
  • 3
  • 1
  • 2

1 Answers1

1

You asked two questions. The usual rule on this site is to ask one question per post.

No, you're not allowed to use variables in regular expressions. Regular expressions have a formal definition. To qualify as a regular expression, you need to meet the requirements in the definition. The definition can be found on Wikipedia or in your favorite textbook, and you'll note that it does not allow "where" or "variables".

For your first question about how to find a regular expression for a language, take a look at How to prove a language is regular?.

D.W.
  • 167,959
  • 22
  • 232
  • 500