2

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?

Community
  • 1
  • 1
antz
  • 1,031
  • 2
  • 9
  • 17

1 Answers1

2

'Pump y with all 0s' isn't terribly clear, but an example of how this works out is as follows:

Pick some value for y: let's say y = '0'.
Pick some value for i: i = 1
Then s = xyz.  We will assume this holds true for the moment.

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.

Kenogu Labz
  • 1,094
  • 1
  • 9
  • 20
  • So, with your example, lets say x = '0' and y = '0' then in xyyz, xyy = '000' why cant z be '111' (which means they are the same)? The variable x, y, z does not have to have a length of 1. – antz Oct 19 '12 at 02:18
  • Correct. BUT you've only shown that for one value of i. Your selection of x, y and z only 'fit' the language if xy^iz is in the language for all values of i >= 0. – Kenogu Labz Oct 19 '12 at 02:58