GATE Computer ScienceHardGATE CS (PYQ pattern)

To prove by the pumping lemma for context-free languages that L = { w w : w ∈ {a, b}* } is not context-free, which string (p is the pumping length) gives a valid contradiction?

  1. A. aᵖbaᵖb
  2. B. (ab)ᵖ(ab)ᵖ
  3. C. a²ᵖ
  4. D. aᵖbᵖaᵖbᵖ

Correct answer: D. aᵖbᵖaᵖbᵖ

Any window vxy of length ≤ p in aᵖbᵖaᵖbᵖ lies within two adjacent blocks, and pumping breaks the ww structure. With aᵖbaᵖb the window can contain the last a of the first half and the first a of the second half, so pumping both keeps the string of the form ww; (ab)²ᵖ and a²ᵖ are in L but can be pumped inside.

More Theory of Computation questions

Exams that ask this topic