The two popular methods for converting a DFA to its regular expression are:
This method involves the following steps in finding the regular expression for any given DFA
Step 1:
Thumb Rule
The initial state of the DFA must not have any incoming edge.
If there exists any incoming edge to the initial state, then create a new initial state having no incoming edge to it.
Example:
Step 2:
Thumb Rule
There must exist only one final state in the DFA.
If there exists multiple final states in the DFA, then convert all the final states into non-final states and create a new single final state.
Example:
Step 3:
Thumb Rule
The final state of the DFA must not have any outgoing edge.
Example:
Step 4:
In the end,
Note: The state elimination method can be applied to any finite automata.
(NFA, ∈-NFA, DFA etc)
Problem 1: Find regular expression for the following DFA
Solution:
Step 1:
The resulting DFA is
Step 2:
The resulting DFA is
Step 3: Now, we start eliminating the intermediate states.
First, let us eliminate state A.
Eliminating state A, we get
Step 4: Now, let us eliminate state B.
Eliminating state B, we get
From here,
Regular Expression = 0(10)*
Note: In the above question,
- If we first eliminate state B and then state A, then regular expression would be = (01)*0.
- This is also the same and correct.
Problem 2: Find regular expression for the following DFA
Solution:
Step 1:
The resulting DFA is
Step 2: Now, we start eliminating the intermediate states.
First, let us eliminate state q4.
Step 3: Now, let us eliminate state q3.
Step 4: Now, let us eliminate state q5.
Step 5: Now, let us eliminate state q2.
From here,
Regular Expression = a(b+c+d)
18 videos|69 docs|44 tests
|
|
Explore Courses for Computer Science Engineering (CSE) exam
|