Lesson 03
Lesson 03
Lesson 03
Theory Of Automata
1
Defining Languages
Continued…
Recursive definition of languages
The following three steps are used in recursive
definition
1. Some basic words are specified in the language.
2. Rules for constructing more words are defined in the
language.
3. No strings except those constructed in above, are
allowed to be in the language.
2
Example
3
Example
4
Example
5
Example
6
Example
7
Example
8
Example
9
Example
10
Example
11
Regular Expression
12
Recursive definition of
Regular Expression(RE)
Step 1: Every letter of Σ including Λ is a regular
expression.
13
Defining Languages
(continued)…
Method 3 (Regular Expressions)
Consider the language L = {Λ, x, xx, xxx,…} of
strings, defined over Σ = {x}.
We can write this language as the Kleene star
closure of alphabet Σ or L = Σ* = {x}*
this language can also be expressed by the regular
expression x*.
Similarly the language L = {x, xx, xxx,…}, defined
over Σ = {x}, can be expressed by the regular
expression x+.
14
Example
15
Example
17
Example
18
Example
19
TASK
a(a+b)*
(a+b)+a(a+b)*a+b(a+b)*b
20
TASK
21
An important example
(aa+bb+(ab+ba)(aa+bb)*(ab+ba))*
22
Note
r1=a*+b*
r2=(a+b)*
Here r1 does not generate any string of concatenation
of a and b, while r2 generates such strings.
23
Equivalent Regular
Expressions
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.
24
Note
1. r1 + r2 = (aa + bb) + (a + b)
25
Regular Languages
Definition:
The language generated by any regular expression
is called a regular language.
It is to be noted that 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.
26
Note
27
Example
28
All finite languages are
regular.
Example:
Consider the language L, defined over Σ={a,b}, of strings
of length 2, starting with a, then
29
Note
30