## What is the difference between a function and a morphism? [closed]

Say I have a function $f$. Then, if I understand correctly, $f$ can be regarded as a morphism in a suitably chosen category which has the domain of $f$ and the range of $f$ as objects.

So, the other direction. Say I have a morphism $f$ in some category from one object $A$ to another object $B$. Can I not regard $f$ as a function whose domain is $\{A\}$ and range $\{B\}$?

I'm interested in looking for contexts in which the latter move is not appropriate for some reason.

-
Think of a one object category which had more than one morphism... – Yemon Choi Jan 26 at 4:49
Don't you really mean "whose domain is $A$ and range $B$" ? (then, of course, you have to think of the objects of your category as sets). But of course, the answer is negative, as different morphisms can correspond to the same function. – Feldmann Denis Jan 26 at 5:59
@Feldmann - No, I wanted the domain of $f$ to be the set containing $A$, simply because $A$ may not be a set, and the domain of a function is a set by definition. – Benjamin Braun Jan 26 at 7:36

## closed as off topic by Eric Wofsey, Yemon Choi, Dan Petersen, Will Sawin, Martin BrandenburgJan 26 at 10:23

You're losing a lot of information. Let's say we have two morphisms $f,g\in \mathrm{Hom}(A,B)$. Using your perspective, we see that both $f$ and $g$ agree at all points (as the only point is $B$). Thus by eta-reduction we should have $f=g$, but this is not necessarily the case. So thinking of morphisms as functions from $\{A\}$ to $\{B\}$ is the wrong perspective.

-
Got it. I've resolved my issue by thinking of morphisms as just triples of the form $(x,y,z)$ where $x$ and $z$ are objects of the category and $y$ is some mathematical object. So in your example, $f$ would be $(A,u,B)$ where $g$ would be $(A,v,B)$ where $u$ and $v$ are what is making $f$ different from $g$. – Benjamin Braun Jan 26 at 5:08
@Benjamin I'm not really sure how that differs from saying $f,g\in \mathrm{Hom}(A,B)$. You're just using slightly different notation with $u$ instead of $f$ and $v$ instead of $g$. – Alex Becker Jan 26 at 5:18

There are various natural categories in topology where morphisms are not functions. For instance, you may define for every $n$ the category whose objects are all compact closed $n$-manifolds and whose morphisms are the $(n+1)$-dimensional cobordisms, i.e. compact $(n+1)$-manifolds $W$ with boundary, where each boundary component of $W$ is coloured with a "+" or "-" sign. Of course you cannot interprete a cobordism $W$ from two $n$-manifolds $M$ and $N$ as a function $M\to N$. However, you can naturally define a "composition" of morphisms by gluing the manifolds. The "identity" is just the product manifold $W = M \times [0,1]$.

You can also construct embedded versions of that. For instance: objects are compact 1-submanifolds of $\mathbb R^2$ (i.e. finitely many disjoint circles) and morphisms are proper subsurfaces of $\mathbb R^2 \times [0,1]$. You might decide to see morphisms only up to isotopy fixing their boundary.

-
There is also the category whose objects are all topological spaces and whose morphisms are homotopy classes of functions. Maybe this is even the first "non set theory" functor students will encounter, at least in topology. – Lee Mosher Jan 26 at 15:39
or also, the obvious construction of "opposite category". – Pietro Majer Jan 26 at 17:12

Another interesting reason why categories cannot be identified always with categories having functions for morphisms is given in this paper, by Peter Freyd in which is proven that there are some categories which aren't concrete: i.e. which don't have any faithful functor from the category in $\mathbf{Set}$ (the category of sets and functions). Having a such functor is necessary condition to have functions as morphisms.

-

A main point is that considering objects and morphism (more generally than sets with some structure and functions that preserve it), is both a clarifying and fruitful abstraction. There are situations in which a category may be represented by a sub-category of the Set category (though it can be more complicated than what you suggested. If you are interested, you may start from the Yoneda lemma). But, in order to understand universal properties and to make categorical constructions it could even be counter-productive, like e.g. insisting in metrization with topological spaces, or coordinates with vector spaces.

-