TOA Lesson 04
TOA Lesson 04
TOA Lesson 04
1
Recap Lecture 4
2
Regular Expression
2.r1 r2
3.r1 + r2 and
4. r1*
are also regular expressions.
Step 3: Nothing else is a regular expression.
4
Defining Languages (continued)…
5
Now consider another language L,
consisting of all possible strings, defined
over Σ = {a, b}. This language can
also be expressed by the regular
expression
(a + b)*.
Now consider another language L, of
strings having exactly double a, defined
over Σ = {a, b}, then it’s regular
expression may be
b*aab*
6
Now consider another language L, of
even length, defined over Σ = {a, b},
then it’s regular expression may be
((a+b)(a+b))*
Now consider another language L, of
odd length, defined over Σ = {a, b},
then it’s regular expression may be
(a+b)((a+b)(a+b))* or
((a+b)(a+b))*(a+b)
7
Remark
8
Example:
Consider the language, defined over
Σ={a , b} of words having at least one a,
may be expressed by a regular
expression
(a+b)*a(a+b)*.
Consider the language, defined over
Σ = {a, b} of words having at least one a
and one b, may be expressed by a
regular expression
(a+b)*a(a+b)*b(a+b)*+ (a+b)*b(a+b)*a(a+b)*. 9
Consider the language, defined over
Σ={a, b}, of words starting with double
a and ending in double b then its
regular expression may be aa(a+b)*bb
Consider the language, defined over
Σ={a, b} of words starting with a and
ending in b OR starting with b and
ending in a, then its regular expression
may be a(a+b)*b+b(a+b)*a
10
TASK
11
TASK
12
SummingUP Lecture 4
13