# Functor

Last updated

In mathematics, specifically category theory, a functor is a mapping between categories. Functors were first considered in algebraic topology, where algebraic objects (such as the fundamental group) are associated to topological spaces, and maps between these algebraic objects are associated to continuous maps between spaces. Nowadays, functors are used throughout modern mathematics to relate various categories. Thus, functors are important in all areas within mathematics to which category theory is applied.

## Contents

The words category and functor were borrowed by mathematicians from the philosophers Aristotle and Rudolf Carnap, respectively. [1] The latter used functor in a linguistic context; [2] see function word.

## Definition

Let C and D be categories. A functorF from C to D is a mapping that [3]

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

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

### Covariance and contravariance

There are many constructions in mathematics that would be functors but for the fact that they "turn morphisms around" and "reverse composition". We then define a contravariant functorF from C to D as a mapping that

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

Note that contravariant functors reverse the direction of composition.

Ordinary functors are also called covariant functors in order to distinguish them from contravariant ones. Note that one can also define a contravariant functor as a covariant functor on the opposite category ${\displaystyle C^{\mathrm {op} }}$. [4] Some authors prefer to write all expressions covariantly. That is, instead of saying ${\displaystyle F\colon C\to D}$ is a contravariant functor, they simply write ${\displaystyle F\colon C^{\mathrm {op} }\to D}$ (or sometimes ${\displaystyle F\colon C\to D^{\mathrm {op} }}$) and call it a functor.

Contravariant functors are also occasionally called cofunctors. [5]

There is a convention which refers to "vectors"—i.e., vector fields, elements of the space of sections ${\displaystyle \Gamma (TM)}$ of a tangent bundle ${\displaystyle TM}$—as "contravariant" and to "covectors"—i.e., 1-forms, elements of the space of sections ${\displaystyle \Gamma (T^{*}M)}$ of a cotangent bundle ${\displaystyle T^{*}M}$—as "covariant". This terminology originates in physics, and its rationale has to do with the position of the indices ("upstairs" and "downstairs") in expressions such as ${\displaystyle x'^{\,i}=\Lambda _{j}^{i}x^{j}}$ for ${\displaystyle \mathbf {x} '={\boldsymbol {\Lambda }}\mathbf {x} }$ or ${\displaystyle \omega '_{i}=\Lambda _{i}^{j}\omega _{j}}$ for ${\displaystyle {\boldsymbol {\omega }}'={\boldsymbol {\omega }}{\boldsymbol {\Lambda }}^{T}.}$ In this formalism it is observed that the coordinate transformation symbol ${\displaystyle \Lambda _{i}^{j}}$ (representing the matrix ${\displaystyle {\boldsymbol {\Lambda }}^{T}}$) acts on the basis vectors "in the same way" as on the "covector coordinates": ${\displaystyle \mathbf {e} _{i}=\Lambda _{i}^{j}\mathbf {e} _{j}}$—whereas it acts "in the opposite way" on the "vector coordinates" (but "in the same way" as on the basis covectors: ${\displaystyle \mathbf {e} ^{i}=\Lambda _{j}^{i}\mathbf {e} ^{j}}$). This terminology is contrary to the one used in category theory because it is the covectors that have pullbacks in general and are thus contravariant, whereas vectors in general are covariant since they can be pushed forward. See also Covariance and contravariance of vectors.

### Opposite functor

Every functor ${\displaystyle F\colon C\to D}$ induces the opposite functor${\displaystyle F^{\mathrm {op} }\colon C^{\mathrm {op} }\to D^{\mathrm {op} }}$, where ${\displaystyle C^{\mathrm {op} }}$ and ${\displaystyle D^{\mathrm {op} }}$ are the opposite categories to ${\displaystyle C}$ and ${\displaystyle D}$. [6] By definition, ${\displaystyle F^{\mathrm {op} }}$ maps objects and morphisms identically to ${\displaystyle F}$. Since ${\displaystyle C^{\mathrm {op} }}$ does not coincide with ${\displaystyle C}$ as a category, and similarly for ${\displaystyle D}$, ${\displaystyle F^{\mathrm {op} }}$ is distinguished from ${\displaystyle F}$. For example, when composing ${\displaystyle F\colon C_{0}\to C_{1}}$ with ${\displaystyle G\colon C_{1}^{\mathrm {op} }\to C_{2}}$, one should use either ${\displaystyle G\circ F^{\mathrm {op} }}$ or ${\displaystyle G^{\mathrm {op} }\circ F}$. Note that, following the property of opposite category, ${\displaystyle (F^{\mathrm {op} })^{\mathrm {op} }=F}$.

