Proof (equivalence of regular expression and DFA)
Regular expression $\implies$ DFA
It suffices to produce an $ε$-NFA for each regular expression. We proceed by induction.
All automata shown here has one unique accept state, and no edges into the start state and out of the accept state.
DFA $\implies$ regular expression
Let $D = (Q, Σ, δ, q_0, F)$ be a DFA. WLOG, relabel $Q = \set{1, 2, \ldots, n}$ with $q_0 = 1$. We will construct a regular expression $R_{ij}^k$ for all $i,j=1,2,\ldots,n$ and $k=0,1,\ldots,n$ such that
$\mathcal{L}(R_{ij}^k)$ is all words $w\in Σ^\ast$ where reading $w$ from state $i$ results in a state sequence $q_0 = i, q_1, q_2, \ldots, q_{|w|-1}, q_{|w|} = j$ with intermediate states $q_l\leq k$ for all $0< l< |w|$.
Induct on $k$. For $k=0$, let $\set{σ_1, \ldots, σ_l} = \sb{σ}{δ(i,σ) = j}$.
-
if $i=j$, then $$ \begin{align*} R_{ij}^{0} := a_1 + \ldots + a_l + ε; \end{align*} $$
-
if $i\neq j$, then $$ \begin{align*} R_{ij}^0 := \begin{cases} a_1 + \ldots + a_l, &\text{if $l>0$}, \\ \emptyset, &\text{if $l=0$}. \end{cases} \end{align*} $$
Now suppose $R_{ij}^{k-1}$ has been constructed for all $i,j$. We claim $$ \begin{align*} R_{ij}^k := R_{ij}^{k-1} + R_{ik}^{k-1} (R_{kk}^{k-1})^\ast R_{kj}^{k-1} \end{align*} $$ works. Suppose $w\in Σ^\ast$ results in a state sequence which starts at $i$, ends at $j$ and passes through intermediate states at most $k$. Two cases:
-
If $w$ does not pass through $k$ as an intermediate state, then $w\in \mathcal{L}(R^{k-1}_{ij})$.
-
Otherwise, split $w = w_0 w_1 \ldots w_l w_{l+1}$ (for some $l\geq 1$), where $w_0$ goes from $i$ to $k$, each $w_1, \ldots, w_l$ goes from $k$ to $k$, and $w_{l+1}$ goes from $k$ to $j$, with the state $k$ not reached as an intermediate state when reading each substring. Then $w_0\in \mathcal{L}(R_{ij}^{k-1})$, $w_1, \ldots, w_l\in \mathcal{L}(R_{kk}^{k-1})$ and $w_{l+1}\in \mathcal{L}(R_{jk}^{k-1})$.
Finally, writing $F = \set{q_1, \ldots, q_f}$, $$ \begin{align*} \mathcal{L}(D) = \mathcal{L}(R_{1q_1}^n + \ldots + R_{1q_f}^n). \end{align*} $$