# Functors (Co/Contra-variant)

I was reading one of my professor's notes on Category Theory, but I seem to be confused at the following point (i'll put a small part of the note here as reference).

I guess my professor mention that assigning a category $\mathcal{C}$ its opposite category $\mathcal{C}^{\mathrm{op}}$ is natural in $\mathcal{C}$. This "gives rise" to a functor on the category of (small) category. "This so indeed, the correspondences"

$\mathcal{C} \mapsto \mathcal{C}^{\mathrm{op}}$ and $F \mapsto F^{\mathrm{op}}$ ($\mathcal{C} \in \mathrm{Cat}_0$; $F \in \mathcal{C}_1$) $(1.30)$

(where $C_1$ as my professor denotes is the class of morphism)

These correspondence yield a functor $()^{\mathrm{op}}: \mathrm{Cat} \to \mathrm{Cat}$

Sorry if I am a bit redundant. I am in an undergraduate measure theory class, but we are doing a long introduction into Category Theory. I don't have much reference to category theory online, so I am hoping to get at least some kind of clarification. I appreciate it. If something looks odd in the above, let me know because my professor just wrote these notes on Category Theory in the last 4 weeks.

Question:

(1) At least to my understanding 'Cat' is the category of small unital categories. In the above, is Cat$_0$ the category of small categories?

(2) To my understanding, functors is a kind of mapping between categories. By $F \in C_1$, what does this mean?

Question: Is the functor (1.30) covariant or contravariant?

Maybe I am interpreting the question incorrectly, but so far that pops up in my mind is to look at the morphisms in $\mathcal{C}$ and check if the morphism arrow are reversed if $F$ is applied to the morphism in $\mathcal{C}$

-
I recommend the first section of people.fas.harvard.edu/~amathew/CRing.pdf – anon Mar 14 '12 at 7:22
the answer from @Yuri is very good and the reference to the "Joy of cats" too. But what is not clear to me is "small unital category". Small...ok, but unital? what do you mean by that? I never heard of this terminology with categories. What is a non-unital category? – magma Mar 16 '12 at 18:48

1. This is bizarre notation, we indeed have a functor $()^{\mathrm{op}}: \mathrm{Cat} \to \mathrm{Cat}$ where $\mathrm{Cat}$ is the category of small categories.

2. Notation is wrong, should be $F\in\operatorname{Hom}(\mathcal C,\mathcal D)\mapsto F^{\mathrm{op}}\in\operatorname{Hom}(\mathcal C^{\mathrm{op}},\mathcal D^{\mathrm{op}})$

3. Do we have $(FG)^{\mathrm{op}} = F^\mathrm{op}G^\mathrm{op}$ or $(FG)^\mathrm{op} = G^\mathrm{op}F^\mathrm{op}$?

EDIT: $\mathrm{Cat}_0$ denotes the set of objects of $\mathrm{Cat}$, i.e. it is the (large) set of small categories. Similarly I suspect that $\mathcal C_1$ was intended to be $\mathrm{Cat}_1$, i.e. the morphisms of $\mathrm{Cat}$ (functors). In general your professor's notation extends to $\mathcal D_n$ for the set of $n$-morphisms of a category $\mathcal D$

-
I'm not sure I would call that notation wrong. $F \mapsto F^{op}$ for $F \in \mathcal{C}_1$ is exactly what the functor does to morphisms. – Juan S Mar 14 '12 at 7:24
I think $\mathcal C_1$ was supposed to be $\mathrm{Cat}_1$, as it seems the professor is using $\mathcal C_0$ to denote the objects of $\mathcal C$ and $\mathcal C_1$ to denote its morphisms (this notation extends to $\mathcal C_2$ for the 2-morphisms of $\mathcal C$, and so on) – Yuri Sulyma Mar 14 '12 at 7:29
Thanks, Yuri. I was thinking that $F \in \mathrm{Hom}(\mathcal{C}, \mathcal{D})$. Upadate*: Thank you so much, Yuri! Your second comment makes much sense. I think my professor meant that. – MathNewbie Mar 14 '12 at 7:33

(The answer to questions is in the second part of the post. I written the first part because there is a non-zero probability that it will help you too.)

Part 1

All people generalize from one example. At least I do. -- Vlad Taltos (Issola, Steven Brust)

The Category Theory is nice, but when I first dig into it I was struggling a bit. It gotten me some time to get some feeling and intuition, and I must admit that even now it is quite miserable intuition -- every once in a while I see an example that turns everything upside down. There were two things that helped me place all the entities in (approximately) good places, and then it clicked. Those things were (in that order):

1. Computer science, i.e. functional programming. It happens that majority of basic terminology can be formulated into the language of functions and types. When I found this nice source of examples, it was easy to draw all the diagrams, and follow the theorems. I guess that most of mathematicians have pretty good grasp what is a function, domain and codomain, so maybe those examples will help you too? (Beware: this is not a good source of complex examples, from my experience, topology is much better there).

2. The best book on Category Theory I know, "Abstract and Concrete Categories: The Joy of Cats" (available online). Why it is nice: it contains many examples from different domains and has a nice light, humorous mood (but the volume of knowledge presented is rather huge). It also covers some topics that are missing from other most popular books.

Other resources can be found e.g. here.

