Professional Documents
Culture Documents
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?
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 }.
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.
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.
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?
New TG
Accepts the language a*