0% found this document useful (0 votes)
4 views

Lec 02- Recursive Definition.ppt

Uploaded by

2488ayesha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lec 02- Recursive Definition.ppt

Uploaded by

2488ayesha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Theory of Automata

2
3
⚫ 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.

Defining Languages Continued…


4
⚫ Defining language of INTEGER

⚫ Rule 1: 1 is in INTEGER.
⚫ Rule 2: If x is in INTEGER then x+1 and
x-1
⚫ are also in INTEGER.
⚫ Rule 3: No strings except those constructed
⚫ in above, are allowed to be in
INTEGER.

Language of Integer
⚫Defining language of EVEN
Step 1:
2 is in EVEN.
Step 2:
If x is in EVEN then x+2 and x-2 are also
in EVEN.
Step 3:
No strings except those constructed in
above, are allowed to be in EVEN.

Example
6
⚫Defining the language factorial
Step 1:
As 0!=1, so 1 is in factorial.
Step 2:
n!=n*(n-1)! is in factorial.
Step 3:
No strings except those constructed in
above, are allowed to be in factorial.

Example
7
⚫Defining the language {anbn },
n=1,2,3,… , of strings defined over
Σ={a,b}
Step 1:
ab is in {anbn}
Step 2:
if x is in {anbn}, then axb is in {anbn}
Step 3:
No strings except those constructed in
above, are allowed to be in {anbn}

8
⚫Defining the language L, of strings
ending in a , defined over Σ={a,b}
Step 1:
a is in L
Step 2:
if x is in L then s(x) is also in L, where s
belongs to Σ*
Step 3:
No strings except those constructed in
above, are allowed to be in L

9
⚫Defining the language L, of strings
beginning and ending in same letters
, defined over Σ={a, b}
Step 1:
a and b are in L
Step 2:
(a)s(a) and (b)s(b) are also in L, where s
belongs to Σ*
Step 3:
No strings except those constructed in
above, are allowed to be in L

10
⚫Defining the language L, of strings
containing exactly aa, defined over
Σ={a, b}
Step 1:
aa is in L
Step 2:
s(aa)s is also in L, where s belongs to Σ*
Step 3:
No strings except those constructed in
above, are allowed to be in L

11
⚫ Example: The language EVEN-EVEN, of
strings with even number of a’s and even
number of b’s, defined over Σ={a,b},
⚫ can be written as
⚫ {Λ, aa, bb, aaaa, aabb, abab, abba, baab,
baba, bbaa, bbbb,…}
⚫ Example: The language INTEGER, of
strings defined over
Σ={-,0,1,2,3,4,5,6,7,8,9}, can be written
as
⚫ INTEGER = {…,-2,-1,0,1,2,…}
⚫ Even-Even langage

⚫ Step 1: 2 is in EVEN. Theory of Automata

⚫ Step 2: If x is in EVEN then x+2 and x-2


are also in EVEN.

⚫ Step 3: No strings except those


constructed in above, are allowed to be in
EVEN.
⚫ Useful operators used in the regular
expression are as follows:
⚫ * = 0 or more
⚫ + = 1 or more
⚫ a|b = a or b
⚫ (a|b)* = (a or b) 0 or more times
⚫ (a|b)+ = (a or b) 1 or more times
⚫ a|b* = a or b (only b 0 or more times)
⚫ (a|b)*(c|Λ) = (a or b) 0 or more times
and c or Null string
⚫ Useful Reading

Third chapter of Daniel I. Cohen book.

15

You might also like