It is also sometimes helpful to think about categories as just dots and arrows and nothing more (which abide some specific laws). Then, the labels (the interpretation of...) on the dots (... objects) and arrows(... and morphisms) should help you decide which arrow is the result of composition of other two, but nothing more (as those interpretations may constrain your understanding). Something like a multigraph.

Part 2

(1) I have never seen a notation like that. I'm sorry, I can't help you with this, because I don't want to tell you wrong -- your professor may have some conventions of his own and I don't know them. It would be best to refer to the lecture notes or something.

(2) Functor is a mapping from category to category. Objects are mapped to objects (I guess this is the $\mathcal{C}\to\mathcal{C^{op}}$ part) and morphisms are mapped to morphisms ($\mathcal{F} \to \mathcal{F}^{op}$). The interpretation of $\mathcal{F} \in \mathcal{C}_1$ is probably that $\mathcal{F}$ is a morphism, which would be normally writen as $\mathcal{F} \in \mathbf{Hom}(\mathcal{C}, \mathcal{D})$ as pointed out by Yuri. Please note, that it is perfectly normal for a functor to map category $\mathcal{C}$ to itself or to its subcategory.

E.g. Take $\mathbf{Set}$, the category of sets with objects being sets and morphisms being the functions with domain and codomain being the objects the morphism maps from and maps to. The $\mathbf{Set}^{op}$ will be the category with precisely the same objects, but with morphisms being functions, but now the object that morphism maps from is a codomain, and the other represents the domain. I hope you can see, how the functor $(\cdot)^{op}$ works in this setting.

Other example may be the powerset functor. It maps the dot (object) that represent set $S$ into the dot of the same category that represents set $\mathcal{P}(S)$ (the powerset of $S$). It also maps the arrow labeled $f$ to an arrow labeled $S \mapsto \{f(x) | x \in S\}$. It is not that hard to see that this mapping have all the properties of a functor (please check them). This is an example of functor maps category $\mathbf{Set}$ to its subcategory.

(3) Of course dots have to be mapped to dots, and arrows to arrows. However, arrows in one category may be dots in another, or even in the same category may happen that there is a dot and an arrow with the same label (that's one of the reasons why it is sometimes useful to think in terms of dots and arrows). Take for example category $\mathbf{Set}$ and arbitrary function $f : A \to B$. Of course there will be some arrow labeled $f$ leading from dot $\mathcal{A}$ to dot $\mathcal{B}$, but $f$ is also a set (i.e. $f \subset A \times B$), therefore there will be also an object with label $f$!

If you choose some set $D$, then you can create a functor $\mathcal{F}$ that maps a object $\mathcal{A}$ (it has label $A$) to object with label $D \to A$ (that means the set of all functions from $D$ to $A$, written also as $A^D$). It maps arrow with label $f : A \to B$ to arrow with label $g : A^D \to B^D$, where $g(f) = \{f\circ h | h \in A^D\}$. Now observe, that $A \to B$ changed to $\mathcal{F}(A) \to \mathcal{F}(B)$, the order of the objects was preserved. To be more intuitive: in this example if $A \hookrightarrow A'$ then $\mathcal{F}(A) \hookrightarrow \mathcal{F}(A')$. To be even more clear $\mathbb{Z} \hookrightarrow \mathbb{R}$ so $\mathbb{Z}^D \hookrightarrow \mathbb{R}^D$ for any set $D$ -- any function with values in $\mathbb{Z}$ can be interpreted as function that has values in $\mathbb{R}$.

Now consider another functor $\mathcal{F}'$, that maps a object $\mathcal{A}$ to object with label $A \to D$ or $D^A$, but the arrow with label $f : A \to B$ is mapped to arrow with label $g : D^B \to D^A$, where $g(f) = \{h\circ f | h \in D^B\}$. The morphism $A \to B$ was transformed into $\mathcal{F}(B) \to \mathcal{F}(A)$. The ordering has reversed! Check: $A \hookrightarrow A'$ then $\mathcal{F}'(A) \hookleftarrow \mathcal{F}'(A')$, and to complete the example: $\mathbb{Z} \hookrightarrow \mathbb{R}$ so $D^\mathbb{Z} \hookleftarrow D^\mathbb{R}$ for any set $D$ -- any function that takes $\mathbb{R}$ as an argument, may take $\mathbb{Z}$ as an argument too.

Covariance means that the ordering will be preserved and contravariance means almost that the ordering will be reversed:

• covariant $\mathcal{F}$ maps $\mathcal{A}$ to $\mathcal{B}$ and $\mathcal{A} \to \mathcal{B}$ to $\mathcal{F}(\mathcal{A}) \to \mathcal{F}(\mathcal{B})$,
• contravariant functor $\mathcal{F}$ maps morphisms of the form $\mathcal{A} \to \mathcal{B}$ into morphisms of the form $\mathcal{F}(\mathcal{B}) \to \mathcal{F}(\mathcal{A})$.

The two example functors from above are very similar to $\mathbf{Hom}(\mathcal{D}, \cdot)$ and $\mathbf{Hom}(\cdot, \mathcal{D})$. As they are pretty common and very important, I think it might be a good exercise for you to try rewrite the above in the terms of $\mathbf{Hom}$. Some more information about them can be found in Wikipedia, the book I had recommended before, or any other book on Category Theory.

If you would have some more questions, ask in the comments. Also, there may be some typos in there, so be critical to what I have written.

Hope that helps ;-)

-