# How is this proof that monomorphisms in $\bf Set$ are injective sufficiently general

category-theoryelementary-set-theoryfunctionsproof-explanation

An arrow $$\phi:A\to B$$ in a category is monic if and only if for any object $$X$$ and all arrows $$x,y:X\to A$$ it follows that $$\phi\circ x=\phi\circ y \implies x=y$$.

As follows is the proof I have seen in multiple sources that the monomorphisms in the category of sets are injective. I am struggling with the generality of the portion following “(?).”

Proof. Let $$\phi:A\rightarrowtail B$$ be a monomorphism in $$\bf Set$$.
If $$A$$ has one element, the result is apparent; hence presume $$a_1,a_2\in A$$ with $$a_1\neq a_2$$. We aim to show that it follows that $$\phi(a_1)\neq\phi(a_2)$$, by definition of injection.

(?) Considering a singleton $$\{e\}=X$$, define the arrows $$x:X\to A:e\mapsto a_1$$ and $$y:X\to A:e\mapsto a_2$$.

By design $$x\neq y$$, so $$\phi\circ x\neq\phi\circ y$$ since $$\phi$$ is monic. These composite functions must be unequal at the only point in their domain:
\begin{align} \phi\circ x(e) &\neq \phi\circ y(e) \\ \phi(a_1) &\neq \phi(a_2) \tag*{\blacksquare} \end{align}

This proof does not appear valid for all arrows in $$\bf Set$$ with target $$A$$. Rather, it seems specific to functions with a singleton domain.

Could someone please explain how this proof is sufficiently general?

You aren't trying to prove anything for all objects $$X.$$ You're trying to prove that $$\phi(a_1)\ne \phi(a_2)$$ when $$a_1\ne a_2,$$ using the assumption that for all objects $$X$$ and all functions $$x,y:X\to A,$$ $$\phi\circ x=\phi\circ y\implies x=y.$$ In particular, this assumption holds when $$X=\{e\},$$ which is all that is needed for the result. The converse of your theorem is thus the harder direction.