Functor
Inmathematics,specificallycategory theory,afunctoris amappingbetweencategories.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 tocontinuousmaps between spaces. Nowadays, functors are used throughout modern mathematics to relate various categories. Thus, functors are important in all areas within mathematics to whichcategory theoryis applied.
The wordscategoryandfunctorwere borrowed by mathematicians from the philosophersAristotleandRudolf Carnap,respectively.[1]The latter usedfunctorin alinguisticcontext;[2] seefunction word.
Definition[edit]
This articlemay be too technical for most readers to understand.(November 2023) |
LetCandDbecategories.AfunctorFfromCtoDis a mapping that[3]
- associates eachobjectinCto an objectinD,
- associates eachmorphisminCto a morphisminDsuch that the following two conditions hold:
- for every objectinC,
- for all morphismsandinC.
That is, functors must preserveidentity morphismsandcompositionof morphisms.
Covariance and contravariance[edit]
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 functorFfromCtoDas a mapping that
- associates each objectinCwith an objectinD,
- associates each morphisminCwith a morphisminDsuch that the following two conditions hold:
- for every objectinC,
- for all morphismsandinC.
Note that contravariant functors reverse the direction of composition.
Ordinary functors are also calledcovariant functorsin order to distinguish them from contravariant ones. Note that one can also define a contravariant functor as acovariantfunctor on theopposite category.[4]Some authors prefer to write all expressions covariantly. That is, instead of sayingis a contravariant functor, they simply write(or sometimes) and call it a functor.
Contravariant functors are also occasionally calledcofunctors.[5]
There is a convention which refers to "vectors" —i.e.,vector fields,elements of the space of sectionsof atangent bundle—as "contravariant" and to "covectors" —i.e.,1-forms,elements of the space of sectionsof acotangent bundle—as "covariant". This terminology originates in physics, and its rationale has to do with the position of the indices ( "upstairs" and "downstairs" ) inexpressionssuch asfororforIn 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 havepullbacksin general and are thuscontravariant,whereas vectors in general arecovariantsince they can bepushed forward.See alsoCovariance and contravariance of vectors.
Opposite functor[edit]
Every functorinduces theopposite functor,whereandare theopposite categoriestoand.[6]By definition,maps objects and morphisms in the identical way as does.Sincedoes not coincide withas a category, and similarly for,is distinguished from.For example, when composingwith,one should use eitheror.Note that, following the property ofopposite category,.
Bifunctors and multifunctors[edit]
Abifunctor(also known as abinary functor) is a functor whose domain is aproduct category.For example, theHom functoris of the typeCop×C→Set.It can be seen as a functor intwoarguments. TheHom functoris a natural example; it is contravariant in one argument, covariant in the other.
Amultifunctoris a generalization of the functor concept tonvariables. So, for example, a bifunctor is a multifunctor withn= 2.
Properties[edit]
Two important consequences of the functoraxiomsare:
- Ftransforms eachcommutative diagraminCinto a commutative diagram inD;
- iffis anisomorphisminC,thenF(f) is an isomorphism inD.
One can compose functors, i.e. ifFis a functor fromAtoBandGis a functor fromBtoCthen one can form the composite functorG∘FfromAtoC.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.
Examples[edit]
- Diagram
- For categoriesCandJ,a diagram of typeJinCis a covariant functor.
- (Category theoretical) presheaf
- For categoriesCandJ,aJ-presheaf onCis a contravariant functor.In the special case when J isSet,the category of sets and functions,Dis called apresheafonC.
- Presheaves (over a topological space)
- IfXis atopological space,then theopen setsinXform apartially ordered setOpen(X) under inclusion. Like every partially ordered set, Open(X) forms a small category by adding a single arrowU→Vif and only if.Contravariant functors on Open(X) are calledpresheavesonX.For instance, by assigning to every open setUtheassociative algebraof real-valued continuous functions onU,one obtains a presheaf of algebras onX.
- Constant functor
- The functorC→Dwhich maps every object ofCto a fixed objectXinDand every morphism inCto the identity morphism onX.Such a functor is called aconstantorselectionfunctor.
- Endofunctor
- A functor that maps a category to that same category; e.g.,polynomial functor.
- Identity functor
- In categoryC,written 1Cor idC,maps an object to itself and a morphism to itself. The identity functor is an endofunctor.
- Diagonal functor
- Thediagonal functoris defined as the functor fromDto the functor categoryDCwhich sends each object inDto the constant functor at that object.
- Limit functor
- For a fixedindex categoryJ,if every functorJ→Chas alimit(for instance ifCis complete), then the limit functorCJ→Cassigns to each functor its limit. The existence of this functor can be proved by realizing that it is theright-adjointto thediagonal functorand 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→Setmaps each set to itspower setand each functionto the map which sendsto its image.One can also consider thecontravariant power set functorwhich sendsto the map which sendsto itsinverse imageFor example, ifthen.Supposeand.Thenis the function which sends any subsetofto its image,which in this case means,wheredenotes the mapping under,so this could also be written as.For the other values,Note thatconsequently generates thetrivial topologyon.Also note that although the functionin 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 spaceitsdual spaceand to everylinear mapits dual or transpose is a contravariant functor from the category of all vector spaces over a fixedfieldto itself.
- Fundamental group
- Consider the category ofpointed topological spaces,i.e. topological spaces with distinguished points. The objects are pairs(X,x0),whereXis a topological space andx0is a point inX.A morphism from(X,x0)to(Y,y0)is given by acontinuousmapf:X→Ywithf(x0) =y0.To every topological spaceXwith distinguished pointx0,one can define thefundamental groupbased atx0,denotedπ1(X,x0).This is thegroupofhomotopyclasses of loops based atx0,with the group operation of concatenation. Iff:X→Yis a morphism ofpointed spaces,then every loop inXwith base pointx0can be composed withfto yield a loop inYwith base pointy0.This operation is compatible with the homotopyequivalence relationand the composition of loops, and we get agroup homomorphismfromπ(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 thefundamentalgroupoidinstead 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 algebrasis given by assigning to every topological spaceXthe algebra C(X) of all real-valued continuous functions on that space. Every continuous mapf:X→Yinduces analgebra homomorphismC(f): C(Y) → C(X)by the ruleC(f)(φ) =φ∘ffor everyφin C(Y).
- Tangent and cotangent bundles
- The map which sends everydifferentiable manifoldto itstangent bundleand everysmooth mapto itsderivativeis 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 spaceis a contravariant functor, essentially the composition of the tangent space with thedual spaceabove.
- Group actions/representations
- EverygroupGcan be considered as a category with a single object whose morphisms are the elements ofG.A functor fromGtoSetis then nothing but agroup actionofGon a particular set, i.e. aG-set. Likewise, a functor fromGto thecategory of vector spaces,VectK,is alinear representationofG.In general, a functorG→Ccan be considered as an "action" ofGon an object in the categoryC.IfCis a group, then this action is a group homomorphism.
- Lie algebras
- Assigning to every real (complex)Lie groupits real (complex)Lie algebradefines a functor.
- Tensor products
- IfCdenotes the category of vector spaces over a fixed field, withlinear mapsas morphisms, then thetensor productdefines a functorC×C→Cwhich is covariant in both arguments.[7]
- Forgetful functors
- The functorU:Grp→Setwhich maps agroupto its underlying set and agroup homomorphismto its underlying function of sets is a functor.[8]Functors like these, which "forget" some structure, are termedforgetful functors.Another example is the functorRng→Abwhich maps aringto 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→Grpsends every setXto thefree groupgenerated 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,Bofabelian groupsone can assign the abelian group Hom(A,B) consisting of allgroup homomorphismsfromAtoB.This is a functor which is contravariant in the first and covariant in the second argument, i.e. it is a functorAbop×Ab→Ab(whereAbdenotes thecategory of abelian groupswith group homomorphisms). Iff:A1→A2andg:B1→B2are 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,Yof objects inCone can assign the setHom(X,Y)of morphisms fromXtoY.This defines a functor toSetwhich is contravariant in the first argument and covariant in the second, i.e. it is a functorCop×C→Set.Iff:X1→X2andg:Y1→Y2are 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.
Relation to other categorical concepts[edit]
LetCandDbe categories. The collection of all functors fromCtoDforms the objects of a category: thefunctor category.Morphisms in this category arenatural transformationsbetween functors.
Functors are often defined byuniversal properties;examples are thetensor product,thedirect sumanddirect productof groups or vector spaces, construction of free groups and modules,directandinverselimits. The concepts oflimit and colimitgeneralize several of the above.
Universal constructions often give rise to pairs ofadjoint functors.
Computer implementations[edit]
Functors sometimes appear infunctional programming.For instance, the programming languageHaskellhas aclassFunctor
wherefmap
is apolytypic functionused to mapfunctions(morphismsonHask,the category of Haskell types)[9]between existing types to functions between some new types.[10]
See also[edit]
Notes[edit]
- ^Mac Lane, Saunders(1971),Categories for the Working Mathematician,New York: Springer-Verlag, p. 30,ISBN978-3-540-90035-1
- ^Carnap, Rudolf(1937).The Logical Syntax of Language,Routledge & Kegan, pp. 13–14.
- ^Jacobson (2009),p. 19, def. 1.2.
- ^Jacobson (2009),pp. 19–20.
- ^Popescu, Nicolae; Popescu, Liliana (1979).Theory of categories.Dordrecht: Springer. p. 12.ISBN9789400995505.Retrieved23 April2016.
- ^Mac Lane, Saunders;Moerdijk, Ieke(1992),Sheaves in geometry and logic: a first introduction to topos theory,Springer,ISBN978-0-387-97710-2
- ^Hazewinkel, Michiel;Gubareni, Nadezhda Mikhaĭlovna;Gubareni, Nadiya;Kirichenko, Vladimir V.(2004),Algebras, rings and modules,Springer,ISBN978-1-4020-2690-4
- ^Jacobson (2009),p. 20, ex. 2.
- ^It's not entirely clear that Haskell datatypes truly form a category. Seehttps://wiki.haskell.org/Haskfor more details.
- ^Seehttps://wiki.haskell.org/Category_theory/Functor#Functors_in_Haskellfor more information.
References[edit]
- Jacobson, Nathan(2009),Basic algebra,vol. 2 (2nd ed.), Dover,ISBN978-0-486-47187-7.
External links[edit]
- "Functor",Encyclopedia of Mathematics,EMS Press,2001 [1994]
- seefunctorat thenLaband the variations discussed and linked to there.
- André Joyal,CatLab,a wiki project dedicated to the exposition of categorical mathematics
- Hillman, Chris (2001)."A Categorical Primer".CiteSeerX10.1.1.24.3264.Archived fromthe originalon 1997-05-03.
- J. Adamek, H. Herrlich, G. Stecker,Abstract and Concrete Categories-The Joy of CatsArchived2015-04-21 at theWayback Machine
- Stanford Encyclopedia of Philosophy:"Category Theory"— by Jean-Pierre Marquis. Extensive bibliography.
- List of academic conferences on category theory
- Baez, John, 1996, "The Tale ofn-categories."An informal introduction to higher order categories.
- WildCatsis acategory theorypackage forMathematica.Manipulation and visualization of objects,morphisms,categories, functors,natural transformations,universal properties.
- The catsters,a YouTube channel about category theory.
- Video archiveof recorded talks relevant to categories, logic and the foundations of physics.
- Interactive Web pagewhich generates examples of categorical constructions in the category of finite sets.