29

I'm struggling with comprehending what monoids are in terms of category theory.

In examples they view integer numbers as a monoid. I think I get the set theoretic definition. We have a set and a associative binary operator (addition) and the neutral element (zero).

Then they are saying something like that - view the whole set as a single object and binary operator as bunch of morphisms for every element of the set.

Like add0 is an identity morphism. Which would really give us the same object i.e. the same set of all integer numbers. I think I understand this.

But let's view the morphism add1. After applying it to the our single object (the set of all integers) we would have a set {1,2,3…} not the {0,1,2,3…}. Aren't domain and codomain different in that case?

That's what's bothering me. Can someone clarify that to me?

Here is the text that gives me problems.

The text

3 Answers3

38

No, that's not the way to view it. In order to view a monoid as a category, you have a single object $\mathsf{Andreas}$, and each element of the monoid is one morphism $\mathsf{Andreas}\to\mathsf{Andreas}$ in the category. The monoid operation is the composition in the category.

So for the integers, you don't have a morphism "add 1", but a morphism that is simply called $1$. And composition in the category works such that $1$ composed with $1$ is the morphism called $2$.

This is an example of a category where the morphisms are not functions.

  • Umh... Okay. Morphisms are numbers. But what is their domain and codomain? Set of all integers? – user1685095 Jun 20 '15 at 15:06
  • 8
    @user1685095: The domain of each morphism is $\bullet$ (that is, the object of the category), and so is the codomain. The very point here is that a morphism is not necessarily a function. – hmakholm left over Monica Jun 20 '15 at 15:13
  • What is $\bullet$ mean? – user1685095 Jun 20 '15 at 15:15
  • 3
    @user1685095: $\bullet$ is the name of the object in the category. Its precise identity is not important. – hmakholm left over Monica Jun 20 '15 at 15:26
  • I've added the link to the text that was giving me problems. I'm pretty sure that the author sees adder functions (like add5) as a morphism. – user1685095 Jun 20 '15 at 15:26
  • I don't understand, sorry. Let's view morphism 1. What is it's domain and codomain? – user1685095 Jun 20 '15 at 15:28
  • 5
    @user1685095 add$1$ can be looked at as a function having $\mathbb N$ as domain and as codomain. It is prescribed by $n\mapsto n+1$. There is a category with objectset ${\mathbb N}$ and morphismset ${\text{add}n\mid n\in\mathbb N}$. So there is only one object and it can equally well be denoted as $\bullet$. Monoids can be identified as categories that have exactly one object. Composition of morphisms corresponds with addition: $\text{add}k\circ\text{add}m=\text{add}(k+m)$. – drhab Jun 20 '15 at 15:47
  • @drhab thanks for explaination, I think I understand now. Thanks everyone! – user1685095 Jun 20 '15 at 16:00
  • 34
    Since the unique but unspecified object seems to cause difficulties for the OP, I hereby volunteer to make things specific by being that object. That is, the category has one object, namely me, and its morphisms are the integers. Composition of morphisms is addition of integers. – Andreas Blass Jun 20 '15 at 16:00
  • @Andreas: You're hired! – hmakholm left over Monica Jun 20 '15 at 16:18
  • I almost got confused for a moment. Where you say "each element of the monoid is one morphism ..." should you say "each element of that object is one morphism ..." ? – codeshot Nov 04 '17 at 13:49
  • 1
    @codeshot: No, I mean each element of the monoid. An object in category theory does not have elements (or at least not elements that are visible at the category level). – hmakholm left over Monica Nov 04 '17 at 15:03
  • Books I've read on category theory refer to the elements of the object when constructing the category. The problem with referring to them as elements of the monoid is that you've already said the monoid is being looked at as a category - making them elements of the category which is confusing. – codeshot Nov 11 '17 at 16:49
  • 1
    @codeshot: That must be because the books you've read are only dealing with concrete categories. When I say elements of the monoid, I'm talking about a monoid in the usual "a set with a binary operation" sense -- and instead of saying that the monoid is a category, we should perhaps say that it corresponds to a category. Or in other words, every monoid is the the (single) hom-set of a one-object category, and in every one-object category its (single) hom-set is a monoid. – hmakholm left over Monica Nov 11 '17 at 19:27
  • Maybe that we define an object (Blah) in the category to represent the monoid and one morphism (Blah -> Blah) for each element of the monoid. There are no other objects and no other morphisms in the category. – codeshot Nov 12 '17 at 00:42
  • @codeshot: Yes, that's exactly what I'm saying. (I would argue that the object doesn't represent the monoid as much as the entire category does, but that's just quibbles about wording). – hmakholm left over Monica Nov 12 '17 at 08:52
  • maybe I'm too much steeped in programming – codeshot Nov 12 '17 at 17:46
  • @HenningMakholm what is the role of this object $\bullet$ here in this one-object category. Can we say that this "corresponds" to category with no object and "arrows" of this category are elements of the monoid? I have another doubt, Do we need objects to define the arrows (not like the functions, but maybe in another way)? – MUH Nov 12 '18 at 14:34
  • Can I say that not only 0, but 1, 2, 3 ... are identity mophisms in this category? – Phạm Văn Thông Jul 21 '20 at 01:54
  • 1
    @Phạm Văn Thông, unfortunately not. First, as hmakholm left over Monica said, the morphisms 0, 1, 2, 3 etc. are (or correspond to) elements of the monoid. Composition is the monoid operation. So if the monoid operation is +, 1 composed with 2 is 3, showing that neither are identity morphisms.

    Second & perhaps more deeply, assume morphisms i and j are both identities. Then what is j composed with i, j ∘ i? Focusing on j as identity, it has to be i. But focusing on i as identity, it has to be j. So j=i, and we have only one identity morphism. So only one of 0, 1, 2, 3 ... could be one anyway.

    – Phil van Kleur Jun 13 '21 at 17:44
