3
$\begingroup$

From Category Theory for Programmers by Bartosz Milewski in section 3.5 titled Monoid as Category we read the following

Every monoid can be described as a single object category with a set of morphisms that follow appropriate rules of composition.

With all the examples provided, such that string concatenation with concatenating empty string as identity operation and natural number addition with adding 0 as identity operation et cetera.

I am new to Category Theory, correct me if I'm wrong, but I understand the point is to not think about what is in the objects, but rather focus on how objects relate it each other.

Distinguishing objects seems fundamental. I don't see how does this Monoid as Category represents a Monoid.

My argument based on given examples. A string after concatenating anything else than empty string has to be a different string, and thus different object. A natural number after adding anything else than zero has to be a different number, and thus different object.

This brings me to my title question, in category theory, is it possible for an object to have an arrow pointing into itself, such that this arrow is not an identity arrow? This feels strange and unnatural to me. I would like someone more experienced to comment on that.

$\endgroup$
  • 3
    $\begingroup$ The elements of the monoid are not objects, they're morphisms of the monoid-as-category. $\endgroup$ – Malice Vidrine Aug 25 '19 at 12:05
2
$\begingroup$

You're essentially asking whether $\operatorname{Hom}_C(A, A)$ is a singleton or not. It doesn't have to be a singleton, and most of the time it isn't. In fact, an arrow from an object to itself is called an endomorphism, and $\operatorname{Hom}_C(A, A)$ is denoted as $\operatorname{End_C}(A)$.

For a concrete example, consider the set of functions from a set $A$ to itself. As long as $A$ contains more than one element, then $\operatorname{End}_{\text{Set}}(A)$ is not a singleton.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you Ayman, I think the swap function provided by Clive is a good example for such function. I would like to ask, if this set doesn't need to be a singleton, how to we know which one of those endomorphisms is the identity morphism? $\endgroup$ – Marek Aug 25 '19 at 12:08
  • 3
    $\begingroup$ The identity morphism $\operatorname{id}_A$ must satisfy $\operatorname{id}_A \circ f = f$ and $g \circ \operatorname{id}_A = g$ for all morphisms $f$, $g$ where such compositions are possible. In $\text{Set}$, the identity function is the only morphism that satisfies this condition, as can be verified by hand. $\endgroup$ – Ayman Hourieh Aug 25 '19 at 12:11
  • 3
    $\begingroup$ As a side note, if you haven't done some abstract algebra yet (e.g. groups), I recommend doing so. It'll expose you to proofs of this nature, and give you some concrete categories to work with and derive examples from. The proof in my comment above is essentially the same as proving that the identity element of a group is unique. $\endgroup$ – Ayman Hourieh Aug 25 '19 at 12:17
1
$\begingroup$

It is certainly possible. For example, consider the 'swap' function $f : \{0,1\} \to \{0,1\}$, defined by $f(0)=1$ and $f(1)=0$. This is a non-identity morphism from $\{0,1\}$ to itself in the category $\mathbf{Set}$ of sets and functions.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you for such quick answer. About your example, formally, why this swap function is a non-identity morphism? $\endgroup$ – Marek Aug 25 '19 at 12:05
  • $\begingroup$ Because the identity morphisms in $\mathbf{Set}$ are the identity functions, and the swap function is not an identity function. Or if you want an actual proof, note that if $f$ were an identity morphism then it would satisfy $f \circ f = f$, but in fact we have $f \circ f = \mathrm{id}_{\{0,1\}} \ne f$. $\endgroup$ – Clive Newstead Aug 25 '19 at 12:07
  • $\begingroup$ @CliveNewstead I think your last argument is circular because you're assuming $f\neq id_{\{0,1\}}$, which is what you want to prove. By prove I mean categorically, of course it is not the identity pointwise defined. I was going to write the actual proof but Ayman sketched it in the comments of his answer. $\endgroup$ – Javi Aug 25 '19 at 12:12
  • 2
    $\begingroup$ @Javi: It's not circular. The identity function is defined independently of the notion of 'identity morphism', namely we define $\mathrm{id}_{\{0,1\}} : \{0,1\} \to \{0,1\}$ by $0 \mapsto 0$ and $1 \mapsto 1$, and then verify that it satisfies the identity axioms. In fact we don't even need to refer to $\mathrm{id}_{\{0,1\}}$: the mere fact that $f \circ f \ne f$ shows that $f$ does not satisfy the identity axioms, so it is not an identity morphism in $\mathbf{Set}$. $\endgroup$ – Clive Newstead Aug 25 '19 at 12:13
  • $\begingroup$ @CliveNewstead, I understand your argument, I just tried to write it more explicitly as follows: let $f(x)$ be a swap function for $x$ in $\{0, 1\}$, so $f(x)=1-x$, an identify function $i(x)$ must verify $i(g(x))=g(x) \forall g:\{0, 1\}\rightarrow\{0, 1\}$, so if $f(x)$ is identity function then $f(f(x))=f(x)$ we can disprove it by simple algebra $f(f(x)) = 1 - f(x) = 1 - 1 + x = x \neq 1 - x = f(x)$ $\endgroup$ – Marek Aug 25 '19 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.