Regular expressions

Definition (Kleene plus, Kleene star) open_in_new

Let $L\subseteq Σ^\ast$ be a language.

The Kleene plus operation is $$ \begin{align*} L^+ = \sb{w\in Σ^\ast}{\exists w_0, \ldots, w_n\in L \text{ such that } w = w_0 \ldots w_n}, \end{align*} $$ i.e. finite concatenation of one or more elements of $L$.

The Kleene star operation is $$ \begin{align*} L^\ast = L^+ \cup \set{ε}. \end{align*} $$

Definition (regular expression) open_in_new

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)$$^*$;

Theorem (equivalence of regular expression and DFA) open_in_new

For any regular expression $R$, there is a DFA $D$ such that $\mathcal{L}(R) = \mathcal{L}(D)$, and vice versa.

Proof