



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Solutions to Practice Problems
Pumping Lemma
a p 0 L and a p + k 0 L as well as a p+2k 0 L, etc.
It should be relatively clear that p + k, p + 2k, etc., cannot all be prime but let us add k p times, then we must have:
a p + pk^0 L, of course ap + pk^ = ap (k + 1)
so this would imply that (k + 1)p is prime, which it is not since it is divisible by both p and k + 1.
Hence L is not regular.
Note that the repeatable string needs to appear in the first n symbols to avoid the following situation:
assume, for the sake of argument that n = 20 and you choose the string a 10 b^11 which is of length larger than 20, but |xy| # 20 allows xy to extend past b, which means that y could contain some b’s. In such case, removing y (or adding more y’s) could lead to strings which still belong to L.
but it is not of the right form. Hence the language is not regular.
From the pumping lemma there exists an n such that every w 0 L longer than n can be represented as x y z with |y| Ö 0 and |x y| # n.
Let us choose the palindrome a ba .n^ n
Again notice that we were clever enough to choose a string which: a. has a center mark which is not a (otherwise when we remove or add y we would be left with an acceptable string) b. has a first portion on length n which is all a’s (so that when we remove or add y it will create an imbalance).
Its length is 2n + 1 $ n. Since the length of xy cannot exceed n, y must be of the form a for some k > 0. From the pumping lemma ak^ n-k^ b a nmust also be in L but it is not a palindrome.
Hence L is not regular.
us choose a bap^ p+1. Its length is 2p+2 $ p. Since the length of xy cannot exceed p, y must be of the form a m^ for some m > 0. From the pumping lemma a p-mba^ p+ must also be in L but it is not of the right form. Hence the language is not regular.
such that any string w of length greater than p has a “repeatable” substring generating more strings in the language L. Let us consider n = p! and l = (p+1)! From the pumping lemma the resulting string is of length larger than p and has a “repeatable” substring. We will assume that this substring is of length k $ 1. From the pumping lemma we can add y i-1 times for a total of i ys. If we can find an i such that the resulting number of a’s is the same as the number of b’s we have won. This means we must find i such that: m! + (i - 1)*k = (m + 1)! or (i - 1) k = (m + 1) m! - m! = m * m! or i = (m * m!) / k + 1
but since k < m we know that k must divide m! and that (m * m!) / k must be an integer. This proves that we can choose i to obtain the above equality. Hence L is not regular.
Hence i exists and the language is not regular.