I recently upgraded the MediaWiki software that powers Spivey's Corner. If you notice any glitches in the new setup,
please (wait half an hour to see if I fix it, then) let me know and I will see what can be done. – Mike

# Deriving regexps from finite automata

The standard argument for one half of Kleene's theorem is often acknowledged to be complicated. It becomes more so when presented in a form that involves quantities written $\displaystyle{ E_{q_1q_2}^{S\cup\{q\}} }$. Much better is to view it as a sequence of transformations on hybrid automata, which are like NFAs except that each transition can be labelled with a regular expression. The definition is easy:
A string $$s$$ is in the language accepted by a hybrid automaton if there is a path of length $$n$$ in the automaton and a way of splitting $$s$$ into $$n$$ pieces such that each piece is in the language described by the regexp labelling the corresponding step in the path.
For simplicity, it is often best to begin the sequence of transformations by forming the 'suspension' of the original automaton, adding new start and finish states $$q_i$$ and $$q_f$$ with $$\epsilon$$-transitions so that the machine never re-enters the new start state or carries on from the new finish state.
Then, as in the algorithm given, we begin to eliminate intermediate states until there are none left, replacing each path that goes via an intermediate state with direct connections labelled with an appropriate regexp. To make the construction clearer, we can first split a state that has more than one outgoing transition, exploiting nondeterminism to replace it with multiple states that have the same incoming transitions but have only one outgoing transition each. This move is not necessary to the construction, but it reduces the mental bandwidth needed in concrete examples to see that each stage in the transformation is equivalent to the preceding stage. In the example attached below, splitting $$q_2$$ reveals that it has two 'purposes': one is to return to $$q_1$$ via a $$b$$, the other to go on to state $$q_0$$ via an $$a$$, and these paths yield different elements of the final regular expression.