Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC312 Automata Theory Lecture # 5 Chapter # 4 Cont…

Similar presentations


Presentation on theme: "CSC312 Automata Theory Lecture # 5 Chapter # 4 Cont…"— Presentation transcript:

1 CSC312 Automata Theory Lecture # 5 Chapter # 4 Cont…

2 Definition For regular expressions and

3 Example Regular expression:

4 Example Regular expression

5 Example = { all strings with at least two consecutive 0 }
= { all strings without two consecutive 0 }

6 Regular Languages Definition: The language generated by any regular expression is called a regular language. Note: If r1, r2 are regular expressions, corresponding to the languages L1 and L2 then the languages generated by r1+ r2, r1r2 (or r2r1) and r1*( or r2*) are also regular languages.

7 Languages Generated by Regular Expressions Regular Languages

8 Note: All finite languages are regular whereas some infinite languages are regular & some are non-regular. In order to write RE for finite languages just include +’s between the words of finite languages. Consider the alphabet Σ={a,b}. The words of length 1 are two. Its RE will be a+b. Similarly the words of length 2 will be aa,ab,ba,bb. Its RE will be aa+ab+ba+bb or (a+b)(b+a). Similary the languages of all words whose length is 3 will be aaa,aab,aba,abb,bbb,bba,bab,baa. Thus we can conclude that all words of a’s and b’s of any length can be defined by (a+b)*.

9 EVEN-EVEN Language EVEN-EVEN = { aa bb aaaa aabb abab abba baab baba bbaa bbbb aaaaaa …} In this language we have following three types of strings type1 = aa type2 = bb type3 = (ab+ba)(aa+bb)*(ab+ba) Thus the RE = (type1 +type2 +type3)* = (aa + bb + (ab+ba)(aa+bb)*(ab+ba))*

10 Equivalent Regular Expressions
Definition: Regular expressions and are equivalent if

11 Check Equality (a+)* = (a*)+ = a* (a*+b)* = (a+b)*
(a+b)*ab(a+b)* = (a+b)*a(a+b)*b(a+b)* (a+b)*= (a*+b*)* (a+b)*= (a*b*+b*a*)* (a+b)*= a(a+b)*+b(a+b)*+ (a+b)*= a(a+b)*ab(a+b)*+b*a* (aa+ab*)* = (aa+ab)* a*a* = (aa)* (a+b)*= (a*b*)*

12 Check Equality (a+)* = (a*)+ = a* (a*+b)* = (a+b)* Yes
(a+b)*ab(a+b)* = (a+b)*a(a+b)*b(a+b)* (a+b)*= (a*+b*)* (a+b)*= (a*b*+b*a*)* (aa+ab*)* = (aa+ab)* (a+b)*= a(a+b)*+b(a+b)*+ (a+b)*= a(a+b)*ab(a+b)*+b*a* a*a* = (aa)* (a+b)*= (a*b*)* Yes Yes Yes Yes Yes No – what is missing Yes No No Yes

13 Practice Questions See examples at p-37, 38, 39, 40, 46, 47
Ch # 4 Exercise p-49. Questions: 2, 3, 4, 5, 6, 7, 8, 9, 10


Download ppt "CSC312 Automata Theory Lecture # 5 Chapter # 4 Cont…"

Similar presentations


Ads by Google