Definition (regular expression)
Let $Σ$ be an alphabet.
Among the finite strings over the set of symbols $Σ \sqcup \set{\emptyset, ε, (, ), +, {}^* }$, we define the notion of regular expression by recursion:
-
$\emptyset$ is a regular expression;
-
$ε$ is a regular expression;
-
$(R + S)$ is a regular expression if $R,S$ are regular expressions;
-
$(RS)$ is a regular expression if $R,S$ are regular expressions;
-
$R^\ast$ is a regular expression if $R$ is a regular expression.
We usually omit unnecessary parentheses.
We associate languages to regular expressions by recursion:
-
$\mathcal{L}(\emptyset) = \emptyset$;
-
$\mathcal{L}(ε) = \set{ε}$;
-
$\mathcal{L}(a) = \set{a}$ if $a\in Σ$;
-
$\mathcal{L}(R+S) = \mathcal{L}(R) \cup \mathcal{L}(S)$;
-
$\mathcal{L}(RS) = \mathcal{L}(R) \, \mathcal{L}(S)$;
-
$\mathcal{L}(R^*) = \mathcal{L}(R)$$^*$;