### Bifunctors and multifunctors

A bifunctor (also known as a binary functor) is a functor whose domain is a product category. For example, the Hom functor is of the type Cop × CSet. It can be seen as a functor in two arguments. The Hom functor is a natural example; it is contravariant in one argument, covariant in the other.

A multifunctor is a generalization of the functor concept to n variables. So, for example, a bifunctor is a multifunctor with n = 2.

## Examples

Diagram : For categories C and J, a diagram of type J in C is a covariant functor ${\displaystyle D\colon J\to C}$.

(Category theoretical) presheaf : For categories C and J, a J-presheaf on C is a contravariant functor ${\displaystyle D\colon C\to J}$.

Presheaves: If X is a topological space, then the open sets in X form a partially ordered set Open(X) under inclusion. Like every partially ordered set, Open(X) forms a small category by adding a single arrow UV if and only if ${\displaystyle U\subseteq V}$. Contravariant functors on Open(X) are called presheaves on X. For instance, by assigning to every open set U the associative algebra of real-valued continuous functions on U, one obtains a presheaf of algebras on X.

Constant functor: The functor CD which maps every object of C to a fixed object X in D and every morphism in C to the identity morphism on X. Such a functor is called a constant or selection functor.

Endofunctor: A functor that maps a category to that same category; e.g., polynomial functor.

Identity functor: in category C, written 1C or idC, maps an object to itself and a morphism to itself. The identity functor is an endofunctor.

Diagonal functor: The diagonal functor is defined as the functor from D to the functor category DC which sends each object in D to the constant functor at that object.

Limit functor: For a fixed index category J, if every functor JC has a limit (for instance if C is complete), then the limit functor CJC assigns to each functor its limit. The existence of this functor can be proved by realizing that it is the right-adjoint to the diagonal functor and invoking the Freyd adjoint functor theorem. This requires a suitable version of the axiom of choice. Similar remarks apply to the colimit functor (which assigns to every functor its colimit, and is covariant).

Power sets functor: The power set functor P : SetSet maps each set to its power set and each function ${\displaystyle f\colon X\to Y}$ to the map which sends ${\displaystyle U\in {\mathcal {P}}(X)}$ to its image ${\displaystyle f(U)\in {\mathcal {P}}(Y)}$. One can also consider the contravariant power set functor which sends ${\displaystyle f\colon X\to Y}$ to the map which sends ${\displaystyle V\subseteq Y}$ to its inverse image ${\displaystyle f^{-1}(V)\subseteq X.}$

For example, if ${\displaystyle X=\{0,1\}}$ then ${\displaystyle F(X)={\mathcal {P}}(X)=\{\{\},\{0\},\{1\},X\}}$. Suppose ${\displaystyle f(0)=\{\}}$ and ${\displaystyle f(1)=X}$. Then ${\displaystyle F(f)}$ is the function which sends any subset ${\displaystyle U}$ of ${\displaystyle X}$ to its image ${\displaystyle f(U)}$, which in this case means ${\displaystyle \{\}\mapsto f(\{\})=\{\}}$, where ${\displaystyle \mapsto }$ denotes the mapping under ${\displaystyle F(f)}$, so this could also be written as ${\displaystyle (F(f))(\{\})=\{\}}$. For the other values, ${\displaystyle \{0\}\mapsto f(\{0\})=\{f(0)\}=\{\{\}\},\{1\}\mapsto f(\{1\})=\{f(1)\}=\{X\},\{0,1\}\mapsto f(\{0,1\})=\{f(0),f(1)\}=\{\{\},X\}.}$ Note that ${\displaystyle f(\{0,1\})}$ consequently generates the trivial topology on ${\displaystyle X}$. Also note that although the function ${\displaystyle f}$ in this example mapped to the power set of ${\displaystyle X}$, that need not be the case in general.

Dual vector space: The map which assigns to every vector space its dual space and to every linear map its dual or transpose is a contravariant functor from the category of all vector spaces over a fixed field to itself.

