Theory of computation - Using the pumping lemma for context free languages

房东的猫 提交于 2019-12-11 14:18:18

问题


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

  1. |vy| >= 1
  2. |vxy| <= p (p being the pumping length, >= 1)
  3. 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?


回答1:


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:

  1. For each i >= 0, xy^iz is in A
  2. |y| >= 0
  3. |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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2617675/theory-of-computation-using-the-pumping-lemma-for-context-free-languages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!