Presentation is loading. Please wait.

Presentation is loading. Please wait.

Regular Expressions • Equivalence Of Reg. Exps. And Finite Automata

Similar presentations


Presentation on theme: "Regular Expressions • Equivalence Of Reg. Exps. And Finite Automata"— Presentation transcript:

1 Regular Expressions • Equivalence Of Reg. Exps. And Finite Automata
• Kleenex Algebra • Languages defined by regular expressions are called REGULAR SETS. 004 Regular Expressions

2 Regular Expressions Over Alphabet 
1.  is a Reg. Exp. |||| =  2.  is a Reg. Exp. |||| = {} 3. a  a is a Reg. Exp. ||a|| = {a} 4. , : Reg. Exp.  (+), (), (*) : Reg. Exp. ||+|| = ||||||||, |||| = |||||||| ||*|| = (||||)* 5. Nothing else is a Reg. Exp. Over . 004 Regular Expressions

3 From Reg. Exps. To -NFAs (1)
Algorithm REtoNFA 1a: If =, then M accepts . 1b: If =, then M accepts {}. 1c: If =a, then Ma accepts {a}. 2a: If =, then s f sf a s f s f s f M M M

4 From Reg. Exps. To -NFAs (2)
2b: If =+, then 2c: If =*, then s f M s f s f M M+ f s s f M M*

5 From DFAs To Reg. Exps. Rijk={x* | (i) *(qi,x)=qj, Rijk=
Let M=({q1,..,qn},,,q1,F) be a DFA. For 1i,jk; 0kn, define Rijk={x* | (i) *(qi,x)=qj, (ii) x=yz & y+ & z+& & *(qi,y)=qm  mk}. Then {a | (qi,a)=qj} if ij, {a | (qi,a)=qj}{} if i=j, and if k>0, then Rijk=Rikk-1(Rkkk-1)*Rkjk-1Rjjk-1. Rijk= 004 Regular Expressions

6 Regular Expressions = Finite Automata
THEOREM L(DFA)=L(Reg Exp). Proof: : Reg.Exp., -NFA M [ L(M)=|||| ] by Algorithm REtoNFA. : DFA M, Reg.Exp. [ ||||=L(M) ] i) Prove by Induction on k that Rijk, Reg.Exp.ijk [ ||ijk||=Rijk ]. ii) L(M)=||1f1n+ 1f2n+…+ 1fmn||, where F={qf1, …, qfm}. 004 Regular Expressions

7 Kleene Algebra A Complete Axiom System for Regular Expressions
Axioms for K=(,+,,0,1) A1 a+(b+c)=(a+b)+c, a(bc)=(ab)c A2 a+b=b+a A3 a+a=a A4 a+0=a, a1=1a=a A5 a0=0a=0 A6 a(b+c)=ab+ac, (a+b)c=ac+bc A7 1+aa*=a*, 1+a*a=a* A8 abb  a*bb, and bab  ba*b, where ab  a+b=b for all a,b,c in . ( is omitted from xy.) def 004 Regular Expressions

8 The Axiom System is Complete and Sound.
THEOREM All and only properties of reg. exps. over  can be derived from axioms A1 to A8. Ex. (1) a*a*=a*, since a*+a*a* = a*+a*(1+aa*) = a*+(a*+a*aa*) = (a*+a*)+a*aa* = a*+a*aa* = a*(1+aa*) = a*a*. (2) a* = 1+aa* = (1+1)+aa* = 1+(1+aa*) = 1+a*. (3) ab & cd  a+b=b & c+d=d  ac+bd = ac+(a+b)(c+d) = ac+(ac+ad+bc+bd) = (ac+ac)+ad+bc+bd = ac+ad+bc+bd =(a+b)(c+d) = bd  acbd. A7 A6,A4    L A1 A4,A6 A7 A3 A3 A1 A7 A7 def of  A6,A2,A1 A1 A3 A1,A6 def of 


Download ppt "Regular Expressions • Equivalence Of Reg. Exps. And Finite Automata"

Similar presentations


Ads by Google