Theory of computation - Using the pumping lemma for context free languages
I'm reviewing my notes for my course on theory of computation and I'm having trouble understanding how to complete a certain proof. Here is the question:
A = {0^n 1^m 0^n | n>=1, m>=1} Prove that A is not regular.
It's pretty obvious that the pumping lemma has to be used for this. So, we have
- |vy| >= 1
- |vxy| <= p (p being the pumping length, >= 1)
- uv^ixy^iz exists in A for all i >= 0
Trying to think of the correct string to choose seems a bit iffy for this. I was thinking 0^p 1^q 0^p, but I don't know if I can obscurely make a q, and since there is no bound on u, this could开发者_开发百科 make things unruly..
So, how would one go about this?
It'll be much simpler if you use the definition of the pumping lemma applying to regular languages, not the one applying to CFGs. The three conditions that any regular string s = xyz must have are:
- For each i >= 0, xy^iz is in A
- |y| >= 0
- |xy| <= p
Try using 0^p1^q0^p again using these three conditions.
Hint: Because we have 0^p, y will only consist of 0's. Therefore, when we "pump in" more y's (consider xyyz), we will not get a string in the language.
You're using the wrong pumping lemma... A is context-free here, but it is not regular.
http://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages
That should show you the lemma you need... If you start with that, you might come up with an answer. If not, let me know and I'll edit my answer to give you a few hints.
I would solve it without the lemma: - Consider h(a) where h(1)=1 h(2)=0 h(0)=0. Applying h^-1 on your language and then intersection with 0^*1^2^ give you the language 0^n1^m2^n. - Now use h'(a) where h'(0)=a, h'(1)=epsilon, h'(2)=b. You get a^nb^n which is not regular.
Why is this easier? Because after learning this basic tricks you can very easily solve this problems.
As for the lemma: - You will need that any substring of a word in A when used as the substring ruins you language. There are 6 cases which I can see (Only 0s from the start, 0s from the start folllowed by 1, etc...)
As other already added, you don't need the CF-lemma. The CF-lemma is used to show a language is not CF usually.
精彩评论