Fundamental group: Consider the category of pointed topological spaces, i.e. topological spaces with distinguished points. The objects are pairs (X, x0), where X is a topological space and x0 is a point in X. A morphism from (X, x0) to (Y, y0) is given by a continuous map f : XY with f(x0) = y0.

To every topological space X with distinguished point x0, one can define the fundamental group based at x0, denoted π1(X, x0). This is the group of homotopy classes of loops based at x0, with the group operation of concatenation. If f : XY is a morphism of pointed spaces, then every loop in X with base point x0 can be composed with f to yield a loop in Y with base point y0. This operation is compatible with the homotopy equivalence relation and the composition of loops, and we get a group homomorphism from π(X, x0) to π(Y, y0). We thus obtain a functor from the category of pointed topological spaces to the category of groups.

In the category of topological spaces (without distinguished point), one considers homotopy classes of generic curves, but they cannot be composed unless they share an endpoint. Thus one has the fundamental groupoid instead of the fundamental group, and this construction is functorial.

Algebra of continuous functions: a contravariant functor from the category of topological spaces (with continuous maps as morphisms) to the category of real associative algebras is given by assigning to every topological space X the algebra C(X) of all real-valued continuous functions on that space. Every continuous map f : XY induces an algebra homomorphism C(f) : C(Y) → C(X) by the rule C(f)(φ) = φf for every φ in C(Y).

Tangent and cotangent bundles: The map which sends every differentiable manifold to its tangent bundle and every smooth map to its derivative is a covariant functor from the category of differentiable manifolds to the category of vector bundles.

Doing this constructions pointwise gives the tangent space, a covariant functor from the category of pointed differentiable manifolds to the category of real vector spaces. Likewise, cotangent space is a contravariant functor, essentially the composition of the tangent space with the dual space above.

Group actions/representations: Every group G can be considered as a category with a single object whose morphisms are the elements of G. A functor from G to Set is then nothing but a group action of G on a particular set, i.e. a G-set. Likewise, a functor from G to the category of vector spaces, VectK, is a linear representation of G. In general, a functor GC can be considered as an "action" of G on an object in the category C. If C is a group, then this action is a group homomorphism.

Lie algebras: Assigning to every real (complex) Lie group its real (complex) Lie algebra defines a functor.

Tensor products: If C denotes the category of vector spaces over a fixed field, with linear maps as morphisms, then the tensor product ${\displaystyle V\otimes W}$ defines a functor C × CC which is covariant in both arguments. [7]

Forgetful functors: The functor U : GrpSet which maps a group to its underlying set and a group homomorphism to its underlying function of sets is a functor. [8] Functors like these, which "forget" some structure, are termed forgetful functors . Another example is the functor RngAb which maps a ring to its underlying additive abelian group. Morphisms in Rng (ring homomorphisms) become morphisms in Ab (abelian group homomorphisms).

Free functors: Going in the opposite direction of forgetful functors are free functors. The free functor F : SetGrp sends every set X to the free group generated by X. Functions get mapped to group homomorphisms between free groups. Free constructions exist for many categories based on structured sets. See free object.

Homomorphism groups: To every pair A, B of abelian groups one can assign the abelian group Hom(A, B) consisting of all group homomorphisms from A to B. This is a functor which is contravariant in the first and covariant in the second argument, i.e. it is a functor Abop × AbAb (where Ab denotes the category of abelian groups with group homomorphisms). If f : A1A2 and g : B1B2 are morphisms in Ab, then the group homomorphism Hom(f, g): Hom(A2, B1) → Hom(A1, B2) is given by φgφf. See Hom functor.

Representable functors: We can generalize the previous example to any category C. To every pair X, Y of objects in C one can assign the set Hom(X, Y) of morphisms from X to Y. This defines a functor to Set which is contravariant in the first argument and covariant in the second, i.e. it is a functor Cop × CSet. If f : X1X2 and g : Y1Y2 are morphisms in C, then the map Hom(f, g) : Hom(X2, Y1) → Hom(X1, Y2) is given by φgφf.

Functors like these are called representable functors. An important goal in many settings is to determine whether a given functor is representable.

## Properties

Two important consequences of the functor axioms are:

