Maybe it would be easier to see that $\langle \pi_1,\pi_2\rangle:A\times_BA\rightarrow A\times A$ is an internal equivalence relation in $\mathcal{C}$.
One way of explaining this is the following. First note that this is obvious if $\mathcal{C} = \textbf{Set}$. Indeed, $A\times_BA$ consists of pairs $(a_1,a_2)\in A\times A$ such that $p(a_1) = p(a_2)$ and this clearly gives rise to an equivalence relation on $A$. Now for general category $\mathcal{C}$ you can use essentially the same argument as for $\textbf{Set}$ if you apply Yoneda embedding.
Hence $\langle \pi_1,\pi_2\rangle:A\times_BA\rightarrow A\times A$ is an internal equivalence relation in $\mathcal{C}$. Recall that we may view every equivalence relation as a rather simple groupoid and thus as a category. Therefore, $\langle \pi_1,\pi_2\rangle:A\times_BA\rightarrow A\times A$ admits a structure of an internal category.
Since it is not perfectly clear to me, what is unintuitive to you, let me make some remarks.
While people often think category theory is about doing things without elements, it rather is about working with morphisms between objects. It is very often the case that we can express elements as morphisms, hence we can still work with them.
In the case of sets and topological spaces we can express elements as functions / continuous maps $* \rightarrow X$, where $*=\{*\}$ is the terminal object given by the singleton set/space. Hence given an element $(x,y): * \rightarrow X \times X$ the composite $m \circ (x,y) : * \rightarrow X$ defines an element of $X$. Try to convince yourself that in this light the axioms stating a monoid object precisely capture the usual axioms, when we make the notational convention $m(x,y) := x\cdot y$. Note further that in the case of topological spaces the fact that we work in the category of spaces enforces the multiplication map to be a continuous map. For monoids this is quite lame, but you can imagine that it is much easier to say „a topological ring is a ring object in $\mathsf{Top}$“ than to say „a topological ring is a space $R$ together with continuous maps … which satisfy …“
In more general categories elements can have more general forms. In the case of abelian groups we consider group homomorphisms and the terminal object is the trivial group $*=\{0\}$. Since group homomorphisms send 0 to 0, elements in the sense of morphisms from the terminal object always pick the zero element, which becomes really uninteresting really really fast. The „right“ notion of an element of a group (in categorical language) is that of a map $\Bbb Z \rightarrow A$. This is by the universal property of $\Bbb Z$ being the free abelian group on one generator, stating that given any element $a\in A$ of the set $A$ there is a unique group homomorphism $\Bbb Z \rightarrow A$ sending 1 to $a$. Hence again we can pick elements of our groups just talking about morphisms in the category at hand (by which I mean without referencing to things like underlying sets or such), but we need a different object than the terminal one to get them.
There are two natural „products“ in the category of abelian groups, the biproduct and the tensor product. I don’t actually know what happens when considering monoid objects with respect to the biproduct, but I would guess that it turns out to be always the group structure itself. Anyway, monoids become interesting, when we use the tensor product. A map $m: A \otimes A \rightarrow A$ classifies a bilinear map $A \times A \rightarrow A$ and with our discussion of elements above it is not hard to see that this bilinearity precisely captures a distributivity law of our multiplication $m$ with the additive structure of our abelian group $A$. You are perfectly right in that the dedicated homomorphism $\Bbb Z \rightarrow A$ makes this monoid thing into a unital ring.
What is the advantage of this categorical perspective? Well, there are instances, in which the category we want to consider does not admit a good definition of elements. For example we can consider for any category $\mathcal C$ its endofunctor category $\operatorname{End}(\mathcal C)$. Besides the pointwise cartesian product (for which $\mathcal C$ has to be good enough) it admits a natural (in general not commutative!) product given by composition of endofunctors. The monoid objects with respect to this product structure are called monads and give rise to a very nice theory, with which many effects in algebra and category theory can be explained.
So at the end it is not important to abandon elements per se, but writing things without explicitly mentioning elements helps to discover very useful tools…
Best Answer
Consider a category $\mathscr C$ with a single object $X$. Then the one-sorted presentation of $\mathscr C$ will have a collection of morphisms $C = \mathscr C(X, X)$ and functions $s, t : C \to C$ such that $\forall c \in \mathscr C . s(c) = t(c) = \mathrm{id}_X$. That is, $s = t = \lambda c . \mathrm{id}_X$. The composition of morphisms reduces to a binary operation on $C$, because the source and target of each morphism is $\mathrm{id}_X$, and $\mathrm{id}_X$ also acts as an identity for the binary operation. The definition thus reduces exactly to that of a traditional monoid (albeit one with a class of elements, rather than a set of elements, when $\mathscr C$ is not necessarily locally small).
In terms of Haskell, the definition of $s$ and $t$ is therefore given by
\c -> id_X
, for someid_X
.Therefore, a one-sorted presentation of a category in Haskell may be described by a
Monoid
, which we will callX
, along with two functionss :: X -> X
andt :: X -> X
.s
andt
are both defined by\x -> mempty X
. (Here,mempty
is the identity for the monoid.)Alternatively, in Rust:
Since there's still confusion, let me try rephrasing the following quote, which seems to be the issue.
What does this mean?
If we take a monoid $(M, \otimes, I)$, then we can form a single-sorted category $\mathbf C = M$. The functions $s : \mathbf C \to \mathbf C$ and $t : \mathbf C \to \mathbf C$ are both defined to be the constant function $x \mapsto I$. Therefore, the category $\mathbf C$ has a single object, $I$. The composite $a \circ b$ of two morphisms $a, b \in \mathbf C$ is given by $a \otimes b$. The identity is given by $I \in \mathbf C$.
Alternatively, take a single-sorted one-object category $\mathbf C$. Let $U$ be the object of $\mathbf C$ (i.e. the value of $s(x)$ for any $x \in \mathbf C$). We can define a monoid $(M, \otimes, I)$, where $M = \mathbf C$. Given elements $a, b \in M$, we define their multiplication $a \otimes b := a \circ b$. We define $I := \mathrm{id}_U$.
Therefore, the two presentations are equivalent.