0% found this document useful (0 votes)
12 views

Class 14 RE To DFA State Elimination Method

Uploaded by

midhulasrikj3053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Class 14 RE To DFA State Elimination Method

Uploaded by

midhulasrikj3053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

State Elimination Method

Closure Properties of Regular Languages


State Elimination Method
This method involves the following steps in finding the regular expression for any given DFA-
Step-01:
If there exists any incoming edge to the initial state, then create a new initial
state having no incoming edge to it.
Step-02:
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.
Step-03:
If there exists any outgoing edge from the final state, then create a new final
state having no outgoing edge from it.
Step-04:
Eliminate all the intermediate states one by one. These states may be
eliminated in any order.

In the end,
• Only an initial state going to the final state will be left.
• The cost of this transition is the required regular expression.
Problem-01:
Find regular expression for the following DFA-

Step-01:
Initial state A has an incoming edge. So, we create a new initial state q i.
Step-02:
Final state B has an outgoing edge. So, we create a new final state qf.

Step-03:
Now, we start eliminating the intermediate states.
First, let us eliminate state A.
There is a path going from state qi to state B via state A.
So, after eliminating state A, we put a direct path from state qi to state B
having cost ∈.0 = 0
There is a loop on state B using state A.
So, after eliminating state A, we put a direct loop on state B having cost 1.0 =
10.
Eliminating state A, we get-

Step-04:
Now, let us eliminate state B.
There is a path going from state qi to state qf via state B.
So, after eliminating state B, we put a direct path from state qi to state qf having cost 0.
(10)*.∈ = 0(10)*
Eliminating state B, we get-

Regular Expression = 0(10)*


Problem-02:
Find regular expression for the following DFA-

Step-01:
There exist multiple final states. So, we convert them into a single final state.
The resulting DFA is-
Step-02:
Now, we start eliminating the intermediate states.
First, let us eliminate state q4.
There is a path going from state q2 to state qf via state q4.
So, after eliminating state q4 , we put a direct path from state q2 to
state qf having cost b.∈ = b.
Step-03:
Now, let us eliminate state q3.
There is a path going from state q2 to state qf via state q3.
So, after eliminating state q3 , we put a direct path from state q2 to
state qf having cost c.∈ = c.
Step-04:
Now, let us eliminate state q5.
There is a path going from state q2 to state qf via state q5.
So, after eliminating state q5 , we put a direct path from state q2 to
state qf having cost d.∈ = d.
Step-05:
Now, let us eliminate state q2.
There is a path going from state q1 to state qf via state q2.
So, after eliminating state q2 , we put a direct path from state q1 to
state qf having cost a.(b+c+d).

Regular Expression = a(b+c+d)


Exercises

Find regular expression for the following DFA-

3
4 5
Solution-

Step-01:

State D is a dead state as it does not reach to any


final state.
So, we eliminate state D and its associated edges.

The resulting DFA is-


Step-02:

Initial state A has an incoming edge (self loop).


So, we create a new initial state qi.

The resulting DFA is-


Step-03:

There exist multiple final states.


So, we convert them into a single final state.

The resulting DFA is-


Step-04:

Now, we start eliminating the intermediate states.

First, let us eliminate state C.


There is a path going from state B to state qf via
state C.
So, after eliminating state C, we put a direct path
from state B to state qf having cost b.b*.∈ = bb*

Eliminating state C, we get-


Step-05:

Now, let us eliminate state B.


There is a path going from state A to
state qf via state B.
So, after eliminating state B, we put a
direct path from state A to state
qf having cost a.a*.(bb*+∈) =
aa*(bb*+∈)

Eliminating state B, we get-


Step-06:

Now, let us eliminate state A.


There is a path going from state qi to state qf via
state A.
So, after eliminating state A, we put a direct path
from state qi to state qf having cost ∈.b*.
(aa*(bb*+∈)+∈) = b*(aa*(bb*+∈)+∈)

Eliminating state A, we get-

Regular Expression = b*(aa*(bb*+∈)+∈)


We know, bb* + ∈ = b*
So, we can also write-
Regular Expression = b*(aa*b*+∈)

You might also like