0% found this document useful (0 votes)
9 views10 pages

Lecture#05

This document discusses recursive definitions of formal languages. It provides examples of recursively defining languages over the alphabet {a,b} including: the language of strings with equal numbers of a's and b's; languages of strings ending/beginning in the same/different letters; languages with strings containing aa or bb; and a language with exactly one aa. Homework problems are assigned on recursively defining additional languages over {a,b}.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views10 pages

Lecture#05

This document discusses recursive definitions of formal languages. It provides examples of recursively defining languages over the alphabet {a,b} including: the language of strings with equal numbers of a's and b's; languages of strings ending/beginning in the same/different letters; languages with strings containing aa or bb; and a language with exactly one aa. Homework problems are assigned on recursively defining additional languages over {a,b}.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

THEORY OF AUTOMATA(CS-2208)

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 1


Overview

• Recursive Definition of Languages


• Home Task

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 2


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}

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 3


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

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 4


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

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 5


Defining the language L, of strings containing aa
or bb , defined over Σ={a, b}

Step 1:
aa and bb are in L
Step 2:
s(aa)s and s(bb)s are also in L, where s
belongs to Σ*
Step 3:
No strings except those constructed in
above, are allowed to be in L

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 6


Defining the language L, of strings containing at
least one 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

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 7


Defining the language L, of strings containing
exactly one aa, defined over Σ={a, b}

• Step 1:
aa is in L
• Step 2:
s(aa)s is also in L, where s belongs to b*
• Step 3:
No strings except those constructed in
above, are allowed to be in L

Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 8


Home Task
• Define recursive language L of strings containing
ab or ba, defined over Σ = {a, b}?

• Defining the language L, of strings beginning and


ending in different letters , defined over Σ={a, b}.

• Defining the language L, of strings starting with


b, defined over Σ={a, b}.

• Give recursive definition of language defined over


alphabet Σ = {a, b}, having all strings NOT
ENDING with aa or bb
Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 9
Introduction to computer theory, Daniel I. A. Cohen, 2nd Edition 10

You might also like