12

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?

  • 2
    If you are familiar with Haskell, you might recognize the two components of a functor as a type constructor (the object mapping, like [] or Maybe) and the fmap function (the morphism mapping). The well-known map function in many languages is a combination of the mapping of a function to another function on lists, along with the application of that function on a list. – chepner Aug 14 '16 at 19:54
  • 2
    Category theory overloads 'operator()' a lot more than set theory does. –  Aug 15 '16 at 07:11

4 Answers4

23

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.

  • 5
    +1. Note that an alternative to this is to dispense with objects entirely, and work with an "arrows-only" formalization; see my answer to this question. – Noah Schweber Aug 14 '16 at 18:19
  • Err... no, functors are not functions, because categories are not sets. –  Aug 14 '16 at 18:21
  • 7
    @mathguy: That depends on whether you're using, say, NBG set theory (in which a category is class and a small category is a set), or a Grothendieck universe (in which case a category is a set, and a small category is a small set), or whatever else. Regardless of the underlying theory, you could replace 'function' by 'class-function' and my answer goes through. – Clive Newstead Aug 14 '16 at 18:23
  • I almost mentioned small categories in my answer and then refrained from it. The main thing beginners need to understand is that some concepts from set theory will not work in general in category theory. This is why it is best to be very precise with the terminology; in particular, a functor is not a "function" between classes of objects (for example, you can't think of an "injective" functor in the sense of injective functions between sets, etc.) –  Aug 14 '16 at 18:27
  • 6
    @mathguy: That's also just not true. A functor is a pair of (possibly class-)functions satisfying certain conditions. You can (and people do) talk about a functor being, say, injective on objects (i.e. $F_0$ is an injective (class-)function), or a corresponding notion for morphisms (say faithfulness). – Clive Newstead Aug 14 '16 at 18:30
  • What I meant is, injectivity for a functor doesn't mean if object $X$ is different from object $Y$ then object $F(X)$ is different from object $F(Y)$. "Faithful functor" is a very different concept from "injective function." –  Aug 14 '16 at 18:34
  • 6
    @mathguy: I'm not sure what point you're trying to make here, your objections keep changing (or you're just not reading my comments). No-one (except you) said anything about 'injective functors'. I'm very well-versed in the distinction between a functor being injective on objects and being faithful. – Clive Newstead Aug 14 '16 at 18:38
7

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.

Bernard
  • 175,478
  • Not a "function" on the class of objects - it is call a "class" of objects and not a "set" of objects precisely because in most cases it is not a set (so you can't define a "function" on it.) –  Aug 14 '16 at 18:22
  • 4
    @mathguy: I never wrote a set of objects. Reread my answer. And the term function is valid for classes, as far as I know. – Bernard Aug 14 '16 at 18:25
  • My objection was to the term "function" - and "function" is specifically something defined between sets. Whoever wrote the wiki article knew that; he or she used the correct distinction there. –  Aug 14 '16 at 18:28
  • 5
    @mathguy: That just isn't true, 'function' is very commonly used for class functions. – Clive Newstead Aug 14 '16 at 18:28
  • 1
  • 1
    @mathguy While the term "class function" is more precise, I've definitely heard the distinction between (set) functions and class functions get elided in contexts where the set- or class-theoretic foundations are not actively relevant. And I think this is one of those times. – Noah Schweber Aug 14 '16 at 18:43
  • @Bernard - the questions were about categories and functors. –  Aug 14 '16 at 22:13
  • @mathguy: I'd noticed this fact ;o). I think I answered more or less exactly, in plain words, to the O.P.'s question: why a functor seems to have several arguments.I'm sorry if you seem so touchy with my use of the term ‘function’. – Bernard Aug 14 '16 at 22:29
4

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

0

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.

  • 1
    I see a few down votes... It may help me and others if you would explain what is wrong with the answer. Thanks! –  Aug 15 '16 at 02:12
  • 6
    Though I did not dos vote this, if I did downvote it, it would because careful distinctions between sets and classes are not germane to the level of question of the OP. More sophisticatedly, as has already been pointed out to you on this page twice, in at least one very widely used foundation, every category is a set, and even when this is not the case it's far from universally accepted that any serious purpose is served by dogmatically restricting the word "function" to a mapping defined between sets. – Kevin Carlson Aug 15 '16 at 05:26
  • 3
    Nor did I downvote it, but if I did it would be at least in part for the extreme unhelpfulness of "go back a few chapters in your imaginary book." That's much more snarky than it is actually informative. – Wildcard Aug 15 '16 at 06:27
  • @KevinCarlson - I respectfully disagree. The only reason for the existence of "category theory" is those distinctions; without them, we would just have set theory. (And, you could - and did! - make that point with or without a down vote, for which I thank you. Honestly I don't care about the downvotes, I do care about the serious debate about this issue.) –  Aug 15 '16 at 12:19
  • 1
    @Wildcard - Fair enough. I will edit to remove that remark. Thank you! –  Aug 15 '16 at 12:19
  • 1
    @mathguy Interesting-I don't agree. How familiar are you with Grothendieck universes? – Kevin Carlson Aug 15 '16 at 15:45
  • @KevinCarlson - I think I am quite familiar. In a previous career (which ended about 25 years ago) I was a research mathematician, university professor at a top univ. in the U.S., with published research in algebraic geometry and commutative algebra, including homological algebra. I may not remember much (after another long career in a different field) but I think I do remember the terminology. When you say "I don't agree", what do you mean? Cheers! –  Aug 15 '16 at 15:51
  • @KevinCarlson - anticipating, perhaps - I hope you are not going to argue that "Grothendieck universes" are the same as category theory. They are not. :-) –  Aug 15 '16 at 15:55
  • It would certainly be a type error to argue that-I would argue that they give a quite reasonable foundation for category theory within set theory. – Kevin Carlson Aug 15 '16 at 18:50
  • @KevinCarlson - I don't dispute that, but the very title of the post had the words "category theory" in it. Why not assume the OP meant what he said? I see everybody is upset that I am so vehemently against the use of "function" as applied between the objects of two categories. Go figure. –  Aug 15 '16 at 18:59
  • 2
    You just haven't given any clear explanation of the reasons for this vehemence. You claim it's the essence of a category not to be necessarily a set, we all point out that's far from clear, and you haven't done anything to defend your point. My point is that the study of categories via universes is category theory, which you apparently dispute, and I still don't know why. It might help to point out that no successful foundation of category theory without reference to sets has yet been given. – Kevin Carlson Aug 15 '16 at 23:18
  • @KevinCarlson - Where should I start? Here is an example. Often a proof starts like so: "consider a well-ordering on ". Now let the set of interest be the category of all Abelian groups. Suppose the well-ordering helps somehow. Is that a good proof? Or, a better question: What could I say at this point that will convince you that there are good reasons to keep "objects of a category" well out of set theory? –  Aug 16 '16 at 00:12
  • I don't know, of course-because I don't think there are such good reasons! In particular, I don't think there are any actual proofs that founder on the issue you name. It's not hard to remember that I can only well-order the set of small abelian groups. – Kevin Carlson Aug 16 '16 at 02:28