Regular Expressions¶
We can use regular operations to build up regular expressions which describe languages.
For example,
is an $a$ or a $b$ followed by zero or more $a$’s.
Formal Definition¶
We say $R$ is a regular expression if $R$ is
- $a$ for some $a$ in the alphabet $\Sigma$,
- $\varepsilon$,
- $\varnothing$,
- $(R_1 \cup R_2)$, where $R_1$ and $R_2$ are regular expressions,
- $(R_1 \circ R_2)$, where $R_1$ and $R_2$ are regular expressions, or
- $(R)^*$, where $R$ is a regular expression.
Note that $\varepsilon$ is a language with only one string, the empty string ($\epsilon$), and $\varnothing$ is the language with no strings.
Regular Expressions and Languages¶
Theorem¶
A language is regular if and only if some regular expression describes it.
Proof¶
Base:
$R$ | $L(R)$ | $M$1 |
---|---|---|
$\varnothing$ | $\varnothing$ | |
$\varepsilon$ | ${\varepsilon}$ | |
$a$ | ${a}$ |
Nondeterminate Finite Automata to Regular Expressions¶
Given any nondeterminate finite automata we can construct an eqivalent nondeterminate finite automata with
- exactly one accept state,
- no arrows to the start state,
- no arrows out of the accept state, and
- the accept state is not the start state.
-
$L(R) = L(M)$ ↩