One can compose functors, i.e. if F is a functor from A to B and G is a functor from B to C then one can form the composite functor GF from A to C. Composition of functors is associative where defined. Identity of composition of functors is the identity functor. This shows that functors can be considered as morphisms in categories of categories, for example in the category of small categories.

A small category with a single object is the same thing as a monoid: the morphisms of a one-object category can be thought of as elements of the monoid, and composition in the category is thought of as the monoid operation. Functors between one-object categories correspond to monoid homomorphisms. So in a sense, functors between arbitrary categories are a kind of generalization of monoid homomorphisms to categories with more than one object.

## Relation to other categorical concepts

Let C and D be categories. The collection of all functors from C to D forms the objects of a category: the functor category. Morphisms in this category are natural transformations between functors.

Functors are often defined by universal properties; examples are the tensor product, the direct sum and direct product of groups or vector spaces, construction of free groups and modules, direct and inverse limits. The concepts of limit and colimit generalize several of the above.

Universal constructions often give rise to pairs of adjoint functors.

## Computer implementations

Functors sometimes appear in functional programming. For instance, the programming language Haskell has a class Functor where fmap is a polytypic function used to map functions (morphisms on Hask, the category of Haskell types) [9] between existing types to functions between some new types. [10]

## Notes

1. Mac Lane, Saunders (1971), Categories for the Working Mathematician, New York: Springer-Verlag, p. 30, ISBN   978-3-540-90035-1
2. Carnap, Rudolf (1937). The Logical Syntax of Language, Routledge & Kegan, pp. 13–14.
3. Jacobson (2009), p. 19, def. 1.2.
4. Jacobson (2009), pp. 19–20.
5. Popescu, Nicolae; Popescu, Liliana (1979). Theory of categories. Dordrecht: Springer. p. 12. ISBN   9789400995505 . Retrieved 23 April 2016.
6. Mac Lane, Saunders; Moerdijk, Ieke (1992), Sheaves in geometry and logic: a first introduction to topos theory, Springer, ISBN   978-0-387-97710-2
7. Hazewinkel, Michiel; Gubareni, Nadezhda Mikhaĭlovna; Gubareni, Nadiya; Kirichenko, Vladimir V. (2004), Algebras, rings and modules, Springer, ISBN   978-1-4020-2690-4
8. Jacobson (2009), p. 20, ex. 2.
9. It's not entirely clear that Haskell datatypes truly form a category. See https://wiki.haskell.org/Hask for more details.

## Related Research Articles

In mathematics, the Yoneda lemma is arguably the most important result in category theory. It is an abstract result on functors of the type morphisms into a fixed object. It is a vast generalisation of Cayley's theorem from group theory. It allows the embedding of any locally small category into a category of functors defined on that category. It also clarifies how the embedded category, of representable functors and their natural transformations, relates to the other objects in the larger functor category. It is an important tool that underlies several modern developments in algebraic geometry and representation theory. It is named after Nobuo Yoneda.

In category theory, a branch of mathematics, a natural transformation provides a way of transforming one functor into another while respecting the internal structure of the categories involved. Hence, a natural transformation can be considered to be a "morphism of functors". Indeed, this intuition can be formalized to define so-called functor categories. Natural transformations are, after categories and functors, one of the most fundamental notions of category theory and consequently appear in the majority of its applications.

In mathematics, specifically category theory, adjunction is a relationship that two functors may have. Two functors that stand in this relationship are known as adjoint functors, one being the left adjoint and the other the right adjoint. Pairs of adjoint functors are ubiquitous in mathematics and often arise from constructions of "optimal solutions" to certain problems, such as the construction of a free group on a set in algebra, or the construction of the Stone–Čech compactification of a topological space in topology.

Homological algebra is the branch of mathematics that studies homology in a general algebraic setting. It is a relatively young discipline, whose origins can be traced to investigations in combinatorial topology and abstract algebra at the end of the 19th century, chiefly by Henri Poincaré and David Hilbert.

In mathematics, a direct limit is a way to construct a object from many objects that are put together in a specific way. These objects may be groups, rings, vector spaces or in general objects from any category. The way they are put together is specified by a system of homomorphisms between those smaller objects. The direct limit of the objects , where ranges over some directed set , is denoted by .

