[Haskell-beginners] Category question

Alessandro Pezzoni alessandro_pezzoni at lavabit.com
Mon May 28 13:34:01 CEST 2012


On Mon, May 28, 2012 at 11:54:11AM +0200, Manfred Lotz wrote:
> In the definition of a (mathematical) category it is said (among other
> things), that for any object A there exists an identity morphism:
>
> idA: A -> A and if f: A -> B for two objects A, B then
>
>    idB . f = f and f . idA = f
>
> must hold.
>
> My question: Because I cannot think of any counterexample for the
> last statement I would like to know if I just could omit this
> from the definition and formulate this as a small theorem.
>
> Or does there exist a counterexample where all conditions of a category
> hold but there exist two objects A, and B where we have idB . f <> f
> and/or f .idA <> f?

When you ask that
  idB . f = f    and    f . idA = f
you are basically defining a left and a right identity, respectively.

If I get your question correctly, you are asking if you can drop the
axiom (requirement) of existence of an identity morphism for every
object and deduce it from the other axioms, i.e. that the composition of
morphisms is always well defined and that it is associative.

This is not possible, though. As a simple example, consider a category
with only one object, let's call it X, and a non identical morphism
f: X -> X which is such that
  f^n = f . ... . f
is not identical for every non-zero natural n.
For example you can consider X as a totally ordered infinite set, e.g.
the set of integers Z, and f the map that shifts every element by
one to the right, e.g.
  f(z) = z + 1 for every z in Z,
so that
  f^n(z) = z + n != z for every non-zero natural n.
If now you consider the "category" with only X as object and as set of
morphisms
  {f^n | n is a non-zero natural},
then the composition is always defined as
  f^n . f^m = f^(n+m)
and it is obviously associative. But in this example there is no identical
morphism, because f^n(z) != z for every non-zero natural n.

By the way, this example models a semigroup, like the set of natural
numbers N\{0} with the canonical sum.


Alessandro




More information about the Beginners mailing list