-1

Using the pumping lemma, we can prove that {a^nb^n | n >= 0}, but what is not clear is the following.

{a^n | n >= 0} is regular by itself and so is {b^n | n >= 0}, and if I am not mistaken, regular languages are closed under concatenation, so why doesn't {a^nb^n | n >= 0} follow this rule?

user19187727
  • 169
  • 9
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see which questions are on-topic on this site. You might want to delete this question and ask it on https://cs.stackexchange.com/ instead, but check the help pages there first. – Progman Oct 02 '22 at 16:09

1 Answers1

1

The n in {a^n | n >= 0} is not the same as the n in {b^n | n >= 0}. After concatenating them you get {a^jb^k | j,k >= 0} that is regular. It is not the same as {a^nb^n | n >= 0} (or to say {a^jb^k | j,k >= 0; j=k}) where the repetitions of a and b are the same number.

Nikolay Handzhiyski
  • 1,360
  • 1
  • 6
  • 20