You are on page 1of 4

TOC-Assignment #2

Name: DISHANT GOYAL


Roll No. : UG201310013
1.
a)
Soln. Let L = {wwR | w {a + b}*}.

Let us assume
p that
p L is regular. Let p be the length specified by the pumping lemma.
Let s be the string a bba . s is a member of L and |w| p. Therefore, the pumping
lemma
k
states that s can be subdivided, s = xyz, such that |xy| p, |y| 1, and xy z L for all k
0.
p

Since |xy| p, any selection of xy must fall within the a prefix of w.


k
This means y consists of one or more as. Thus, pumping the string xy z
for any k > 1 produces a string with more as before the bb portion of w
p+|y|
p
than after it. For example, if k = 2, the resulting string is a
bba . This
string is not in L, which violates our assumption that L is regular.
This contradiction shows that L is not regular.
b)
Soln. Let L = {w | w {a + b}*}.

Let us assume that L isp regular.


Let p be the length specified by the pumping
p
lemma. Let s be the string ba bab a. s is a member of L and |w| p. Therefore, the
pumping
k lemma states that s can be subdivided, s = xyz, such that |xy| p, |y| 1,
and xy z L for all k 0.
p

Since |xy| p, any selection of xy must fall within the ba prefix of


w. This means y consists of one or more as. Thus, pumping the string
k
xy z for any k > 1 produces a string with more as before the bb portion of
p+|y|
w than bs after it. For example, if k = 2, the resulting string is ba
p
bab a. This string is not in L, which violates our assumption that L is
regular.
This contradiction shows that L is not regular.
c)
n!
Soln. Let L = {w|w = a , n 1}.
Let us assume that the language L is regular and that the pumping length is p.
p!
Then choose the string w = a . Then the pumping lemma tells us that we can write
this as xyz with the three conditions satisfied. The condition that y is not the empty
j
string and |xy| p, implies that y must be a where j {1, 2, . . . , n}. The pumping
2
2
p!+j
lemma says that then xy z should be in C. But xy z = a
. But if we add 1 to p to p!,
we do not get another number which is a factorial. Thus, it is a contradiction.

Hence, L is not regular.

2.
Soln.
Let LR be the regular language.
Now, we know that a language having finite length is always regular.
So, the finite number of words that are to be added will also
form a regular language, LF(say).
Since, regular languages are closed under union operation, therefore, LR LF is also regular.

Hence, the result follows.


3.
a)
Soln. LR = {wR | w L}

Since L is regular, it will have a finite number of equivalence


R
classes. Now in L , the strings will only get reversed, i.e., the starting
character will become the terminating character and vice-versa. So, the
partition set will also be the same. Thus, the index is also same(finite).
R
Hence, L is regular.
b)
i
Soln. Let L = {a | i is perfect square}.
Let S = {, a, aa, aaa, aaaa, . . .} is infinite over {a}. We show
k
m
k2 + k
that a and a are pair-wise distinguishable for k m. We select a
+1
k
m
as a string to be appended to a and a .
2
2
Then, akak + k + 1 = a(k+1)2 is in L, while amak + k + 1 is not in L.
k

Thus, a and a are distinguishable with respect to L. Since


k
m
a and a are arbitrary strings of S, S satisfies the conditions of
Myhill-Nerode theorem.
Hence L is non-regular.
4.
Soln.
L = *0, = {0, 1}
We construct the NFA as-

Figure 1: NFA for the given language

Now, we obtain a DFA for the NFA.


We generate all next state sets at every state, starting with q0, for
all the alphabet symbols. Then next states for all these states:
(q0, 0) = {q0,
q1} (q0, 1) =
{q0}
({q0, q1}, 0) = (q0, 0) (q1, 0) = {q0, q1}
{q2}

= {q0, q1,
q2} ({q0, q1}, 1) =
{ q0, q2} {q0, q1, q2},
0) = {q0, q1, q2} {q0,
q1, q2}, 1) = {q0, q2}
{{q0, q2}, 0) = {q0,
q1} {{q0, q2}, 1) =
{q0}
Let q0 = q0, q1 = {q0, q1}, q2 = {q0, q1, q2}, q3 = {q0, q2}.
Then the equivalent DFA is:

Figure 5: Equivalent DFA for the NFA in Fig. 1

Let us try to minimize it if possible. We start with trivial partition, with


final and non-final states in two partitions.
P0 = {I,
II};
I.

II.

I = {q0,
II = {q2,
q1};
q3}
(q0, =
(q0, 1) =
0)
q1 = I
q0
(q1, = =
(q1, =
0)
q2 II
1)
q3
(q2, = =
(q2, =
0)
q2 II
1)
q3
(q3, =
(q3, =
0)
q1 = I
1)
q0

=
I
=
II
=
II
=
I

The partition P0 is not stable, as in I q0 goes to a non-final state on 0,


while q1 goes to a final state on the same input symbol. Similarly in II,
q2 goes to a final state, while q3 goes to a final state when given 0 as
the input.
So, all the four states have to be in different partitions which mean
that none of the states can be merged and this is the smallest
minimized DFA.
Thus, by MyhillNerode theorem, index the
language L is 4. The equivalence classes are
shown below:

q0
q3

0, 1,
, 1, .*00 .*00
10, 0,
.*01

q
1

q
, 0, .*1

(*Discussed with Dhanajit Brahma)

You might also like