What does functor definition in category theory mean?

2.2k Views Asked by At

According to Wikipedia:

Let C and D be categories. A functor F from C to D is a mapping that

  • associates to each object $X$ in C an object $F(X)$ in D,
  • associates to each morphism $f : X \rightarrow Y$ in C a morphism $F(f) : F(X) \rightarrow F(Y)$ in D such that the following two conditions hold:
    • $F(id_X) = id_{F(X)}$ for every object $X$ in C
    • $F(g \circ f)$ = $F(g) \circ F(f)$ for all morphisms $f : X \rightarrow Y$ and $g : Y \rightarrow Z$ in C.

That is, functors must preserve identity morphisms and composition of morphisms.

Maybe this is because of my programming background, but it's not clear what is $F$ in this definition. It looks like a function, but it always takes different arguments: $F(X)$ – object, $F(f)$ – morphism.

It looks like a very smart function that accepts all kinds of arguments and knows what to return in each case.

Moreover, in this book there is one more equation that makes thing even more complicated:

$$F(f : X \rightarrow Y) = F(f) : F(X) \rightarrow F(Y)$$

Does it mean that if we pass a function $f : X \rightarrow Y$ to $F$, we will get a function $F(f) : F(X) \rightarrow F(Y)$?

Also, shall $F$ mentioned here: $F(f : X \rightarrow Y)$ and here: $F(X)$ to be two different functions with different signatures and behavior?

4

There are 4 best solutions below

8
On BEST ANSWER

You're right, $F$ really is two functions. If you were being very formal, you might say a functor $F : \mathcal{C} \to \mathcal{D}$ is a pair $F=(F_0, F_1)$, where $F_0 : \mathrm{ob}(\mathcal{C}) \to \mathrm{ob}(\mathcal{D})$ and $F_1 : \mathrm{mor}(\mathcal{C}) \to \mathrm{mor}(\mathcal{D})$ are functions satsifying

  • If $f : X \to Y$ in $\mathcal{C}$, then $F_1(f) : F_0(X) \to F_0(Y)$ in $\mathcal{D}$;
  • $F_1(\mathrm{id}_X) = \mathrm{id}_{F_0(X)}$ for all $X \in \mathrm{ob}(\mathcal{C})$; and
  • $F_1(g \circ f) = F_1(g) \circ F_1(f)$ for all $X \xrightarrow{f} Y \xrightarrow{g} Z$ in $\mathcal{C}$.

There are various encoding tricks you could use to completely remove ambiguity, but in day-to-day life there is no problem with just writing $F$ to denote both $F_0$ and $F_1$. But when using a proof assistant, say, the distinction has to be made.

14
On

Functors are not "functions" because categories themselves are not "sets" to begin witthh. (The contradictions of the concept of "set" of all sets, with which you may be familiar, is what leads to the need for the different concept of "category" in the first place.)

Using the same letter $F$ for mappings from one category's objects to the other's and for the mapping from the first category's morphisms to the other's is an "abuse of notation" (overloading is indeed the correct analogy); it is not required for the definition. You might as well say a functor is a mapping $F$ from the objects of $C$ to the objects of $D$, together with, for EACH pair of objects $(X,Y)$ of $C$, a function $\varphi_{X,Y}$ (indeed, because morphisms between two objects must always be sets) from [ the morphisms from $X$ to $Y$ in the category $C$ ] to [the morphisms from $F(X)$ to $F(Y)$ in the category $D$ ]. Writing it this way, without using the same notation $F$ for everything, does not change the definition.

8
On

Don't forget a category $\mathcal C$ is made up of two sorts of data: a class of objects, and for each pair of objects, a set of arrows. Therefore, it is natural that a functor from the category $\mathcal C$ to another category has, so to say, two components: a function on the class of objects, and functions on each set of arrows.

0
On

If you extract the set1 $Ob(C)$ of objects from the category $C$ and the set $Ar(C)$ of arrows, then given any functor $F : C \to D$, you can indeed construct two functions $$ Ob(C) \to Ob(D) : X \mapsto F(X) $$ $$ Ar(C) \to Ar(D) : f \mapsto F(f) $$ satisfying the stated properties. And conversely, given any two functions satisfying the properties, there exists a corresponding functor.

You can think of the functor as being a pair of functions, but it is probably better to instead think of that as a way to represent functors. You want to think of a functor as being a thing in its own right, rather than being shackled to that particular representation.

For example, you can do the usual thing of promoting evaluation to a binary operator. In set theory, there is a set $Y^X$ of all functions from $X$ to $Y$, and you can consider evaluation a function $Y^X \times X \to Y$.

You can do the same thing with functors; there is a category $D^C$ whose objects are functors from $C$ to $D$ (and whose arrows are natural transformations), and evaluation is itself a functor $D^C \times C \to D$.

Another potentially interesting point is that categories don't just have point-shaped and arrow-shaped elements. They have elements in the shape of any diagram: for example, they have commutative-square-shaped elements, and the functor $F$ also maps commutative-square-shaped elements of $C$ to commutative-square-shaped elements of $D$.

That a functor preserves composition of morphisms can actually be phrased in terms of the functor acting on the commutative-triangle-shaped elements.

(all of the information of a category is in its arrows so we can reduce all various-shaped elements to arrows and equations between them, but we don't have to)

1: Replace "set" with other notions as needed or to taste