Вы находитесь на странице: 1из 18

Presentation on :

“ARDEN’S
THEOREM”

 Presented by:-
Gaurav Gupta
20/05
IInd B.Tech I.T.
CONSRTRUCTION OF
REGULAR EXPRESSION
FROM DFA
 The regular expression is mathematical
expression for a given regular language.
 We know that for every regular language there
exist a DFA.
 We can conclude that for regular expression,
regular language for that regular expression
and DFA for that regular language are similar
things in different representation.
 So we can construct regular expression for
every Deterministic Automata.
 ARDEN’S THEOREM is one means to implement
it.
AR DEN’S TH EO REM
Let P and Q be two regular expression
over alphabet Σ. If P does not contain
NULL STRING (ε), then :
R = Q + RP

Has a unique solution that is :


R = QP*

Now lets have a look at its mathematical


proof…
MATHEMATICAL
PROOF
It can be understood as :
R = Q + RP
Put the value of R in R.H.S.
R = Q + (Q + RP) P
= Q +QP + RP2
When we put the value of R again and again we get the
following equation:
R = Q + QP + QP2 + QP3…
R = Q ( 1 + P + P2 + P3 …)
R = Q ( ε + P + P2 + P3 … )
R = QP*
-(By the definition of closure operation for
regular expression.)
IMPLEMENTATION :
USE OF ARDEN’S THEOREM TO FIND
REGULAR EXPRESSION OF A
DFA :
There are certain assumptions which
are made regarding the transition
system :
 The transition diagram should not have
ε-
transition.
 It must have only a single initial state.

 Its vertices are q1 , q2 , … , qn .


Contd…
 wij denotes the regular expression
representing the set of labels of edges
from qi to qj .We can get the following
set of equation in q1 … qn .
q1 = q1 w11 + q2 w21 + … + qn wn1 + ε
(since q1 is the initial state)
q2 = q2 w12 + q2 w22 + … + qn wn2
:
:
qn = q1 w1n + q2 w2n + … + qn wnn
We solve these equations for qi in
terms wij‘s and it will be the required
EXAMPLE # 1 :

QUES: Find the regular expression


for transition diagram given
below a:
q1 q2
b

a b a

b
q3 q4 a,b
SOLUTION # 1 :
a
Form the eqns.
q1 q2
b

q1 = q2 b + q3 a + b a a
ε
-eqn(i) b
q3 q4

a,b
SOLUTION # 1 :
a
Form the eqns.
q1 q2
q1 = q2 b + q3 a + b

ε a b a
-eqn(i)
q2 = q1 a q3
b
q4
-eqn(ii)
a,b
SOLUTION # 1 :
a
Form the eqns.
q1 q2
q1 = q2 b + q3 a + b

ε a b a

b
q3 q4

-eqn(i)
q2 = q1 a -eqn
(ii)
SOLUTION # 1 :

Form the eqns. a

q1 q2
q1 = q2 b + q3 a + ε -
(i) b

q2 = q1 a – a b
(ii) a

q3 = q1 b –
(iii) b
q3 q4

q4 = q2 a + q3 b + a,b
q4 a + q4 b
-eqn(iv)
SOLUTION # 1 :
Form the eqns. a
q1 = q2 b + q3 a + ε –(i) q1 q2
q2 = q1 a –(ii)
b
q3 = q1 b –(iii)
q4 = q2 a + q3 b + q4 a a b
+ q4 b a
–(iv)
Put q2 and q3 in q1 as : b
q3 q4
q1 = q1 ab + q1 ba + ε
q1 = ε + q1 (ab + ba)
a,b
q1 = ε (ab + ba)*
So required regular expression is : (ab +
ba)*
EXAMPLE # 2 :

QUES: Construct a regular


expression
corresponding
0 to the state
diagram:
q1 1

0 1 q2 1

q3 0
SOLUTION # 2 :
0
Form the eqns.
q1 = q1 0 + q3 0 + ε -(i) q1 1
q2 = q1 1 + q2 1 + q3 1 -(ii)
q3 = q2 0 –(iii)
q2 = q1 1 + q2 1 + (q2 0)1
= q1 1 + q2(1 + 01) 0 1 q2
1
q2 = q1 1(1 + 01)*
So, q1 = q1 0 + q3 0 + ε
q3 0
= q1 0 + q2 00 + ε
= q1 0 + (q1 1(1 + 01)*00)

= q1(0 + 1(1 + 01)*00) + ε
= ε(0 + 1(1 + 01)*00)*
So required regular expression is :
(0 + 1(1 + 01)*00)*
EXAMPLE # 3 :
QUES : Find the regular expression
corresponding to: 0 1

q1 q2
1

0
0
0

1
q4 q3

1
SOLUTION # 3 :
Form the eqns. 0 1
q1 = q1 0 + q3 0 + q4 0 +
ε q1 q2
q2 = q1 1 + q2 1 + q4 1 1
q3 = q2 0
q4 = q3 1 0
0
Now q4 = q3 1 = q2 01 0
Using q2 equation, we get
: 1
q4 q3
q2 = q1 1 + q2 1 + q2 011
= q1 1 + q2(1+011) 1
= q1 1(1 + 011)*
= q1 (1(1 + 011)*) …contd.
SOLN # 3 : (contd…)
Put q3 and q4 in q1 eqn.
q1 = q1 0 + q2 00 + q2 010 + ε
= q1 0 + q2 (00 + 010) + ε
= q1 0 + q1 1(1 + 011)* (00 + 010)*
= ε (0 + 1(1 + 011)* (00 + 010))*
Put q2 in q4 eqn.
q4 = q1 1(1 + 011)* 01
= q1 (1(1 + 01)* 01)
= (0+1(1 + 011)* ( 00 + 010))* ( 1(1 + 011)*
01)
So the required regular expression is :
(0+1(1 + 011)* ( 00 + 010))* ( 1(1 + 011)* 01)
Special Thanks
to :
Prof. Vinay Pathak
H.O. C.S.E. Department
H.B.T.I. Kanpur.