According to nLab,


such that the following properties are satisfied:

Does this mean

A: condition (requirement from the definition)

B: deduction (automatically satisfied under the definition above)

Which is correct?

The reason I ask is there is

“Category laws” in Haskell wiki


which claims

Category laws There are three laws that categories need to follow. Firstly, and most simply, the composition of morphisms needs to be associative.

However, I understand, even in Category theory, composition of functions is always associative.

Therefore, I believe the statement of “Category laws” is false.

What do you think? Thanks.

  • 1
    $\begingroup$ Associativity is a requirement of the definition. Morphisms in category theory aren't functions, or at least they don't start out as functions. They're just a bunch of arrows and composition is just some function defined on them, to start with. $\endgroup$ Sep 1, 2020 at 11:19
  • $\begingroup$ Please take a look at some tips for how to format and write your question. In particular, your question should be immediately understandable without forcing someone to click on an external link. I can't understand at all what you are asking in your first question. $\endgroup$
    – Lee Mosher
    Sep 1, 2020 at 11:27
  • $\begingroup$ @QiaochuYuan Thanks. I know it's not functions, but composition of relations is also always associative. So you say, morphism in fact is broader than binary relations? I think if the morphism froms composition, it is at least binary relation. Am i worng? $\endgroup$ Sep 1, 2020 at 11:28
  • $\begingroup$ @smooth_writing: consider the case of one object. Then we just have a collection of morphisms from that object to itself and composition is just some binary operation on these. Many binary operations aren't associative so requiring that it be associative is a nontrivial condition. $\endgroup$ Sep 1, 2020 at 20:49
  • $\begingroup$ Ok, thanks! I undertand now as I comment in your answer. $\endgroup$ Sep 1, 2020 at 21:26

1 Answer 1


Qiaochu Yuan's comment already answers the question, but perhaps an example will help to elaborate.

The following example is illustrative of a category in which morphisms are not like functions or relations. The category $\mathbf{Mat}$ of matrices is defined as the category for which:

  • objects are natural numbers,
  • morphims from $n \to m$ are $(n \times m)$-matrices,
  • identities are identity matrices,
  • composition is given by matrix multiplication.

The fact that composition is associative and unital has to be proven in order to show that $\mathbf{Mat}$ actually defined a well-formed category. Furthermore, composition in $\mathbf{Mat}$ is not given by composition of functions or relations. Therefore, associativity and unitality are important constraints, which do not automatically follow from the rest of the definition of category.

  • $\begingroup$ Thank you. I understand, having said that "morphims from n→m are (n×m)-matrices," To me this looks a binary operation of (n, m) that is actually a higher order function: n -> m -> (n × m). What do I miss? Thanks. $\endgroup$ Sep 1, 2020 at 20:28
  • $\begingroup$ @smooth_writing: you could represent an $(n \times m)$-matrix by a function $\{ 1, \ldots, n \} \times \{ 1, \ldots, m \} \to \mathbb Z$, yes. However, matrix composition will still not be given by function composition, so there's not an advantage to doing this (at least from the perspective of describing the category $\mathbf{Mat}$). Generally, it's less convenient to encode everything explicitly using sets and functions. $\endgroup$
    – varkor
    Sep 1, 2020 at 20:51
  • $\begingroup$ Thanks. Ok, I found a list ncatlab.org/nlab/show/database+of+categories which makes it clear. Thank you again. $\endgroup$ Sep 1, 2020 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .