regular expressions

definition

a regular expression can be defined inductively over an alphabet $\Sigma$:

comparison to regular language

we use regular expressions to describe what the regular language (the set of accepted strings) is.

new notations

other than the notations we have encountered before (union, concatenation, star), we have two new ones:

properties

in a regular expression, $*$ have the highest precedence, and $\cup$ have the lowest precedence.

some properties of languages:

lemma: if a language is described by a regular expression, then it is regular.

converting regex to nfa

we use each rule defined at the start one by one, to build an nfa from regular expressions. for example:

this process follows 5 steps, each using one rule:

  1. $a$ is a regular expression (rule 1)
  2. $b$ is a regular expression (rule 1)
  3. $a b$ is a regular expression (rule 5 with step 1 and 2)
  4. $a b \cup a$ is a regular expression (rule 4 with steps 3 and 1)
  5. $(a b \cup a)^*$ is a regular expression (rule 6 with step 4)