Recent from talks
Nothing was collected or created yet.
Functor
View on WikipediaIn 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 every area of mathematics where category theory is applied.
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
[edit]

Let C and D be categories. A functor F from C to D is a mapping that:[3]
- associates each object in C to an object in D,
- associates each morphism in C to a morphism in D such that the following two conditions hold:
- for every object in C,
- for all morphisms and in C.
That is, functors must preserve identity morphisms and composition of 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 a contravariant functor F from C to D as a mapping that
- associates each object in C with an object in D,
- associates each morphism in C with a morphism in D such that the following two conditions hold:
- for every object in C,
- for all morphisms and in C.
Variance of functor (composite)[4]
- 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 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 .[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 called cofunctors.[6]
There is a convention which refers to "vectors"—i.e., vector fields, elements of the space of sections of a tangent bundle —as "contravariant" and to "covectors"—i.e., 1-forms, elements of the space of sections of a cotangent bundle —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 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 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
[edit]Every functor induces the opposite functor , where and are the opposite 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 of opposite category, .
Bifunctors and multifunctors
[edit]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 × C → Set. It can be seen as a functor in two arguments; 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.
Properties
[edit]Two important consequences of the functor axioms are:
- F transforms each commutative diagram in C into a commutative diagram in D;
- if f is an isomorphism in C, then F(f) is an isomorphism in D.
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 G ∘ F 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.
Examples
[edit]- Diagram
- For categories C and J, a diagram of type J in C is a covariant functor .
- (Category theoretical) presheaf
- For categories C and J, a J-presheaf on C is a contravariant functor .In the special case when J is Set, the category of sets and functions, D is called a presheaf on C.
- Presheaves (over a topological space)
- 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 U → V if and only if . 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 C → D 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 J → C has a limit (for instance if C is complete), then the limit functor CJ → C 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 : Set → Set maps each set to its power set and each function to the map which sends to its image . One can also consider the contravariant power set functor which sends to the map which sends to its inverse 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 the trivial 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 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 : X → Y 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 : X → Y 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 : X → Y 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 G → C 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 defines a functor C × C → C which is covariant in both arguments.[8]
- Forgetful functors
- The functor U : Grp → Set which maps a group to its underlying set and a group homomorphism to its underlying function of sets is a functor.[9] Functors like these, which "forget" some structure, are termed forgetful functors. Another example is the functor Rng → Ab 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 : Set → Grp 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 × Ab → Ab (where Ab denotes the category of abelian groups with group homomorphisms). If f : A1 → A2 and g : B1 → B2 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 × C → Set. If f : X1 → X2 and g : Y1 → Y2 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.
Relation to other categorical concepts
[edit]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
[edit]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)[10] between existing types to functions between some new types.[11]
See also
[edit]Notes
[edit]- ^ Mac Lane, Saunders (1971), Categories for the Working Mathematician, New York: Springer-Verlag, p. 30, ISBN 978-3-540-90035-1
- ^ Carnap, Rudolf (1937). The Logical Syntax of Language, Routledge & Kegan, pp. 13–14.
- ^ Jacobson (2009), p. 19, def. 1.2.
- ^ Simmons (2011), Exercise 3.1.4.
- ^ Jacobson (2009), pp. 19–20.
- ^ Popescu, Nicolae; Popescu, Liliana (1979). Theory of categories. Dordrecht: Springer. p. 12. ISBN 9789400995505. Retrieved 23 April 2016.
- ^ Mac Lane, Saunders; Moerdijk, Ieke (1992), Sheaves in geometry and logic: a first introduction to topos theory, Springer, ISBN 978-0-387-97710-2
- ^ Hazewinkel, Michiel; Gubareni, Nadezhda Mikhaĭlovna; Gubareni, Nadiya; Kirichenko, Vladimir V. (2004), Algebras, rings and modules, Springer, ISBN 978-1-4020-2690-4
- ^ Jacobson (2009), p. 20, ex. 2.
- ^ It's not entirely clear that Haskell datatypes truly form a category. See https://wiki.haskell.org/Hask for more details.
- ^ See https://wiki.haskell.org/Category_theory/Functor#Functors_in_Haskell for more information.
References
[edit]- Jacobson, Nathan (2009), Basic algebra, vol. 2 (2nd ed.), Dover, ISBN 978-0-486-47187-7.
- Simmons, Harold (2011), "Functors and natural transformations", An Introduction to Category Theory, pp. 72–107, doi:10.1017/CBO9780511863226.004, ISBN 978-1-107-01087-1
External links
[edit]- "Functor", Encyclopedia of Mathematics, EMS Press, 2001 [1994]
- see functor at the nLab and 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". CiteSeerX 10.1.1.24.3264. Archived from the original on 1997-05-03.
- J. Adamek, H. Herrlich, G. Stecker, Abstract and Concrete Categories-The Joy of Cats Archived 2015-04-21 at the Wayback 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 of n-categories." An informal introduction to higher order categories.
- WildCats is a category theory package for Mathematica. Manipulation and visualization of objects, morphisms, categories, functors, natural transformations, universal properties.
- The catsters, a YouTube channel about category theory.
- Video archive of recorded talks relevant to categories, logic and the foundations of physics.
- Interactive Web page which generates examples of categorical constructions in the category of finite sets.
Functor
View on GrokipediaDefinition and Basics
Formal Definition
In category theory, a functor from a category (the domain category) to a category (the codomain category) consists of two mappings: one that sends each object of to an object of , and one that sends each morphism in to a morphism in .[4] This structure ensures that the mapping respects the categorical composition and identities.[4] Specifically, functors preserve identity morphisms, meaning that for every object in , .[4] They also preserve composition of morphisms: if and are morphisms in , then .[4] Functors are commonly notated with to indicate the action on objects and simply applied to arrows for morphisms.[4] The concept was introduced by Samuel Eilenberg and Saunders Mac Lane in their 1945 paper "General Theory of Natural Equivalences," establishing the foundational framework for mappings between categories in category theory.[5]Covariant and Contravariant Functors
In category theory, a covariant functor between categories and acts on morphisms by preserving their direction: it maps a morphism in to a morphism in .[6] This preserves the order of composition, so that for composable morphisms and in .[6] A contravariant functor, by contrast, reverses the direction of morphisms: it maps to .[7] Formally, a contravariant functor from to is equivalent to a covariant functor from to the opposite category , or equivalently from to .[7] Consequently, its action on composition reverses the order: .[8] An illustrative example of a naturally contravariant functor arises in linear algebra, where the dual space construction sends a vector space over a field to its dual , the space of linear functionals . For a linear map , it induces the dual map defined by for , thereby reversing the morphism direction.[9][8]Properties
Preservation and Naturality
A functor between categories and must preserve the identity morphisms and the composition of morphisms as part of its defining axioms.[3] Specifically, for every object in , in , and for any composable morphisms and in , in .[10] These preservation requirements ensure that maintains the structural relations of within , enabling the formation of concepts such as faithful functors, where is injective on hom-sets, and full functors, where is surjective on hom-sets, though these are stronger properties beyond the basic axioms.[10] Natural transformations provide a way to compare parallel functors by serving as morphisms in the functor category.[3] A natural transformation consists of a family of morphisms in , one for each object in , satisfying the naturality condition: for every morphism in , this square commutes, meaning .[10] The commutative property of the naturality square guarantees that respects the action of morphisms across the functors, preserving their relational structure.[3] If each component is an isomorphism in , then is a natural isomorphism, denoted , indicating that and are equivalent up to canonical isomorphism.[10] Two functors are equivalent if there exists a natural isomorphism between them, capturing an essential similarity in how they map the structure of to .[3]Functor Categories
In category theory, the functor category, often denoted or , is defined such that its objects are all functors , and its morphisms are natural transformations between these functors.[11] This construction organizes the functors from one category to another into a category of their own, where the identity morphism on a functor is the identity natural transformation , satisfying for each object in .[11] The composition in the functor category is induced by the vertical composition of natural transformations: given natural transformations and between functors , their composite is the natural transformation whose component at each object is .[11] Furthermore, the composition of functors between categories induces a corresponding structure on functor categories; specifically, for functors and , the composite functor serves as an object in , and this operation aligns with the categorical composition when considering functors between functor categories themselves.[12] Examples of small functor categories include , the category whose objects are functors from the category of finite sets and bijections (often denoted B or core(FinSet)) to the category of sets (Set), with natural transformations as morphisms; such functors correspond to combinatorial structures that assign sets to finite sets in a way preserving the category's operations. This category is particularly useful in enumerative combinatorics, as its objects can model species of structures on finite sets.[13] Key properties of functor categories include their size and local smallness: if both and are small categories, then is itself small.[12] More generally, if is small and is locally small, then is locally small, meaning the hom-sets between any two objects are small sets.[12] Regarding variance, the functor category construction exhibits contravariance in the domain category ; for instance, a functor induces a precomposition functor given by , while it is covariant in the codomain , as a functor induces postcomposition .[11] For contravariant functors from to , the appropriate category is , reflecting the opposite category in the indexing.[11]Variants
Opposite Functors
The opposite category of a given category is constructed by retaining the same collection of objects as , while formally reversing the direction of all morphisms. Specifically, for every morphism in , there exists a corresponding morphism denoted in . The identity morphism in becomes in , and composition is defined such that if and are morphisms in , then in . This construction ensures that is indeed a category, with the reversal providing a dual perspective on the structure of .[14] A contravariant functor from a category to a category is equivalent to a covariant functor from the opposite category to , or alternatively, from to the opposite category . This equivalence arises because the morphism-reversing action of a contravariant functor aligns precisely with the structure of the opposite category, allowing all functors to be understood in covariant terms when one domain or codomain is oppified. As introduced in the discussion of covariant and contravariant functors, this perspective unifies the treatment of variance in category theory. Given a functor , its opposite functor is induced by applying the oppification to both domain and codomain categories. On objects, acts identically to , so for any object in . On morphisms, it maps in (corresponding to in ) to in . This mapping rule ensures that is a well-defined functor.[14] The opposite functor inherits preservation properties from , but adapted to the reversed structures. Since preserves identities, , it follows that which is the identity morphism in . For composition, if and in (corresponding to and in ), then thus preserving composition in the opposite sense. These properties confirm that oppification is a functorial operation on the category of categories.[14]Multifunctors and Profunctors
A multifunctor generalizes the concept of a functor to multiple input categories, allowing mappings from products of categories to a target category. In particular, a bifunctor, or binary functor, is a functor between categories , , and . It maps a pair of objects with and to an object . On morphisms, it sends a pair to a morphism in , while preserving identities and composition in each variable separately: and , with analogous preservation for the second variable.[15] Bifunctors can exhibit mixed variance by incorporating opposite categories. For instance, a bifunctor is contravariant in the first argument and covariant in the second: it reverses arrows in via (adjusted for the target), while acting covariantly on . This flexibility extends to higher arities, though bifunctors form the primary case for two variables. Such constructions underpin functor categories for multi-arity mappings, where natural transformations respect the product structure.[15] A profunctor, also known as a distributor, is a specific type of bifunctor , contravariant in and covariant in , generalizing relations between categories beyond ordinary functors. It assigns to each pair a set , with action on morphisms inducing a function via pre- and post-composition, preserving the categorical axioms. Profunctors encompass functors, as a functor yields the representable profunctor . They form the morphisms in the bicategory of small categories, profunctors, and natural transformations.[16] A canonical example of a profunctor is the hom-bifunctor in a locally small category , which sends to the hom-set of morphisms from to . On morphisms, it acts by for , thus contravariantly in the domain and covariantly in the codomain. This bifunctor underlies the Yoneda embedding and relational structures in category theory.[17]Examples
Algebraic Examples
In category theory, a prominent example of a functor arising from algebraic structures is the forgetful functor , which maps each group to its underlying set and each group homomorphism to the corresponding function between those sets, thereby disregarding the group operation and identity.[18] This functor is faithful but neither full nor essentially surjective, as it preserves the set-theoretic structure while omitting algebraic details.[18] The free functor , which assigns to each set the free group generated by that set and to each function the induced group homomorphism, is left adjoint to the forgetful functor , forming a free-forgetful adjunction that exemplifies how algebraic structures can be freely generated from sets.[19] This adjunction highlights the universal property of free groups in preserving colimits from the category of sets.[20] Another algebraic example is the power set functor , defined by sending each set to its power set , the collection of all subsets of , and each function to the direct image function given by for .[21] This covariant functor preserves unions and is monotonic, reflecting the lattice structure inherent in subsets.[20] For a fixed object in a category , the hom-functor maps each object to the set of morphisms from to , and each morphism to the post-composition map defined by .[17] This covariant representable functor embodies the Yoneda lemma's principle that objects are determined by their morphisms, providing a universal way to probe category structure.[17]Topological and Geometric Examples
In topology, the fundamental group functor provides an algebraic invariant capturing the 1-dimensional holes in spaces. It is defined on the category of pointed topological spaces, where objects are pairs with a topological space and a basepoint, and morphisms are continuous maps preserving basepoints. The functor assigns to each the fundamental group , consisting of homotopy classes of based loops at under concatenation, forming a group. For a basepoint-preserving continuous map , induces the group homomorphism sending a loop class to . This construction preserves the category structure, as composition of maps induces composition of homomorphisms and identity maps induce identity homomorphisms.[22][23] Singular homology functors extend this idea to higher dimensions, assigning abelian groups that detect holes of various orders. For each integer , the functor maps a topological space to the th singular homology group , generated by formal integer linear combinations of continuous maps (singular -simplices), modulo boundaries from the chain complex with alternating-sum boundary operators. Continuous maps induce chain maps by postcomposition , which descend to homomorphisms on homology. These functors satisfy homotopy invariance: if via a homotopy, then , and they form a sequence of covariant functors preserving exact sequences and direct sums.[22][24] The direct image functor arises in the study of sheaves over topological spaces, pushing forward structure along continuous maps. For a continuous map between topological spaces, the direct image functor acts on the category of sheaves of sets (or abelian groups) on and . It assigns to a sheaf on the sheaf on , where for an open set , the sections are , with restriction maps induced by those of . Morphisms of sheaves on map to by precomposition with . This functor is right adjoint to the inverse image functor and preserves limits, reflecting how local data on becomes global on via . In the slice category context, for subspaces over and , it similarly pushes forward bundles or sheaves.[25][26] The global sections functor extracts overall data from sheaves on a space. For a topological space , the functor (or to for abelian sheaves) assigns to a sheaf on its group of global sections , the set of sections over the entire space compatible with the sheaf axiom. A morphism of sheaves induces by applying the sheaf map to sections. This is covariant, and it is left exact but not necessarily exact, with higher derived functors yielding sheaf cohomology groups that measure obstructions to global extendability of local sections.[27][28]Relations to Other Concepts
Adjunctions and Limits
An adjunction consists of a pair of functors and , together with a natural bijection between hom-sets for all objects in and in . This bijection is induced by unit and counit natural transformations: the unit and the counit , which satisfy the triangle identities ensuring the compositions align appropriately. These components make the adjunction a universal property capturing a duality between the functors, often arising in contexts where one functor "freely generates" structures that the other "forgets," such as the free group functor being left adjoint to the forgetful functor from groups to sets.[29] In an adjunction , the functor is called the left adjoint to , denoted , while is the right adjoint. Left adjoint functors preserve all colimits, meaning that if a colimit diagram in exists, then applied to it yields a colimit in . Conversely, right adjoint functors preserve all limits: if a limit diagram in exists, then applied to it forms a limit in . These preservation properties follow from the hom-set isomorphism and the universal nature of limits and colimits, often verified using the Yoneda lemma to relate the adjunction to representable functors.[29] Kan extensions provide a universal mechanism for extending a functor along another functor, embodying an adjoint relationship. Specifically, given functors and , the left Kan extension is a functor equipped with a natural transformation that is universal: for any other functor with a natural transformation , there exists a unique natural transformation such that . The right Kan extension is defined dually, serving as a right adjoint to the precomposition functor .[29] This construction generalizes many universal properties in category theory, where the Kan extension acts as the "most efficient" extension of along .Monads and Universal Constructions
In category theory, every adjunction induces a monad. Specifically, given an adjunction with the left adjoint and the right adjoint, the composite endofunctor on the domain category carries the structure of a monad, where the unit natural transformation is the unit of the adjunction and the multiplication natural transformation is given by , with the counit of the adjunction.[30][31] These components satisfy the monad axioms: associativity and unit laws .[31] This construction generalizes algebraic structures, such as the monad on the category of sets induced by the free group adjunction, where sends a set to the underlying set of its free group.[31] A functor is tripleable if it admits a left adjoint such that the induced monad on yields an Eilenberg-Moore category (the category of -algebras) equivalent to via the comparison functor .[31] Tripleable functors are precisely those equivalent to forgetful functors from categories of algebras over a monad, capturing universal algebraic theories categorically.[31] For instance, the forgetful functor from groups to sets is tripleable, as its left adjoint (the free group functor) generates the monad whose algebras are groups.[31] Functors play a central role in the universal properties of free constructions, often preserving or reflecting initial and terminal objects. The free functor in an adjunction typically creates free objects that are initial in comma categories, such as the free group on a set being initial among groups equipped with maps from .[32] This universality ensures that preserves colimits, including initial objects, providing a categorical foundation for free generations in algebra.[32] Similarly, representable functors associated with free objects, like the underlying-set functor represented by the free group on one generator, embody these properties through natural isomorphisms.[32] Beck's monadicity theorem provides precise conditions for a functor to be monadic, meaning it is tripleable and thus equivalent to the forgetful functor from a category of algebras. Specifically, a functor with left adjoint is monadic if reflects isomorphisms and has coequalizers of reflexive -split pairs that are preserved by .[31] This theorem, originally formulated in the context of triples, characterizes when categories arise as algebraic theories over a monad, with applications in universal algebra such as recognizing varieties of algebras via forgetful functors.[31] The conditions ensure the comparison functor to the Eilenberg-Moore category is an equivalence, generalizing Birkhoff's variety theorem categorically.[31]Implementations
In Programming Languages
In functional programming languages, particularly those influenced by category theory such as Haskell, a functor is implemented as a type constructor that supports a polymorphic functionfmap of type (a -> b) -> F a -> F b, allowing the application of a function from type to over the structure to produce (F bwithout altering the structure itself.[](https://hackage.haskell.org/package/base/docs/Data-Functor.html) Thisfmapoperation must satisfy two laws to ensure functoriality: the identity law, wherefmap id == id, meaning applying the [identity function](/page/Identity_function) leaves the functor unchanged; and the composition law, where fmap (f . g) == fmap f . fmap g`, preserving function composition within the functor. These laws guarantee that the mapping behaves consistently, akin to how functions compose in the category of types.
The Haskell Functor typeclass directly embodies the notion of a covariant endofunctor on the category Hask, where objects are types and morphisms are functions, providing a computational interpretation of categorical functors by lifting morphisms through the type constructor in the same direction. For instance, the List type serves as a canonical example of a functor, where fmap corresponds to the standard map function that applies a transformation to each element of a list, such as fmap (+1) [1,2,3] yielding [2,3,4], thereby transforming List Int to List Int while maintaining the list structure.[33] Similarly, the Maybe type, which represents optional values as Just a or Nothing, implements fmap by applying the function only if the value is present, as in fmap sqrt (Just 4) returning Just 2.0, or Nothing otherwise, enabling safe computation over potentially absent data.[34]
In languages like Scala, which support explicit variance annotations on type parameters, functors can be declared as covariant or contravariant to control subtyping relationships. A covariant functor uses the + annotation, such as trait CovariantFunctor[+A], allowing subtypes to flow in the same direction as the type parameter, which aligns with the standard map-like operations in functional libraries like Cats.[35] Conversely, a contravariant functor employs the - annotation, like trait ContravariantFunctor[-A], where subtyping reverses direction, useful for structures that consume values of the parameterized type, such as comparators or input processors, enabling more flexible type-safe compositions in polymorphic code.[36]
In Proof Assistants
In proof assistants, functors from category theory are formalized as structured mappings between categories that preserve identities and composition, enabling the verification of categorical properties and constructions within dependently typed or higher-order logic systems. These formalizations typically build on foundational libraries for precategories or categories, addressing challenges such as proof relevance, univalence, and the handling of large or infinite categories. Seminal efforts include the UniMath library in Coq, the agda-categories library in Agda, and the mathlib library in Lean, each providing definitions and theorems that support advanced applications like Yoneda embeddings and adjunctions.[37][38][39] In the Coq proof assistant, the UniMath library formalizes functors within its univalent foundations, defining a functor between precategories and as a pair of functions—on objects and morphisms—that respects identities and composition, with natural transformations treated as morphisms between functors. Key properties include fully faithful functors, which preserve isomorphisms, and the Yoneda embedding, proven to be fully faithful as a functor from a category to its presheaf category. The library also covers functor categories, where functors form objects and natural transformations form morphisms, ensuring the structure is itself a category when the target is. This formalization leverages univalence to equate isomorphic categories definitionally, facilitating proofs in homotopy type theory, though it requires careful management of truncation levels for set-like structures.[40][41] Agda's categories library defines functors in the moduleCategories.Functor.Core, representing a functor between categories and as a record with fields for object and morphism mappings, plus axioms for preserving identities (F.id) and composition (F._∘_). It includes constructions like constant functors and diagonal functors, as well as properties such as faithfulness and fullness, with support for proof-relevant equality to handle equivalences via natural isomorphisms. Notably, the library formalizes duality and opposite categories, allowing functors to be definitionally equal to their opposites under certain conditions, and extends to 2-categories with 2-functors. This approach highlights Agda's strengths in dependent types for encoding categorical variance and relevance, enabling formalizations of advanced concepts like monoidal functors without extensionality assumptions.[42][43][38]
In Lean, mathlib's category theory submodule defines Functor C D as a bundled structure extending C ⥤ D, with components obj for objects and map for morphisms, enforced by axioms map_id and map_comp to ensure functoriality. Composition is denoted by ⋙, and the identity functor by 𝟭; applications use F.obj X for objects and F.map f for morphisms. The library proves essential results like the functor category structure and preservation of limits by certain functors, integrating seamlessly with Lean's typeclass system for instances like the category of types. It supports large categories via universe polymorphism and has been used to formalize schemes via the functor-of-points approach, demonstrating scalability for algebraic geometry. Challenges in Lean include inference for complex functor compositions, addressed through tactics and attributes.[39][44]
Across these systems, formalizing functors reveals tensions between strict and weak equalities, with Agda and UniMath emphasizing proof-irrelevance for setoids while Lean prioritizes computational content. Common theorems include the composition of functors forming a category and the naturality of transformations, underpinning formal proofs of adjunctions and monads in applied mathematics.[37][38]