A proof on the existence of an injective function In La matematica della verità (p.65-66, theorem 3.5.3), Ettore Casari proves the following theorem:

$f : A \to B$ is injective iff  for all $g : C \to A, h : C \to A$ and all $C$:
$$f \circ g \equiv f \circ h \to g \equiv h$$

His proof for the right-to-left hand is unclear to me. He writes:

Consider the set C and the functions $g$ and $h$ defined as follows: C: = { z } (where $z$ is some individual), $g,h : C \to A$, $g(z) := x$ and $h(z) := y$. It follows that $f(g(z)) = f(h(z))$, i.e that $(f \circ g)\,z = (f \circ h)\,z$, and since $z$ is the only argument of $f \circ g$ and $f \circ h$, $f \circ g \equiv f \circ h$ and therefore, by hypothesis, $g \equiv h$, so that $g(z) = h(z)$ and $x = y$.

I don't understand how he argues on the basis of a very specific set $C$ and a very specific stipulation (that $g(z) := x$ and $h(z) := y$) to the claim that for any $C$, and any functions $g,h : C \to A$, it follows that $f$ is injective.
How does this proof generalise to other cases where $C$ is not the set as defined above, and $g$ and $h$ are not as defined)?
 A: We have three statments here, $P_1$, $P_2$ and $Q$ which are given by
$P_1$:= for all sets $C$ and for all $g,h:C \rightarrow A$ we have $f \circ g \equiv f \circ h \implies g \equiv h$
$P_2$:= for the set $C = \{z\}$ and for all $g,h:C \rightarrow A$ we have $f \circ g \equiv f \circ h \implies g \equiv h$
$Q$:= $f : A \rightarrow B$ is injective.
In his proof he basically proves $P_2 \implies Q$.
It is also immediate that $P_1 \implies P_2$ (check this!, this is what you are asking).
So by transitivity we have $P_1 \implies Q$, which is what we wanted.
Finally a remark about how to interpret this theorem:
As you probably know we have that a funciton is invertible iff it is bijective. Note here that invertible means left and right invertible (which is almost never mentioned) and it follows without assumption that the left and the right inverse are equal if they exist.
This theorem just tells us that a function is left invertible iff it is injective. Indeed suppose $f$ is left invertible with function $\tilde{f}$ then we can say that $f \circ g \equiv f \circ h \implies \tilde{f} \circ f \circ g \equiv \tilde{f} \circ f \circ h \implies g \equiv h$, so we can see that the statment $Q$ above implies that $f$ is left-invertible (and the converse is also true).
Similarly he will likely prove that right invertible iff it is surjective.
So, what I wnat to say is that the right hand side $Q$ seems kind of hard to interpret at first. But the idea is just that $Q$ is equivalent to $f$ being left-invertible, whis is much more intuitive in my opinion. In general, these kinds of theorems give characterisations between kinds of invertibility and properties of functions like injectiveness.
A: The hypothesis is that we are given that for any $C$ we have some condition, then prove $f$ is injective. We don't need to prove that for every $C$ with some condition, then $f$ is injective. This is why considering a singleton set is sufficient.
Since $g,h$ are functions from $C$ to $A$, we have that $g(z):=x$ and $h(z):=y$ for some elements $x,y \in A$. $f(g(z)) = f(h(z))$  comes from the fact that when proving the injectivity of some function $f$, one can assume $f(x) = f(y)$. Then as $z$ is the only argument , we must have $f \circ g \equiv f \circ h$ so that $ g \equiv h$ by hypothesis.
Thus, $g(z) = h(z)$ which means $x=y$.
