Search code examples
regular-languagefsm

Why is {a^n a^n | n >= 0} regular?


I understand the reason and the proof why {a^n b^n | n >= 0} is NOT regular. Why is {a^nb^n | n >= 0} not regular?

The solution of one of my exercises is: {a^n a^n | n >= 0} is regular. How can I prove this thesis?


Solution

  • Yes, Language {an an | n >= 0} is a regular language. To proof that certain language is regular, you can draw its dfa/regular expression. And you can drive do for this language as follows:

    Because "anan for n >= 0" is same as "a2n for n >=0", and that is "set of all string contests of even number of symbol a" that is regular — regular expression for this is (aa)*.

    Note, regular expressions is only possible for regular languages hence it is proved that {an an | n >= 0} is a regular language. and DFA would be:

    dfa

    I would suggest you to read this why languages like {an bn | n >= 0} are not regular.