Consider the following DFAs:
Convert the given DFAs to a Regex (using the state-elimination strategy). Hint: is it easier to apply conversion on another DFA?
Janusz Brzozowski worked out a very elegant (and more computationally efficient) way to convert Dfa's to Regexes. It relies on an observation called Arden's Lemma:
Proposition (Arden's Lemma). Let $ X, A$ and $ B$ be languages, such that $ X = A\cdot X \cup B$ . Then $ X = A^*B$ .
For each state $ q$ , build an equation of the form: $ q = c_1 q_1 \cup c_2 q_2 \ldots c_n q_n$ , such that: $ \delta(q,c_i) = q_i$ . Here $ c_i\in\Sigma$ , thus $ q_i$ are the $ c_i$ -successors of $ q$ . Additionally, if $ q$ is a final state, add an $ \epsilon$ : $ q = c_1 q_1 \cup c_2 q_2 \ldots c_n q_n \cup \epsilon$ .
Equations are expressions containing regexes together with state variables (like $ q_1$ ). Which are the unknowns. An equation of the form $ q = e\cdot q'$ signifies the fact that $ L(A_q) = L(e) L(A_{q'})$ , where $ L(A_q), L(A_{q'})$ are the languages accepted by our Dfa, starting from states $ q$ and $ q'$ , respectively.
We can choose any equation except that corresponding to the initial state, and eliminate it, by exploiting Arden's Lemma:
Example
Going back to the previous system of equations, we can find the solution to $ q_2$ which is: $ (A \cup B)^*$ . Next, we can replace the solution to $ q_2$ in $ q_1$ which yields: