0

I'm trying to prove that L={y#x|(y is a substring of x) ∧x,y∈{a,b}^* } is not context free using the pumping lemma, but I can't seem to do that. If

|vy|≠ε ,|vxy|≤k , uv^n xy^n z∈L ,∀n≥0

Then either vxy has both a and b, or only b or only a.

How can I pump it in order to show that?

Jason Orendorff
  • 42,793
  • 6
  • 62
  • 96
JAN
  • 21,236
  • 66
  • 181
  • 318
  • Isn't the pumping lemma only useful for showing a language *isn't* context free? ie: Even if it satisfies the conditions, it might still not be? – cHao Jun 13 '12 at 05:02
  • 2
    This is off topic for SO. It belongs on http://cstheory.stackexchange.com. – andand Jun 13 '12 at 05:06
  • @andand No, it does not; [cstheory.SE] is only for *research level* TCS. This belongs to [cs.SE] which has in fact a good [reference question](http://cs.stackexchange.com/questions/265/how-to-prove-that-a-language-is-not-context-free) on the matter. – Raphael Apr 02 '13 at 15:57

1 Answers1

-2

I agree with cHao, use the pumping lemma to show that a language isn't Context Free. To prove that a language is context free build a Context Free grammar or a DFA.

{y#x | y is a subset of x} over the alphabet {a, b}* does not appear to be context free just with a quick look.

Let s = (a|b)^p#(a|b)^(2p) so this is the string where p characters precede the # and 2p after to make this an easy subset.

We now need to decompose this string into x y^i z parts where |y| > 0 and |xy| = p. So the y must be made of any string of characters before the #. We can "pump up" this string now s.t. the first string before the # is larger than the second. This is no longer a subset of the second half. This is a contradiction so this language is not context free.

Dustin D
  • 15
  • 5
  • The pumping lemma you use is for regular languages. The pumping lemma for context-free languages would involve a decomposition into `uvxyz`, where both `v` and `y` would be pumped. As presented, the form of the above proof would be applicable to other non-regular, context free languages, "proving" them to be non-context-free. Try it with `a^nb^n`, taking `s=a^pb^p`. Also, `|xy| ≤ p` in the regular version, and `vxy ≤ p` in the context-free version. – outis May 12 '13 at 03:53