Theory of Automata Chapter 4
Theory of Automata Chapter 4
Automata Theory
Lec# 5, 6
REGULAR EXPRESSIONS
Definition:
The language defining symbols we are about to create are
called Regular Expressions.
The languages associated with these regular expressions are
called Regular Languages.
a* generates language
L1= {Λ, a, aa, aaa, aaaa…}
a+ generates language
L2={a, aa, aaa, aaaa, …}
So,
The languages L1 & L2 can be expressed as a*, a+ respectively
and are called Regular expressions (RE’s).
Automata Theory Ms Shaista Shabbir TOA UOKAJK 4
More Examples
a+ = { }
aa* = { }
a*a = { }
a* = { }
Does they define the same language ???????
Automata Theory Ms Shaista Shabbir TOA UOKAJK 5
Recursive Definition of Regular Expression
Important
We now introduce another use for the plus ‘+’ sign. By
The expression x+y where x & y are strings of
characters from an alphabet, we mean “either x or y”.
This means that x+y offers a choice, much the same
way that x*.
E = [aa+bb+(ab+ba)(aa+bb)*(ab+ba)]*
Finite Languages
Now consider a finite language L over Σ = {a, b},
“all the strings of a’s and b’s of length exactly three.”
L = {aaa aab aba abb baa bab bba bbb}
So what would be the Regular expression ?
Definition
Two regular expressions are said to be equivalent if they
generate the same language.
Example
Consider the following regular expressions
r1 = (a + b)* (aa + bb)
r2 = (a + b)*aa + ( a + b)*bb then both regular expressions define the
language of strings ending in aa or bb.
then
aa*=a+
a* = (a*)*
(a+b)* = a*b*
(a+b)* = (a*b*)*
(a+b)* = (a+b)* + (a+b)*
(a+b)* = (a+b)* (a+b)*
(a+b)* = a (a+b)*+b (a+b)* + Λ
(a+b)* = (a+b)*ab (a+b)* + b*a*
Automata Theory Ms Shaista Shabbir TOA UOKAJK 20
Regular Languages