Prove that $L_1 = \{\, 0^m 1^k 2^n \,\vert\, \lvert m - n \rvert = k \,\}$ is not regular using Pumping lemma
For your choice of $s=0^11^12^2$, the pumping lemma might not apply. Remember, assuming that the language is regular means that there is an (unknown) integer $p$ such that the pumping lemma applies to every string of length $p$ or more. You don't know what $p$ is: if it were, say, 6 then since $|s|=4$ the PL simply wouldn't apply to your string and you could draw no conclusion.

That's why the strings chosen for pumping almost invariably involve $p$: it's there to assure that no matter what $p$ was, the pumped string would be at least $p$ characters long. For your example, you could choose $0^p1^p2^{2p}$ or $0^p1\,2^{p+1}$ or $0^p2^p$ even something like $0^{p^2}1^{2p+1}2^{(p+1)^2}$.



Here's what a PL proof of this result looks like, with some bits for you to fill in: Assume the language $L$ is regular. Choose $s=0^p1^p2^{2p}\in L$, where $p$ is the integer of the pumping lemma (why can we say the PL applies to $s$?). Then if we write $s=xyz$ as in the PL, we'll have $y=0^t$ for some $0&lt;t\le p$ (why?) and then $xy^2z\notin L$ (why?), a contradiction (why?).



The proof without the PL is an example of a more or less common idiom: using closure properties. If $L$ were regular, then $L\cap 0^*2^*$ would be also, since regular languages are closed under intersection. However
$$
L\cap 0^*2^*=\{0^n2^n\mid n\ge 0\}
$$
(since we set $k=0$ when doing the intersection) but we know that that language isn't regular, so we have a contradiction and hence $L$ must not be regular.