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 b a b a q2 q3 b q4 a,b SOLUTION # 1 : Form the eqns. a q1 b q2 q1 = q2 b + q3 a + b ε -eqn(i) q3 a a b q4 a,b SOLUTION # 1 : Form the eqns. q1 = q2 b + q3 a + ε -eqn(i) a q1 b a b a q2 q2 = q1 a -eqn(ii) q3 b q4 a,b SOLUTION # 1 : Form the eqns. q1 = q2 b + q3 a + ε a q1 b a b a q2 q3 b q4 -eqn(i) q2 = q1 a (ii) -eqn SOLUTION # 1 : Form the eqns. q1 = q2 b + q3 a + ε (i) a q1 b a b a q2 q2 = q1 a (ii) – – q3 = q1 b (iii) q3 b q4 q4 = q2 a + q3 b + q4 a + q4 b -eqn(iv) a,b SOLUTION # 1 : Form the eqns. q1 = q2 b + q3 a + ε –(i) q2 = q1 a –(ii) q3 = q1 b –(iii) q4 = q2 a + q3 b + q4 a + q4 b –(iv) a q1 b a b a q2 So required regular expression is : (ab + ba)* Put q2 and q3 in q1 as : q1 = q1 ab + q1 ba + ε q1 = ε + q1 (ab + ba) q1 = ε (ab + ba)* q3 b q4 a,b EXAMPLE # 2 : QUES: Construct a regular expression corresponding to the state 0 diagram: q1 1 0 q3 1 q2 1 0 SOLUTION # 2 : Form the eqns. q1 = q1 0 + q3 0 + ε -(i) q1 q2 = q1 1 + q2 1 + q3 1 -(ii) q3 = q2 0 –(iii) q2 = q1 1 + q2 1 + (q2 0)1 0 = q1 1 + q2(1 + 01) q2 = q1 1(1 + 01)* So, q1 = q1 0 + q3 0 + ε q3 = q1 0 + q2 00 + ε = q1 0 + (q1 1(1 + 01)*00) +ε = q1(0 + 1(1 + 01)*00) + ε = ε(0 + 1(1 + 01)*00)* 0 1 1 q2 1 0 So required regular expression is : (0 + 1(1 + 01)*00)* EXAMPLE # 3 : QUES : Find the regular expression 1 corresponding to: 0 q1 1 q2 0 0 1 0 q4 q3 1 SOLUTION # 3 : Form the eqns. 0 q1 = q1 0 + q3 0 + q4 0 + ε q1 q2 = q1 1 + q2 1 + q4 1 q3 = q2 0 0 q4 = q3 1 Now q4 = q3 1 = q2 01 Using q2 equation, we get : q4 q2 = q1 1 + q2 1 + q2 011 = q1 1 + q2(1+011) = q1 1(1 + 011)* = q1 (1(1 + 011)*) 1 1 q2 0 1 0 q3 1 …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.