Prove that the languages are not context free?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 04:27:12

问题


How can I prove the following language is not context-free? Any help will be appreciated. Thank you. L = {0^n| n is a prime}


回答1:


The proof is by contradiction. Assume the language is context-free. Then, by the pumping lemma for context-free languages, any string in L can be written as uvxyz where |vxy| < p, |vy| > 0 and for all natural numbers k, u(v^k)x(y^k)z is in the language as well. Choose 0^m where m is any prime > p. Then we must be able to write 0^m as uvxyz so that |vy| > 0. Let |vy| = r. Then 0^(m-r+kr) must be prime for any natural number k. However, choosing k=m+1 gives m-r+(m+1)r = m - r + mr + r = m(1 + r) which cannot be prime, a contradiction. Therefore, our assumption that the language is context-free is disproven.



来源:https://stackoverflow.com/questions/52954769/prove-that-the-languages-are-not-context-free

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