Let B be the language {0n1n | n >= 0} i.e. 0 and 1 has to have the same length
Let s in B be the string 0p1p
Assume B is regular so s must be divisible to s = xyz where xyiz i>=0 is still in B (Condition 1 of three conditions of pumping lemma).
Consider the case xyiz where i = 2 so xyyz: Pump y with all 0s
xyyz has more 0s and 1s so it cannot be in B. Therefore, B is not regular.
I am having a hard time understanding that if y is all 0s in xyyz, then # of 0s > # of 1s
Why can't |xyy| = |z| which then it would have the same # of 0s and 1s?
'Pump y with all 0s' isn't terribly clear, but an example of how this works out is as follows:
Now, since we assume B is regular, we know that - for any value of i - the string formed by xyiz should also be in B! Let's try xyyz, like you suggest.
...Uh-oh. You see the problem? We have to hold y constant, but doing so means we just made a string that has one more 0 than s, but doesn't have an extra 1 to go with it! We just showed that y can't be 0. Well, darn.
Now consider: is there any value of y for which this won't hold true? Adding 0s to y will only make the issue worse!
This is a very informal walkthrough of the proof, but hopefully it helps understand why it works.