Search code examples
regexunionautomatasharepoint-discussion-board

Union and Intersection can be a part of Regular Expression?


I was learning some concepts of AUTOMETA. I have done practice on DFA and RE but there been a question in my mind I searched, but wasn't satisfied so I gona ask:

Can UNION or INTERSECTION be a part of RE?

Kindly make me understand this concept..any reasonable response would be appriciated.


Solution

  • Union is already part of the regular expression syntax; r + s is the regular expression for the union of languages matched by regular expressions r and s. There is no intersection operator in the canonical regular expression syntax, but introducing one is harmless since we know that regular expressions match regular languages, and regular languages are closed under intersection. If we call that operator & then we can have regular expressions like (aa)* & (aaa)* to mean (aaaaaa)*. So, definitely doable. Note that there is no danger in getting out of the regular languages this way: the operands to & are regular expressions describing regular languages, and the result is a regular expression describing a regular language.