Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

computer science - Why is {a^nb^n | n >= 0} not regular?

In a CS course I'm taking there is an example of a language that is not regular:

{a^nb^n | n >= 0}

I can understand that it is not regular since no Finite State Automaton/Machine can be written that validates and accepts this input since it lacks a memory component. (Please correct me if I'm wrong)

The wikipedia entry on Regular Language also lists this example, but does not provide a (mathematical) proof why it is not regular.

Can anyone enlighten me on this and provide proof for this, or point me too a good resource?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What you're looking for is Pumping lemma for regular languages.

Here is an example with your exact problem:

Examples:
Let L = {ambm | m ≥ 1}.
Then L is not regular.
Proof: Let n be as in Pumping Lemma.
Let w = anbn.
Let w = xyz be as in Pumping Lemma.
Thus, xy2z ∈ L, however, xy2z contains more a’s than b’s.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...