$ L=\{w \in \{0,1,a\}^* | \#_0(w) = \#_1(w) \}$

We show that L is not regular by pumping lemma.

We choose w=$ 0^p 1^p a$

|w| = 2p+1

Now |xy| has to be $ \leq p$

So x and y could only contain zeros. And $ z=1^p a$

$ xy^iz= 0^p 1^p a$

Now let i = 0

$ xy^0z=0^{p-|y|} 1^p a$

Now hence $ p-|y| \neq p$ this choice of i would lead to a word that is not in L. So we can not pump y and stay in the language.

So L is not regular.

I’m trying to learn the usage of the pumping lemma. Is my proof correct?

Any suggestions are welcome. Thanks!