There is this proof that I thought of that I am not quite sure if it's valid or not.
Suppose you had to prove the nonregularity of the following language:
A = { 0^n 1^n 2^n | n>= 0 }
The proof I devised picks a string that belongs in the language, such as 012, and show that it doesn't matter how it's divided, the pumping lemma is not wholly satisfied(I could post the entire proof, but the post is verbose as it is). According to my professor however, this proof cannot be accepted.
He did not explain why, and I don't see how such a proof would be insufficent to demonstrate that a language is not regular. If a string clearly belonging to an assumed regular language does not satisfy the pumping lemma, the language clearly has strings that are not regular as part of it set of strings, therefore the language is not regular.
I believe the reason my professor rejected this proof is because in the majority of problems the pumping length P cannot be correctly guessed. At the same time I do not see how my proof could be proven wrong with a counterexample.
You can only choose p
(the pumping length) to be a specific number if the language is regular and p
actually exists. The fact itself, that you pick an exact number, means that p
exists, which is the thing to be actually proven.
Suppose that p
exists. Lets choose a word, that is long enough: w=0^{p}1^{p}2^{p}
. According to the pumping lemma there must exist a decomposition of each string in language A
as w=xyz
with |xy|≤p
and |y|≥1
such that xy^{i}z
in language A
for every i≥0
. To satisfy |xy|≤p
choose x
to be empty, y=0^{p}
, and as a consequence z=1^{p}2^{p}
. From the lemma, |y|≥1
so |xy|≥1
. The strings with i≠1
(in xy^{i}z
) are not in the language A
. The language is thus not regular, and p
does not exist.
If p
existed then a finite state automaton could be constructed for this language. But no such automaton exists, because it would need memory to remember the number of 0
to later match the same number of 1
and 2
. If n
was a finite number, then you could construct, a probably large, automaton, but for infinite n
no finite automaton can be constructed.
This language is not even context-free, because there is no push-down automaton that can be constructed for it. It is context-sensitive.