Definition

Regular Expression ^definition

A regular expression, , over an alphabet is defined as:

  • (sometimes replaced with ) means OR: defines the language
  • means concatenation: (commonly the circle is omitted) defines the language
  • means the Kleene star: defines the language

defines the (regular) language generated from the regex

Some examples of regexes:

  • defines the language
  • defines the language

Since regexes borrow all the same operations on languages, we can ‘pull’ out the :

  • (Pay attention! The empty word is not the empty set!)

Binding Power

Just like in formula parsing, regexes have a very, strict, well-formed syntax, that is unambiguous, as well as a slightly looser syntax. For example:

In our looser syntax, we ignore unnecessary parentheses, as well as treat

defines the exact same language as , but is much more simpler. However, this is only possible when we understand the binding powers of the operations for languages:

Binding Powers

Expression Tree

Like formula parsing, we can optionally construct an expression tree to visually see the hierarchy in a more complex regex:

Considered the regex below: %%🖋 Edit in Excalidraw, and the dark exported image%%

Theorems

T1: A language is regular iff it can be described by a regular expression. ^t1

Let be a language. Then:

#todo finish both sides of implicaiton

Examples

1: Deriving the equivalent language from a regular expression

Find the associated language of the regular expression given below: