Categorial explanation for why subsets of $X$ can be described by functions $X \rightarrow X \sqcup X.$ If $X$ is a set, then subsets of $X$ are the same thing as functions $X \rightarrow X \sqcup X$ that are sections of the codiagonal map $\nabla_X : X \sqcup X \rightarrow X.$ Just go "up" if it's in the subset, and "down" otherwise.

Question. Is there a slick categorial description of this correspondence? What I mean is:
  
  
*
  
*If $m:A \rightarrow X$ is a monomorphism, is there a straightforward diagrammatic way to see that we get a corresponding function $X \rightarrow X \sqcup X$?
  
*If we have a function $X \sqcup X \rightarrow X$ that is a section of the codiagonal, is there a straightforward diagrammatic way to see that, up to isomorphism, we get a corresponding object of the category $\mathrm{Sub}(X)$?

This doesn't work in $\mathbf{Ab}$ (for example), so we'll need a few assumptions on our ambient category. Perhaps this correspondence holds in any boolean category with finite coproducts?
 A: Let $\mathcal{C}$ be a category with equalisers and coproducts. For each morphism $f:X\to X+X$ such that $\nabla_X f = 1_X$ the equaliser $m: A\to X$ of $f,i_1:X\to X+X$ is a subject of $X$. Writing $H(X)=\{f \in \hom(X,X+X)\,|\, \nabla_X f=1_X\}$ we have a map $\phi: H(X) \to \text{Sub}(X)$.
When $\mathcal{C}$ is in addition boolean then there is a map $\theta: \text{Sub}(X) \to  H(X)$ defined as follows. Given a monomorphism $m :A \to X$ by assumption there is a monomorphism $n:B\to X$ such that $X$ together with $m$ and $n$ is a coproduct and $A\cap B$ is initial. According to the universal property we obtain a morphism $f : X\to X+X$ making the diagram 
$$\require{AMScd} \begin{CD}
    A @>{m}>> X @<{n}<<  B\\ @V{m}VV @VV{f}V @VV{n}V\\
    X @>>{i_1}> X+X @<<{i_2}< X\\ @V{1_X}VV @VV{\nabla_X}V @VV{1_X}V\\
    X @>>{1_X}> X @<<{1_X}< X
\end{CD}$$
commute. The universal property of the coproduct then shows that the composite $\nabla_X f =1_X$.
The two maps are inverse to each other when in addition $\mathcal{C}$ is extensive. To see why note that the left (respectively right) hand upper square in the above diagram is a pullback if and only if $m$ is the equaliser of $i_1$ and $f$ (respectively $n$ is the equaliser of $i_2$ and $f$), and also coproduct inclusions are necessarily complements.
