Let $f:A\to B$ be a function with $A_i\subset A, i=0,1$. I want to understand the precise logic behind the need for injectivity for $f(A_0\setminus A_1)=f(A_0)\setminus f(A_1)$ to be true.
First we prove $f(A_0)\setminus f(A_1)\subset f(A_0\setminus A_1)$ since this direction does not require injectivity:
Let $b\in f(A_0)\setminus f(A_1)$. This is equivalent to $b\in f(A_0)$ and $b\notin f(A_1)\iff f^{-1}(b)\in A_0$ and $f^{-1}(b)\notin A_1$. The latter implies, but is not equivalent to, $f^{-1}(b)\in(A_0\setminus A_1)\iff b\in f(A_0\setminus A_1).$ Thus $f(A_0)\setminus f(A_1)\subset f(A_0\setminus A_1)$.
Note here $f^{-1}(b)$ does not refer to a necessarily unique element, just an $a\in A$ such that $f(a)=b$. So therefore $f^{-1}(b)\in A_0$ and $f^{-1}(b)\notin A_1$ only implies $f^{-1}(b)\in(A_0\setminus A_1)$ since if $f^{-1}(b)\in(A_0\setminus A_1)$ were to imply $f^{-1}(b)\in A_0$ and $f^{-1}(b)\notin A_1$ we would find in case $f(a_0)=f(a_1)=b$ with $A_0=\{a_0\}, A_1=\{a_1\}$ that $$a_0=f^{-1}(b)\in(A_0\setminus A_1)\implies a_1=f^{-1}(b)\in A_0 \text{ and } a_1=f^{-1}(b)\notin A_1$$ which is false.
Now we prove $f(A_0\setminus A_1)\subset f(A_0)\setminus f(A_1)$ if $f$ is injective:
Let $b\in f(A_0\setminus A_1).$ This is equivalent to $f^{-1}(b)\in (A_0\setminus A_1).$ But since $f$ is injective, the latter $f^{-1}(b)\in (A_0\setminus A_1)$ is equivalent to $f^{-1}(b)\in A_0$ and $f^{-1}(b)\notin A_1$ since $f^{-1}(b)$ is the unique $a\in A$ such that $f(a)=b.$ So we then have $b\in f(A_0)$ and $b\notin f(A_1)$, or $b\in f(A_0)\setminus f(A_1).$ Thus $f(A_0\setminus A_1)\subset f(A_0)\setminus f(A_1)$.
So I guess my question is, is my invocation of injection for a unique $a$ really "enough" per se without that middle explanatory paragraph, or should I be do something like Robert Cardona does here to more directly use the injectivity condition? I use the exact same minimal justification of uniqueness of the inverse in my proof of $f(A_0\cap A_1)=f(A_0)\cap f(A_1)$ too so I'm wanting to get this right.
The thing that's interesting is that injectivity turns $f^{-1}(b)$ into an element, whereas generally for non injective functions $f^{-1}(b)$ denotes a set. So therefore, you can do regular set theory containment without worrying about quantifiers when $f$ is injective.