You are on page 1of 3

Course: Theory of Automata (3452) Semester: Autumn 2020

ASSIGNMENT No. 1
¿
Q. 1 Consider the language S¿ where S ={a ,b }. How many words does this language have
of length 2? of length 3? of length n?

Ans. As we know that,


Total possible words in any language = n m
Where, m = length or power of string
n = total no. of letters in a alphabets

For Length 2: Total words in language S¿ =22=4,


For Length 3: Total words in language S¿ =23=8 ,
For Length n: Total words in language S¿ =2n

Q. 2 Give a recursive definition for the set ODD={1,3,5,7 , … }. Also Give a recursive
definition for the language S¿ where S={aa , b }.

Ans. Recursive Definition for the Language ODD

Rule 1: 1 is in ODD
Rule 2: If x is in ODD then so is x +2
Rule 3: The only elements in the set ODD are those that can be produced from the two
rules above.

Recursive Definition for the Language S¿ Where S={aa , b }

Rule 1: Lambda is in S
Rule 2: if x is in S then aax and bx are in S
Rule 3: The only elements in the set ODD are those that can be produced from the two
rules above.
Q. 3 Prove the theorem that if L is a finite language (a language with only finitely
many words), then L can be defined by a regular expression.

Ans.

Let L be a finite language.


 To make one regular expression that defines L we turn all words in L into
boldface type and insert plus signs between them.
 For example the regular expression that defines the language:
L={baa , abbba , bababa} is baa+ abbba+bababa
 This algorithm works only for finite languages because an infinite language would
become a regular expression that is infinitely long, which is forbidden.

Q. 4 Build an FA that accepts only the language of all words with b as the second letter.
Show both the picture and the transition table for this machine and find a regular expression
for the language.

Ans. Regular expression for the words with b as the second letter:
(a+ b)(a+b)¿

Transition Diagram:

State A b
Qq0 Qq1 Qq1
Qq1 Qq3 Qq2
Qq2 Qq2 Qq2
Qq3 Qq3 Qq3
Q. 5 A student walks into a classroom and sees on the blackboard a diagram of a TG with
two states that accepts only the word ˄. The student reverses the direction of exactly
one edge leaving all other edges and all labels and all +'s and -'s the same. But now the
new TG accepts the language a*. What was the original machine?

Ans. Original TG accepts only Λ

New TG
Accepts the language a*

You might also like