29

You already know that a monoid $M$ is a set with a unit $e$ and a binary operation. More precisely, if $a,b,c\in M$ then $$a\circ b\in M$$ $$(a\circ b)\circ c=a\circ (b\circ c)$$ $$e\circ a=a\circ e=a$$

Now, take any category $C$ with one object, $c$. Since $C$ is a category, we need to say what the arrows are. That is, what the morphisms $c\rightarrow c$ are. There must be a unit $1_{c}:c\rightarrow c$, the arrows must be composeable and the composition must be associative. More precisely, if $f,g$ and $h$ are arrows, then $$f\circ g\in Morph(C)$$ $$(f\circ g)\circ h= f\circ (g\circ h)$$ $$1_{c}\circ f=f\circ 1_{c}=f$$Notice we are $\textit not$ talking about sets here. Just objects and arrows, in the abstract.

But now if we just observe that the operations on $M$ are $\textit exactly$ the same as the operations on $Morph(C)$, we may regard the category $C$ as the monoid $M$. This correspondence is reversible: given category $C=\left \{ c \right \}$ we obtain a monoid $M$ whose elements are the arrows of $C$.

Thus the two descriptions are equivalent.

All this works because the binary operations are the same for both structures.

Matematleta
  • 29,139
  • What's special about the case when $Ob(C)={c}$? Why can't we interpret a monoid as a category with more than one object? The same axioms will hold for $Morph(C)$. – user557 Jan 27 '19 at 16:15
  • 3
    You want to identify Morph$C$ with $M$? But in an arbitrary category, not all morphisms are composable, right? If you have $f,g:A\to B$ then $f\circ g$ doesn't even exist. What's special about the above construction is that there is an $\textit {exact}$ i.e. bijective correspondence between the operations. – Matematleta Jan 27 '19 at 16:37
  • 1
    Then we can consider a category with more than one object and the set of all morphisms from an object $A$ to $A$. This set with the operation of composition should be a monoid. Can we then say that conversely, a monoid can be interpreted as the set of arrows from a fixed object to itself in an arbitrary category? This is also a bijective correspondence between the arrows from that object to itself and the monoid operation. – user557 Jan 27 '19 at 17:00
  • 2
    "...a monoid can be interpreted as the set of arrows from a fixed object to itself in an arbitrary category"...yes, and this is the essence of my answer. If you have a category $C$ with small hom-sets, then for each $c\in C$, then each Hom$[c,c]$ will give a monoid, distinct if the cardinalities are different. – Matematleta Jan 27 '19 at 17:06
  • Then I guess the only reason to mention categories with one object is to be able to make statements like "a monoid is a category with one object" as opposed to "a monoid is a set of morphisms from a fixed object to itself in a category". So a monoid and a category with one object are equivalent concepts (like groups and $\mathbb Z$-modules). Given a category with one object, one obtains a monoid as in your answer. Conversely, given a monoid one constructs the corresponding category by taking the only object to be ${\ast}$ and the only morphism $\ast\mapsto \ast$. Is that correct? – user557 Jan 27 '19 at 17:40
  • 2
    This should be the accepted answer, the accepted one uses the integers as a confusing example. – Rexcirus Feb 10 '23 at 23:25
  • This object c would have elements so can we take the arrows to me morphisms between these elements? – ssn May 01 '23 at 14:13
  • No. $c$ is an object, indivisible. That is, the category has one object $c$ and the morphisms $f: c\to c$ constitute the elements of the monoid, as in my answer. – Matematleta May 05 '23 at 12:53
10

In addition to Henning Makholm's crisp and clear answer, you might find the opening six pages of my Notes on Category Theory helpful. They too give the example of a monoid as a category, but also give some other examples of categories where the arrows are not functions in any ordinary sense. Another important illustration is the case of a posets treated as a category.

In fact these examples suggest why we might well prefer to talk of 'arrows' rather than 'morphisms' (because the very term 'morphism' comes with baggage, and almost inevitably makes us think of a function -- but to repeat, arrows need not be functions).

Peter Smith
  • 54,743