In category theory, the coproduct, or categorical sum, is a construction which includes as examples the disjoint union of sets and of topological spaces, the free product of groups, and the direct sum of modules and vector spaces. The coproduct of a family of objects is essentially the "least specific" object to which each object in the family admits a morphism. It is the category-theoretic dual notion to the categorical product, which means the definition is the same as the product but with all arrows reversed. Despite this seemingly innocuous change in the name and notation, coproducts can be and typically are dramatically different from products.

In category theory, a branch of mathematics, a monad is an endofunctor, together with two natural transformations required to fulfill certain coherence conditions. Monads are used in the theory of pairs of adjoint functors, and they generalize closure operators on partially ordered sets to arbitrary categories.

In category theory, a branch of mathematics, the opposite category or dual categoryCop of a given category C is formed by reversing the morphisms, i.e. interchanging the source and target of each morphism. Doing the reversal twice yields the original category, so the opposite of an opposite category is the original category itself. In symbols, .

In category theory, an abstract branch of mathematics, an equivalence of categories is a relation between two categories that establishes that these categories are "essentially the same". There are numerous examples of categorical equivalences from many areas of mathematics. Establishing an equivalence involves demonstrating strong similarities between the mathematical structures concerned. In some cases, these structures may appear to be unrelated at a superficial or intuitive level, making the notion fairly powerful: it creates the opportunity to "translate" theorems between different kinds of mathematical structures, knowing that the essential meaning of those theorems is preserved under the translation.

In mathematics, the Ext functors are the derived functors of the Hom functor. Along with the Tor functor, Ext is one of the core concepts of homological algebra, in which ideas from algebraic topology are used to define invariants of algebraic structures. The cohomology of groups, Lie algebras, and associative algebras can all be defined in terms of Ext. The name comes from the fact that the first Ext group Ext1 classifies extensions of one module by another.

In mathematics, particularly category theory, a representable functor is a certain functor from an arbitrary category into the category of sets. Such functors give representations of an abstract category in terms of known structures allowing one to utilize, as much as possible, knowledge about the category of sets in other settings.

In category theory, a faithful functor is a functor that is injective when restricted to each set of morphisms that have a given source and target.

In mathematics, a simplicial set is an object made up of "simplices" in a specific way. Simplicial sets are higher-dimensional generalizations of directed graphs, partially ordered sets and categories. Formally, a simplicial set may be defined as a contravariant functor from the simplex category to the category of sets. Simplicial sets were introduced in 1950 by Samuel Eilenberg and J. A. Zilber.

In mathematics, a triangulated category is a category with the additional structure of a "translation functor" and a class of "exact triangles". Prominent examples are the derived category of an abelian category, as well as the stable homotopy category. The exact triangles generalize the short exact sequences in an abelian category, as well as fiber sequences and cofiber sequences in topology.

Fibred categories are abstract entities in mathematics used to provide a general framework for descent theory. They formalise the various situations in geometry and algebra in which inverse images of objects such as vector bundles can be defined. As an example, for each topological space there is the category of vector bundles on the space, and for every continuous map from a topological space X to another topological space Y is associated the pullback functor taking bundles on Y to bundles on X. Fibred categories formalise the system consisting of these categories and inverse image functors. Similar setups appear in various guises in mathematics, in particular in algebraic geometry, which is the context in which fibred categories originally appeared. Fibered categories are used to define stacks, which are fibered categories with "descent". Fibrations also play an important role in categorical semantics of type theory, and in particular that of dependent type theories.

In mathematics, specifically in category theory, an exponential object or map object is the categorical generalization of a function space in set theory. Categories with all finite products and exponential objects are called cartesian closed categories. Categories without adjoined products may still have an exponential law.

This is a glossary of properties and concepts in category theory in mathematics.

In mathematics, specifically in category theory, hom-sets, i.e. sets of morphisms between objects, give rise to important functors to the category of sets. These functors are called hom-functors and have numerous applications in category theory and other branches of mathematics.

In category theory, a branch of mathematics, a presheaf on a category is a functor . If is the poset of open sets in a topological space, interpreted as a category, then one recovers the usual notion of presheaf on a topological space.

In algebraic geometry, a functor represented by a schemeX is a set-valued contravariant functor on the category of schemes such that the value of the functor at each scheme S is the set of all morphisms . The scheme X is then said to represent the functor and that classify geometric objects over S given by F.