Any string in this language with at least three characters in it has this property: either the string has a "1
" in it, or there are three "0
"s in a row.
If the string contains a 1
, then you can split it as in the pumping lemma and set y equal to some 1
in the string. Then obviously the strings xyz, xyyz, xyyyz, etc. are all in the language because all those strings have the same number of zeros.
If the string does not contain a 1
, it contains three 0
s in a row. Setting y to those three 0
s, it should be obvious that xyz, xyyz, xyyyz, etc. are all in the language because you're adding three 0
characters each time, so you always have a number of 0
s divisible by 3.
@justhalf in the comments is perfectly correct; the pumping lemma can be used to prove that a regular language can be pumped or that a language that cannot be pumped is not regular, but you cannot use the pumping lemma to prove that a language is regular in the first place. Mea Culpa.
Instead, here's a proof that the given language is regular based on the Myhill-Nerode Theorem:
Consider the set of all strings of 0
s and 1
s. Divide these strings into three sets:
E0, all strings such that the number of 0
s is a multiple of three,
E1, all strings such that the number of 0
s is one more than a multiple of three,
E2, all strings such that the number of 0
s is two more than a multiple of three.
Obviously, every string of 0
s and 1
s is in one of these three sets.
Furthermore, if x and z are both strings of 0
s and 1
s, then consider what it means if the concatenation xz is in L:
If x is in E0, then xz is in L if and only if z is in E0
If x is in E1, then xz is in L if and only if z is in E2
If x is in E2, then xz is in L if and only if z is in E1
Therefore, in the language of the theorem, there is no distinguishing extension for any two strings in the same one of our three Ei sets, and therefore there are at most three equivalence classes. A finite number of equivalence classes means the language is regular.
(in fact, there are exactly three equivalence classes, but that isn't needed)