Inmathematics, specificallycategory theory, afunctor is amapping betweencategories. Functors were first considered inalgebraic topology, where algebraic objects (such as thefundamental group) are associated totopological spaces, and maps between these algebraic objects are associated tocontinuous maps between spaces. Nowadays, functors are used throughout modern mathematics to relate various categories. Thus, functors are important in all areas within mathematics to whichcategory theory is applied.
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 acontravariant functorF fromC toD as a mapping that
associates each object inC with an object inD,
associates each morphism inC with a morphism inD such that the following two conditions hold:
The composite of two functors of the same variance:
The composite of two functors of opposite variance:
Note that contravariant functors reverse the direction of composition.
Ordinary functors are also calledcovariant functors in order to distinguish them from contravariant ones. Note that one can also define a contravariant functor as acovariant functor on theopposite category.[5] Some authors prefer to write all expressions covariantly. That is, instead of saying is a contravariant functor, they simply write (or sometimes) and call it a functor.
Contravariant functors are also occasionally calledcofunctors.[6]
There is a convention which refers to "vectors"—i.e.,vector fields, elements of the space of sections of atangent bundle—as "contravariant" and to "covectors"—i.e.,1-forms, elements of the space of sections of acotangent bundle—as "covariant". This terminology originates in physics, and its rationale has to do with the position of the indices ("upstairs" and "downstairs") inexpressions such as for or for In this formalism it is observed that the coordinate transformation symbol (representing the matrix) acts on the "covector coordinates" "in the same way" as on the basis vectors:—whereas it acts "in the opposite way" on the "vector coordinates" (but "in the same way" as on the basis covectors:). This terminology is contrary to the one used in category theory because it is the covectors that havepullbacks in general and are thuscontravariant, whereas vectors in general arecovariant since they can bepushed forward. See alsoCovariance and contravariance of vectors.
Every functor induces theopposite functor, where and are theopposite categories to and.[7] By definition, maps objects and morphisms in the identical way as does. Since does not coincide with as a category, and similarly for, is distinguished from. For example, when composing with, one should use either or. Note that, following the property ofopposite category,.
Abifunctor (also known as abinary functor) is a functor whose domain is aproduct category. For example, theHom functor is of the typeCop ×C →Set. It can be seen as a functor intwo arguments; it is contravariant in one argument, covariant in the other.
Amultifunctor is a generalization of the functor concept ton variables. So, for example, a bifunctor is a multifunctor withn = 2.
iff is anisomorphism inC, thenF(f) is an isomorphism inD.
One can compose functors, i.e. ifF is a functor fromA toB andG is a functor fromB toC then one can form the composite functorG ∘F fromA toC. 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 thecategory of small categories.
A small category with a single object is the same thing as amonoid: 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 monoidhomomorphisms. So in a sense, functors between arbitrary categories are a kind of generalization of monoid homomorphisms to categories with more than one object.
For categoriesC andJ, aJ-presheaf onC is a contravariant functor.In the special case when J isSet, the category of sets and functions,D is called apresheaf onC.
Presheaves (over a topological space)
IfX is atopological space, then theopen sets inX form apartially ordered set Open(X) under inclusion. Like every partially ordered set, Open(X) forms a small category by adding a single arrowU →V if and only if. Contravariant functors on Open(X) are calledpresheaves onX. For instance, by assigning to every open setU theassociative algebra of real-valued continuous functions onU, one obtains a presheaf of algebras onX.
Constant functor
The functorC →D which maps every object ofC to a fixed objectX inD and every morphism inC to the identity morphism onX. Such a functor is called aconstant orselection functor.
Endofunctor
A functor that maps a category to that same category; e.g.,polynomial functor.
Identity functor
In categoryC, written 1C or idC, maps an object to itself and a morphism to itself. The identity functor is an endofunctor.
Diagonal functor
Thediagonal functor is defined as the functor fromD to the functor categoryDC which sends each object inD to the constant functor at that object.
Limit functor
For a fixedindex categoryJ, if every functorJ →C has alimit (for instance ifC is complete), then the limit functorCJ →C assigns to each functor its limit. The existence of this functor can be proved by realizing that it is theright-adjoint to thediagonal functor and invoking theFreyd adjoint functor theorem. This requires a suitable version of theaxiom 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 functorP :Set →Set maps each set to itspower set and each function to the map which sends to its image. One can also consider thecontravariant power set functor which sends to the map which sends to itsinverse image For example, if then. Suppose and. Then is the function which sends any subset of to its image, which in this case means, where denotes the mapping under, so this could also be written as. For the other values, Note that consequently generates thetrivial topology on. Also note that although the function in this example mapped to the power set of, that need not be the case in general.
Dual vector space
The map which assigns to everyvector space itsdual space and to everylinear map its dual or transpose is a contravariant functor from the category of all vector spaces over a fixedfield to itself.
Fundamental group
Consider the category ofpointed topological spaces, i.e. topological spaces with distinguished points. The objects are pairs(X,x0), whereX is a topological space andx0 is a point inX. A morphism from(X,x0) to(Y,y0) is given by acontinuous mapf :X →Y withf(x0) =y0. To every topological spaceX with distinguished pointx0, one can define thefundamental group based atx0, denotedπ1(X,x0). This is thegroup ofhomotopy classes of loops based atx0, with the group operation of concatenation. Iff :X →Y is a morphism ofpointed spaces, then every loop inX with base pointx0 can be composed withf to yield a loop inY with base pointy0. This operation is compatible with the homotopyequivalence relation and the composition of loops, and we get agroup homomorphism fromπ(X,x0) toπ(Y,y0). We thus obtain a functor from the category of pointed topological spaces to thecategory 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 thefundamentalgroupoid instead of the fundamental group, and this construction is functorial.
Algebra of continuous functions
A contravariant functor from the category oftopological spaces (with continuous maps as morphisms) to the category of realassociative algebras is given by assigning to every topological spaceX the algebra C(X) of all real-valued continuous functions on that space. Every continuous mapf :X →Y induces analgebra homomorphismC(f) : C(Y) → C(X) by the ruleC(f)(φ) =φ ∘f for everyφ in C(Y).
Tangent and cotangent bundles
The map which sends everydifferentiable manifold to itstangent bundle and everysmooth map to itsderivative is a covariant functor from the category of differentiable manifolds to the category ofvector bundles.Doing this constructions pointwise gives thetangent 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 thedual space above.
Group actions/representations
EverygroupG can be considered as a category with a single object whose morphisms are the elements ofG. A functor fromG toSet is then nothing but agroup action ofG on a particular set, i.e. aG-set. Likewise, a functor fromG to thecategory of vector spaces,VectK, is alinear representation ofG. In general, a functorG →C can be considered as an "action" ofG on an object in the categoryC. IfC 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
IfC denotes the category of vector spaces over a fixed field, withlinear maps as morphisms, then thetensor product defines a functorC ×C →C which is covariant in both arguments.[8]
Forgetful functors
The functorU :Grp →Set which maps agroup to its underlying set and agroup homomorphism to its underlying function of sets is a functor.[9] Functors like these, which "forget" some structure, are termedforgetful functors. Another example is the functorRng →Ab which maps aring to its underlying additiveabelian group. Morphisms inRng (ring homomorphisms) become morphisms inAb (abelian group homomorphisms).
Free functors
Going in the opposite direction of forgetful functors are free functors. The free functorF :Set →Grp sends every setX to thefree group generated byX. Functions get mapped to group homomorphisms between free groups. Free constructions exist for many categories based on structured sets. Seefree object.
Homomorphism groups
To every pairA,B ofabelian groups one can assign the abelian group Hom(A,B) consisting of allgroup homomorphisms fromA toB. This is a functor which is contravariant in the first and covariant in the second argument, i.e. it is a functorAbop ×Ab →Ab (whereAb denotes thecategory of abelian groups with group homomorphisms). Iff :A1 →A2 andg :B1 →B2 are morphisms inAb, then the group homomorphismHom(f,g):Hom(A2,B1) → Hom(A1,B2) is given byφ ↦g ∘φ ∘f. SeeHom functor.
Representable functors
We can generalize the previous example to any categoryC. To every pairX,Y of objects inC one can assign the setHom(X,Y) of morphisms fromX toY. This defines a functor toSet which is contravariant in the first argument and covariant in the second, i.e. it is a functorCop ×C →Set. Iff :X1 →X2 andg :Y1 →Y2 are morphisms inC, then the mapHom(f,g) : Hom(X2,Y1) → Hom(X1,Y2) is given byφ ↦g ∘φ ∘f. Functors like these are calledrepresentable functors. An important goal in many settings is to determine whether a given functor is representable.
LetC andD be categories. The collection of all functors fromC toD forms the objects of a category: thefunctor category. Morphisms in this category arenatural transformations between functors.