There are two methods for converting a Deterministic Finite Automata (DFA) to Regular expression (RE). These methods are as follows −
Let us understand the Arden's Theorem method in detail.
Let P and Q be the two regular expressions.
If P does not contain null string, then the following equation in R, viz R = Q + RP,
Which has a unique solution by R = QP*
To find the regular expression for the given automata, we can first create the equations in the given form for all the states.
By repeatedly applying substitutions and Arden's Theorem we can express qi in terms of α ij's. To get the set of strings recognized by the Finite State Automata (FSA), we have to take the union of all qi's corresponding to final states
Note: For the parallel edges, there will be many expressions for that state in the expression.
Then, we solve those equations to get the equation for qi in terms of α ij and that expression is the required solution, where qi is a final state. It is shown below −
q 1= q a + q3a + € ( € move is because q1is the initial state)
q2 = q1b + q2b + q3b
q3 = q2a
Now, we will solve these equations, as shown below−
. q2 = q1b + q2b + q3b
= q1b + q2b + (q2a)b (Substituting value of q3)
= q1b + q2(b + ab)
= q1b (b + ab) * (Applying Arden's Theorem)
. q1 = q1a + q3a + €
= q1a + q2aa + € (Substituting value of q3)
= q1a + q1b(b + ab*)aa + € (Substituting value of q2)
= q1(a + b(b + ab) *aa) + €
= € (a+ b(b + ab) *aa) *
= (a + b(b + ab) *aa) *
Hence, the regular expression is (a + b(b + ab) *aa) *.