100% found this document useful (1 vote)
3K views

CS402 Assignment Solution

The document provides solutions to questions about recursive definitions, regular expressions, and finite automata related to formal languages. It defines 5 recursive languages and provides the recursive definitions. It then lists 7 regular languages and their corresponding regular expressions. Finally, it gives the regular expressions and draws the finite automata for 4 of the regular languages. It also converts between regular expressions and finite automata representations for 2 languages.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views

CS402 Assignment Solution

The document provides solutions to questions about recursive definitions, regular expressions, and finite automata related to formal languages. It defines 5 recursive languages and provides the recursive definitions. It then lists 7 regular languages and their corresponding regular expressions. Finally, it gives the regular expressions and draws the finite automata for 4 of the regular languages. It also converts between regular expressions and finite automata representations for 2 languages.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment No. 01 – SOLUTION vujannat.ning.

com
Semester: Fall 2010 Best Website To Help
VU
CS402- Theory of Automata Students
Recursive definition:
Question 1: Solution:

(a) Step 1: a and b are i n language L


Step 2: a(s)or b(s) is also in language L, Where s belongs to å *

Step 3: No strings except those constructed in above, are allowed to be in L

(b) Step 1: a and b are i n Language L


Step 2: (s)b is also in language L, Where s bel ongs to å *

Step 3: No strings except those constructed in above, are allowed to be in L

(c) Step 1: a and b are i n Language L


Step 2: (s)b is also in language L, Where s bel ongs to å *

Step 3: No strings except those constructed in above, are allowed to be in L

(d) Step 1: a and b are i n Language L


Step 2: aa(s) or (s)aa(s) or (s)aa is also in language L, Where s belongs to å *

Step 3: No strings except those constructed in above, are allowed to be in L

(e) Step 1: a and b are i n Language L


Step 2: b(s)ba is also in language L, Where s belongs to å *

Step 3: No strings except those constructed in above, are allowed to be in L

Regular Expression :
Question 2: Solution:

Regular Language Regular Expression


Language having all strings starting with a or b *
a(a + b) + b(a + b)
*

Language having all strings not having ab *


b(a)
Language having all strings not having bb *
b(a) b
Language having all strings having aa *
(a + b) aa(a + b)
*

Language having all strings having bba * *


(a + b) bba(a + b)
Language having all strings not having two *
ab a
consecuti ve a’s
Language having all strings not having even no. of a’s ((a + b)(a + b)) (a + b)
*
and b’s

Finite Automata :
Question 3: Solution:

Regular Language Regular Expression Finite Automata


Language having *
a(a + b) + b(a + b)
*
all strings starting
with a or b

Language having b(a)


*
all strings not
havi ng ab
Language having *
b(a) b
all strings not
havi ng bb

Language having *
(a + b) aa(a + b)
*
all strings having aa

Language having *
(a + b) bba(a + b)
*
all strings having
bba

Language having ab a
*
all strings not
havi ng two
consecuti ve
a’s

Language having *
((a + b)(a + b)) (a + b)
all strings not
havi ng even no.
of a’s and b’s

RE to FA and FA to RE:
Question 4: Solution :

* *
(a) Language having all string s having aa [ Given in Question 2 RE = (a + b) aa(a + b) ]

FA of the gi ven language is

As we know that every FA can be consider to be a TG as well so we can Convert FA into TG with the help of G TG as

By eliminating middle state…..

So RE is (a + b)* aa(a + b)*


*
(b) La ngua ge ha ving a ll string s no t ha ving tw o con se cuti ve a ’s [ Give n in Que stion 2 RE = ab a ]

FA of the gi ven language is

As we know that every FA can be consider to be a TG as well so we can Convert FA into TG with the help of G TG as

So RE is ab*a

Just idea NOT perfect Solution


maybe having a lot no. of Mistakes

You might also like