2

I was shown this at university lecture as a optional challenge problem but have no idea how to work it out.

Let L be the language L = {apbqapbq : p,q >= 0}. Is this language context-free? Either give a context-free grammar for it or prove that it is not context-free.

I know that L = {apbp:p >= 1} is a context free language but the language in the question uses 2 variables and could also equal 0, making me think that it's not context free.

Should I be using pumping lemma? Any help and explanations would be appreciated

  • It's not. Yes you can prove this with the pumping lemma for context free languages. See the proof for a^n b^n c^n in https://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages. The proof here is very similar. Use s = a^p b^p a^p b^p. It's not hard to show that this choice always allows pumping to generate a string not in L. I'll let you have the fun of working out the details. – Gene Apr 06 '17 at 02:18
  • Thank you for the pointer, it was very helpful! – TweezerCube Apr 06 '17 at 21:04

0 Answers0