You are on page 1of 5

Assignment 1 solutions

Consider the language PALINDROME over the alphabet a, b}. Prove that iI x is in
PALINDROME, then so is x
n
Ior any n.
ProoI: it is true Ior n 0 by assumption x
n
is in palindrome.
Assume that it is true Ior n-1, namely, x
n-1
is in palindrome and (x
n-1
)
R
x
n-1

We know that (xy)
R
y
R
x
R
.
(x
n
)
R
(x
n-1
x)
R
x
R
(x
n-1
)
R
xx
n-1
x
n
ThereIore, x
n
is in palindrome.
2. Prove that Ior all sets, S, (S

.
S

(S

)
1
(S

For all w (S

, w w
1
.w
n
where w
i
S

and w
i
w
i1
. w
im
Ior i 1, ., n, where
w
ij
S. ThereIore, w S

. So (S

.
3. Give two recursive deIinitions Ior the set
POWER-OF-TWO 1, 2, 4, 8, 16, ..}
Use one oI them to prove that the product oI two POWER-OF-TWO is also a
POWER-OF-TWO.
DeIinition 1:
1 is a POWERS-OF-TWO
II x is a POWERS-OF-TWO, then 2*x is also a POWERS-OF-TWO.
DeIinition 2:
1 and 2 are POWERS-OF-TWOs.
II x and y are POWERS-OF-TWOs, then x*y is a POWERS-OF-TWO.
4. Give recursive deIinitions Ior the Iollowing languages over the alphabet a, b}:
a. The language EVENSTRING oI all words oI even length
b. The language NOTAA oI all words not containing the substring aa.
a. is a string in EVENSTRING.
II x is a string in EVENSTRING, then xaa, xab, xba, and xbb are strings in
EVENSTRING.
b , a, and b are strings in NOTAA.
II x is in NOTAA, then xb and xba are in NOTAA.
5. Build a DFA that accepts only the language oI all words with as the second letter.
a,b b
a
a,b
a,b
6. Build a DFA that accepts only the words , , and and no other strings.
a b b
b
a a b a a, b
a b
a,b
7. Build a DFA that accepts only those words that do not end with .
a b
b
a
a b
8. Build a DFA that accepts only those words that begin or end with a double letter.
b
a
a,b a b b
a a b
b
b a a
b
a
9. Build a DFA that accepts only those words that have an even number oI substrings
.
a
b
a
b b
a
b
a
10. Describe in English the languages accepted by the Iollowings DFAs:
b a
i.
a,b a,b
(i). Even length words ending with a.
a,b
ii.
a,b
a
a,b
b
(ii). Even length words ending with a.
iii. a, b
a, b a
a
b b
a, b
(iii). all words with even lengths and in which each b is separated by some a`s and a
occupies all even positions.
11. Construct an NFA that accepts the set oI binary strings with at least two occurrences
oI substring 01 and ends with 11.
1 0 1 0,1
0 1 0 1
1
12. Convert each oI the Iollowing NFAs into DFAs.
i.
b
a, b
a b
b
a
ii.
a
b
a
a b
a
b a,b
a,b

You might also like