Is L = {a^n b^m | n>m} a regular or irregular language?

浪尽此生 提交于 2019-11-28 11:25:27
Grijesh Chauhan

L = {an bm | n > m} is not regular language.

Yes, the problem is tricky at first few try and deserve vote-up.

Pumping Lemma a necessary property of regular language is tool for formal proof that language is not regular language.

Formal definition: Pumping lemma for regular languages

Let L be a regular language. Then there exists an integer p ≥ 1 depending only on L such that every string w in L of length at least p (p is called the "pumping length") can be written as w = xyz (i.e., w can be divided into three sub-strings), satisfying the following conditions:

  1. |y| ≥ 1
  2. |xy| ≤ p
  3. for all i ≥ 0, xyizL

Suppose, if you choose string W = an bm where (n + m) ≥ p and n > m + 1. Choice of W is valid but this choice you are not able to show that language is not regular language. Because with this W you always have at-least one choice of y=a to pump new strings in language by repeating a for all values of i (for i =0 and i > 1).

Before I writing my solution to proof the language is not regular. Please understand following points and notice: I made bold every string w and all i in formal definition of pumping lemma above.

  • Although with Some Sufficiently large W in language you are able to generate new string in Language but NOT possible WITH ALL! There are many possible choices for W(below in my proof) with that you can't find any choice of y to generate new string in language for all i >=0. So because every Sufficiently large W not able to generate new string in language hence language is NOT regular.

read: what pumping lemma formal definition says

Proof: using pumping lemma

Step (1): Choose string W = an bm where (n + m) ≥ p and n = m + 1.

Is this choice of W is valid according to pumping lemma?

Yes, such W is in language because number of a = n > number of b =m . W is in language and sufficiently large >= p.

Step (2): Now chose a y to generate new string for all i >= 0.

And no choice is possible for y this time! Why?

First, it is essay to understand that we can't have b symbol in y because it will either generate new strings out of pattern or in resultant string total number of b will be more than total number of a symbols.

Second, we can't chose y = some a's because with i=0 you would get a new string in which number of a s will be less then number b s that is not possible in language.(remember number of a in W was just one more then b so removing any a means in resultant string N(a)=N(b) that is not acceptable because n>m)

So in we could find some W those are sufficiently large but using that we can't generate new string in language that contradict with pumping lemma property of regular language hence then language {an bm | n > m} is not a regular language indeed.

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