0% found this document useful (0 votes)
154 views14 pages

DFA To RE

There are two main methods to convert a finite automaton to a regular expression: 1) Arden's Method, which uses equations representing state transitions to derive the expression for a final state. 2) State Elimination Method, which iteratively eliminates intermediate states to leave an expression connecting the initial to final state. Both methods may require preprocessing steps like adding epsilon transitions. Arden's Method solves equations while State Elimination iteratively simplifies the automaton structure. Examples are provided.

Uploaded by

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

DFA To RE

There are two main methods to convert a finite automaton to a regular expression: 1) Arden's Method, which uses equations representing state transitions to derive the expression for a final state. 2) State Elimination Method, which iteratively eliminates intermediate states to leave an expression connecting the initial to final state. Both methods may require preprocessing steps like adding epsilon transitions. Arden's Method solves equations while State Elimination iteratively simplifies the automaton structure. Examples are provided.

Uploaded by

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

** Designing regular expression from transition diagram **

Finite Automata to Regular Expression:

The two popular methods for converting a FA to its regular expression are:
● Arden’s Method
● State Elimination Method
……………………………………………………………………………………………………………………………….

Arden’s Method:
It states that-
Let P and Q be two regular expressions over ∑.
If P does not contain a null string ∈ , then:
R = Q + RP has a unique solution i.e. R = QP*

To use Arden’s Theorem, following conditions must be satisfied-

● The transition diagram must not have any ∈ transitions.


● There must be only a single initial state.

Steps:

Step 01:

● Form an equation for each state considering the transitions which come
towards that state.
● Add ‘∈’ in the equation of initial state.

Step 02:

Bring the final state in the form R = Q + RP to get the required regular expression.

----------------------------------------------OR-------------------------------------------
Step 01:
Create equations as the following form for all the states of the DFA having n states with
initial state q1.
q1 = q1R11 + q2R21 + … + qnRn1 + ε
q2 = q1R12 + q2R22 + … + qnRn2
…………………………
qn = q1R1n + q2R2n + … + qnRnn
Rij represents set of labels of edges from qi to qj, if no such edge exists, then Rij = ∅
Step 02:
Solve these equations to get the equation for the final state in terms of Rij

**Important**
Note 1:
Arden’s Theorem can be used to find a regular expression for both DFA and NFA
Note 2:
If there exists multiple final states, then-

● Write a regular expression for each final state separately.


● Add all the regular expressions to get the final regular expression.

..………………………………………………………………………………………………………………………….

State Elimination Method:

Steps:

Step 01:
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. and add an €-transition between them

Step 02:
There must exist only one final state in the DFA.
If there is more than one final state or if the single final state has transitions out, add a
new accepting state, make all other states non-accepting, and add an €-transition from
each former accepting state to the new accepting state.

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.

The state elimination method can be applied to any finite automata (NFA, ∈-NFA, DFA etc)

Examples For State Elimination Method :


https://www.gatevidyalay.com/dfa-to-regular-expression-examples-automata/
Atolens
Theorm
Atdun's Thaoum ompl
Exampl1

91 nitial statu 93 Rnal stati

initial state]
tq 410 t £ adel e an it u

29a 9q
ca3 9090+93
*Rom cauoiom1:
Applyuma Prdum's ThaoemR tRP R= 9P*|

E0 0 &is null stung


0M-

* am eauation d2.
Sulssitultca.44 volua inca
q 01+ 9a y Adans ThLorsmn
a 0I -(5S)
tom equaiom 3
Susttut valu om e9

By Arcum'A Thi0xUm
011O(bt1)
xamplta
n i i a l atat
Rhal todte

0 90 E é moved aa q înitial Atata

3)-3 0
Subabtu eq 3 ualu in eq

a ( l t ol) Aq Ptadun'a P OR
P9
4 ( 1(1t61)*
t

.Suwshlu qa ualun orm eau in eq 3


Suatitut ea,s volu în cq.

o o) +¬
(0{Ito1)

Atdun's Law

14D1* oo)
91 E o (

- (otLLito)* o o)*
Ex anpl S

yfnal tat
(13 ,0inubal gtat

4
-93 9aD90t 2

Put valu t . 3 in eq,9

930t9.0 + 911
93
93
t ( o t1)-S
3
în S
S yt d o n ' s Thso e
98 (0+1)o*
ovn t9 2 nd aluu 9 -
alu
1191ot 4-0+l) o (7)
uk in e s )

RElo (ot11Do* )
Exomplu for Stadt Euminatuon muthoo

Exanmpl
O

StOxA
Thu încoming tamaiion to ne statiSo w mud
to mab taut
mu
atad

Thuu
u outgauma ttamatuon tom umal stau so nw
mastat niud to u made

(1a
elumi ratu

(1

h ininatt , 0,1

oos(1.)-
RLgula Expiisuon 0*]+0(0+1

Examplu 110

(132
(2
ol
O0

ElGrr noda

1tD1) o00 E

elrminata

(O+ IC+ o1)*oo)

Reqular Erpreuion 0+C40) 0o)

-
Exomplu3 3
amtnation3

Eliminati q

11+0

luminot 3

(11+0jo*\
6Elmumatu
> (15
(

Riquiar Expussion lo+ CIl+ 0) 0*1 o lotlotl) o*|

You might also like