This isn't a programming question, but I don't know of any good places on the Internets to ask computer science questions. Sorry if this is too off-topic.
I'm reviewing some old CS material and I'm stuck on the following:
Let L = { x in {a,b}* | x has an equal number of a's and b's}
I know this is a context free language because I can create a grammar for it (e is epsilon):
S -> aX | bY | e
X -> bS | aXX
Y -> aS | bYY
You can also prove it is context free by using the fact that a context free language intersected with a regular language is context free.
Since it is a context free language, according to the pumping lemma for CFL's, any string longer than the pumping length p should be able to be pumped. However, if I choose the string s = a^p b^p a^p b^p, this string cannot be pumped, so the language should not be context free.
Where am I going wrong?