Document

4.1.2
Prove that the following are not regular languages.
There are a couple of different strategies you could use
for these problems. I’m using the simplest and most
straightforward approach in these answers.
(b)
{0n | n is a perfect cube}
We’ll play the “adversarial game” version of the Pumping
Lemma.
(1) We have already “picked” the language L to be
proved nonregular. L = {0n | n is a perfect cube}.
(2) Our opponent picks some n but does not reveal it.
We proceed by using a strategy that is independent
of any particular n.
(3) We pick a string w that suits our purposes. Let w =
0 n , n-cubed zeros, a perfect cube. Its length is indeed
longer than n and w is in L because n3 is a perfect
cube.
3
†
(4) Our opponent divides w into x, y, and z, with y
containing at least one letter, and the length of xy less
than or equal to n. Our opponent does not reveal x,
y, or z, so we must proceed by using a strategy that
does not rely on any particular division of w.
(5) We observe that if k = 2, and we consider xykz, this
string is not in L, regardless of the division of w into
substrings. y is non-empty so it contains at least one
0, and at most n by the constraint that the length of
xy is less than n. xyz contains a number of zeros that
is a perfect cube.
By doubling y, we add some zeros. How many?
1 £ y £ n,
therefore 2 £ y2 £ 2n , and thus the length of
the new string is now l letters longer, 1 £ l £ n.
†
Now, can the†new length be a perfect cube as well?
We need to show it can never be† a perfect cube. If
there is any possibility that the new length is a
perfect cube, we lose the game; we have failed to
show that the set L is nonregular.
But, in fact, the new length cannot be a perfect cube.
In fact, it will not increase enough to even get to the
next perfect cube after n3, which is (n + 1)3. Why is
this?
(n + 1)3 = (n + 1)(n + 1)2 = (n + 1)(n2 + 2n + 1) = n3 + 2n2 + n + n2 + 2n + 1
= n3 + 3n2 + 3n + 1
†
†
(e)
To get to the next perfect cube, we’d have to add
3n2 + 3n + 1 . But we’ve only added at most n. So we
won’t make it. Furthermore, we have added letters,
not subtracted them. And we have added at least
one letter, so we are no longer sitting at n3. Thus,
xy2z cannot have a length which is a perfect cube,
and thus cannot be in L. Because our modification
took a string in L and found a string that was not in
L, L is not regular. We win.
The set of strings of 0’s and 1’s whose length is a perfect square.
I take this to mean strings over the alphabet {0, 1}. Thus, a
string of all zeros whose length is a perfect square would be in the
set.
If you got this question wrong but have now read the proof
of the previous part, then now would be a good time to try this
problem without looking at the answer so that you can compare
your answer with the one below. The proofs are very similar.
We’ll again play the “adversarial game” version of the
Pumping Lemma.
(1) L = The set of strings of 0’s and 1’s whose length is a
perfect square.
(2) Our opponent picks some n but does not reveal it.
We proceed by using a strategy that is independent
of any particular n.
(3) We pick a string w that suits our purposes. Let w =
0 n , n-squared zeros, a perfect square. Its length is
indeed longer than n and w is in L because n2 is a
perfect square. Notice that w need not contain any
1’s at all, just as long as w is still in L. It turns out that
we don’t need the ones to prove that L is nonregular,
so there’s no need to make it more confusing by
putting them in.
2
†
(4) Our opponent divides w into x, y, and z, with y
containing at least one letter, and the length of xy less
than or equal to n. Our opponent does not reveal x,
y, or z, so we must proceed by using a strategy that
does not rely on any particular division of w.
(5) We observe that if k = 2, and we consider xykz, this
string is not in L, regardless of the division of w into
substrings. y is non-empty so it contains at least one
0, and at most n by the constraint that the length of
xy is less than n. xyz contains a number of zeros that
is a perfect square.
By doubling y, we add some zeros. How many?
1 £ y £ n,
therefore 2 £ y2 £ 2n , and thus the length of
the new string is now l letters longer, 1 £ l £ n.
†
Now, can the†new length be a perfect square as well?
We need to show it can never be† a perfect square.
In fact, the length will not increase enough to even
get to the next perfect square after n2, which is (n +
1)2.
(n + 1)2 = n2 + 2n + 1
†
†
To get to the next perfect square, we’d have to add
2n + 1. But we’ve only added at most n. So we won’t
make it. Furthermore, we have added letters, not
subtracted them. And we have added at least one
letter, so we are no longer sitting at n2. Thus, xy2z
cannot have a length which is a perfect square, and
thus cannot be in L. Because our modification took a
string in L and found a string that was not in L, L is
not regular. We win.