Functor
Functor
Main page

Functor

logo
Community Hub0 subscribers
Read side by side
from Wikipedia

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 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]
A category with objects X, Y, Z and morphisms f, g, g ∘ f
Functor must preserve the composition of morphisms and

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 × CSet. 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:

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.

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 UV 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 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 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 : 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 defines a functor C × CC which is covariant in both arguments.[8]
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.[9] 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.

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]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
In category theory, a functor is a structure-preserving mapping $ F: \mathcal{C} \to \mathcal{D} $ between categories $ \mathcal{C} $ and $ \mathcal{D} $, consisting of a function on objects that assigns each object $ c $ in $ \mathcal{C} $ to an object $ F(c) $ in $ \mathcal{D} $, and a function on morphisms that assigns each morphism $ f: c \to c' $ in $ \mathcal{C} $ to a morphism $ F(f): F(c) \to F(c') $ in $ \mathcal{D} $, while preserving the domains and codomains of morphisms.[1] This mapping must satisfy two axioms: it preserves identity morphisms, so $ F(\mathrm{id}c) = \mathrm{id}{F(c)} $ for every object $ c $ in $ \mathcal{C} $, and it preserves composition of morphisms, so $ F(g \circ f) = F(g) \circ F(f) $ for any composable morphisms $ f: c \to c' $ and $ g: c' \to c'' $ in $ \mathcal{C} $.[1] These properties ensure that functors translate the relational structure of one category into another without distortion.[2] The concept of a functor was introduced by Samuel Eilenberg and Saunders Mac Lane in their 1945 paper "General Theory of Natural Equivalences," where it emerged as a tool to formalize relationships between algebraic topology constructions, such as homology and cohomology theories.[3] Functors generalize homomorphisms between algebraic structures, extending the idea to entire categories, and they come in covariant and contravariant variants: covariant functors preserve the direction of morphisms, while contravariant functors reverse it by mapping $ f: c \to c' $ to $ F(f): F(c') \to F(c) $, with adjusted preservation axioms.[1] They form the arrows in the category Cat of (small) categories, where objects are categories and morphisms are functors, enabling the study of categorical hierarchies and equivalences.[2] Functors are foundational to category theory's applications across mathematics and computer science, underpinning concepts like natural transformations—which are morphisms between functors that commute with their actions on objects and morphisms—and adjunctions, pairs of functors that represent universal approximations between categories.[1] Notable examples include the forgetful functor from groups to sets, which discards the group operation while preserving the underlying set structure, and the Hom functor, which assigns to objects the sets of morphisms between them, revealing representable structures via the Yoneda lemma.[2] In computing, functors model type constructors in functional programming languages like Haskell, facilitating modular and composable code through operations like mapping and composition.[2]

Definition and Basics

Formal Definition

In category theory, a functor $ F: \mathcal{C} \to \mathcal{D} $ from a category $ \mathcal{C} $ (the domain category) to a category $ \mathcal{D} $ (the codomain category) consists of two mappings: one that sends each object $ A $ of $ \mathcal{C} $ to an object $ F(A) $ of $ \mathcal{D} $, and one that sends each morphism $ f: A \to B $ in $ \mathcal{C} $ to a morphism $ F(f): F(A) \to F(B) $ in $ \mathcal{D} $.[4] This structure ensures that the mapping respects the categorical composition and identities.[4] Specifically, functors preserve identity morphisms, meaning that for every object $ A $ in $ \mathcal{C} $, $ F(\mathrm{id}A) = \mathrm{id}{F(A)} $.[4] They also preserve composition of morphisms: if $ f: A \to B $ and $ g: B \to C $ are morphisms in $ \mathcal{C} $, then $ F(g \circ f) = F(g) \circ F(f) $.[4] Functors are commonly notated with $ F(-) $ to indicate the action on objects and simply $ F $ 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 $ F: \mathcal{C} \to \mathcal{D} $ between categories $ \mathcal{C} $ and $ \mathcal{D} $ acts on morphisms by preserving their direction: it maps a morphism $ f: A \to B $ in $ \mathcal{C} $ to a morphism $ F(f): F(A) \to F(B) $ in $ \mathcal{D} $.[6] This preserves the order of composition, so that $ F(g \circ f) = F(g) \circ F(f) $ for composable morphisms $ f $ and $ g $ in $ \mathcal{C} $.[6] A contravariant functor, by contrast, reverses the direction of morphisms: it maps $ f: A \to B $ to $ F(f): F(B) \to F(A) $.[7] Formally, a contravariant functor from $ \mathcal{C} $ to $ \mathcal{D} $ is equivalent to a covariant functor from $ \mathcal{C} $ to the opposite category $ \mathcal{D}^{\mathrm{op}} $, or equivalently from $ \mathcal{C}^{\mathrm{op}} $ to $ \mathcal{D} $.[7] Consequently, its action on composition reverses the order: $ F(g \circ f) = F(f) \circ F(g) $.[8] An illustrative example of a naturally contravariant functor arises in linear algebra, where the dual space construction sends a vector space $ V $ over a field $ K $ to its dual $ V^* $, the space of linear functionals $ V \to K $. For a linear map $ T: W \to V $, it induces the dual map $ T^: V^ \to W^* $ defined by $ T^(f) = f \circ T $ for $ f \in V^ $, thereby reversing the morphism direction.[9][8]

Properties

Preservation and Naturality

A functor F:CDF: \mathcal{C} \to \mathcal{D} between categories C\mathcal{C} and D\mathcal{D} must preserve the identity morphisms and the composition of morphisms as part of its defining axioms.[3] Specifically, for every object AA in C\mathcal{C}, F(idA)=idF(A)F(\mathrm{id}_A) = \mathrm{id}_{F(A)} in D\mathcal{D}, and for any composable morphisms f:ABf: A \to B and g:BCg: B \to C in C\mathcal{C}, F(gf)=F(g)F(f)F(g \circ f) = F(g) \circ F(f) in D\mathcal{D}.[10] These preservation requirements ensure that FF maintains the structural relations of C\mathcal{C} within D\mathcal{D}, enabling the formation of concepts such as faithful functors, where FF is injective on hom-sets, and full functors, where FF is surjective on hom-sets, though these are stronger properties beyond the basic axioms.[10] Natural transformations provide a way to compare parallel functors F,G:CDF, G: \mathcal{C} \to \mathcal{D} by serving as morphisms in the functor category.[3] A natural transformation η:FG\eta: F \Rightarrow G consists of a family of morphisms ηA:F(A)G(A)\eta_A: F(A) \to G(A) in D\mathcal{D}, one for each object AA in C\mathcal{C}, satisfying the naturality condition: for every morphism f:ABf: A \to B in C\mathcal{C},
F(A)ηAG(A)F(f)G(f)F(B)ηBG(B) \begin{CD} F(A) @>{\eta_A}>> G(A) \\ @V{F(f)}VV @VV{G(f)}V \\ F(B) @>>{\eta_B}> G(B) \end{CD}
this square commutes, meaning G(f)ηA=ηBF(f)G(f) \circ \eta_A = \eta_B \circ F(f).[10] The commutative property of the naturality square guarantees that η\eta respects the action of morphisms across the functors, preserving their relational structure.[3] If each component ηA\eta_A is an isomorphism in D\mathcal{D}, then η\eta is a natural isomorphism, denoted FGF \cong G, indicating that FF and GG 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 C\mathcal{C} to D\mathcal{D}.[3]

Functor Categories

In category theory, the functor category, often denoted [C,D][ \mathcal{C}, \mathcal{D} ] or $ \mathcal{D}^\mathcal{C} $, is defined such that its objects are all functors $ F: \mathcal{C} \to \mathcal{D} $, 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 $ F $ is the identity natural transformation $ \mathrm{id}_F $, satisfying $ (\mathrm{id}_F)X = \mathrm{id}{F(X)} $ for each object $ X $ in $ \mathcal{C} $.[11] The composition in the functor category $ [ \mathcal{C}, \mathcal{D} ] $ is induced by the vertical composition of natural transformations: given natural transformations $ \eta: F \Rightarrow G $ and $ \theta: G \Rightarrow H $ between functors $ F, G, H: \mathcal{C} \to \mathcal{D} $, their composite $ \theta \circ \eta $ is the natural transformation whose component at each object $ X \in \mathcal{C} $ is $ (\theta \circ \eta)_X = \theta_X \circ \eta_X $.[11] Furthermore, the composition of functors between categories induces a corresponding structure on functor categories; specifically, for functors $ F: \mathcal{C} \to \mathcal{D} $ and $ G: \mathcal{D} \to \mathcal{E} $, the composite functor $ G \circ F: \mathcal{C} \to \mathcal{E} $ serves as an object in $ [ \mathcal{C}, \mathcal{E} ] $, and this operation aligns with the categorical composition when considering functors between functor categories themselves.[12] Examples of small functor categories include $ \mathbf{Set}^{\mathbf{B}} $, 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 $ \mathcal{C} $ and $ \mathcal{D} $ are small categories, then $ [ \mathcal{C}, \mathcal{D} ] $ is itself small.[12] More generally, if $ \mathcal{C} $ is small and $ \mathcal{D} $ is locally small, then $ [ \mathcal{C}, \mathcal{D} ] $ 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 $ \mathcal{C} $; for instance, a functor $ K: \mathcal{C}' \to \mathcal{C} $ induces a precomposition functor $ [ \mathcal{C}, \mathcal{D} ] \to [ \mathcal{C}', \mathcal{D} ] $ given by $ F \mapsto F \circ K $, while it is covariant in the codomain $ \mathcal{D} $, as a functor $ L: \mathcal{D} \to \mathcal{E} $ induces postcomposition $ F \mapsto L \circ F: [ \mathcal{C}, \mathcal{D} ] \to [ \mathcal{C}, \mathcal{E} ] $.[11] For contravariant functors from $ \mathcal{C} $ to $ \mathcal{D} $, the appropriate category is $ [ \mathcal{C}^{\mathrm{op}}, \mathcal{D} ] $, reflecting the opposite category in the indexing.[11]

Variants

Opposite Functors

The opposite category $ C^{\mathrm{op}} $ of a given category $ C $ is constructed by retaining the same collection of objects as $ C $, while formally reversing the direction of all morphisms. Specifically, for every morphism $ f: A \to B $ in $ C $, there exists a corresponding morphism denoted $ f^{\mathrm{op}}: B \to A $ in $ C^{\mathrm{op}} $. The identity morphism $ \mathrm{id}_A $ in $ C $ becomes $ \mathrm{id}_A^{\mathrm{op}} $ in $ C^{\mathrm{op}} $, and composition is defined such that if $ f: A \to B $ and $ g: B \to C $ are morphisms in $ C $, then $ f^{\mathrm{op}} \circ g^{\mathrm{op}} = (g \circ f)^{\mathrm{op}} $ in $ C^{\mathrm{op}} $. This construction ensures that $ C^{\mathrm{op}} $ is indeed a category, with the reversal providing a dual perspective on the structure of $ C $.[14] A contravariant functor from a category $ C $ to a category $ D $ is equivalent to a covariant functor from the opposite category $ C^{\mathrm{op}} $ to $ D $, or alternatively, from $ C $ to the opposite category $ D^{\mathrm{op}} $. 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 $ F: C \to D $, its opposite functor $ F^{\mathrm{op}}: C^{\mathrm{op}} \to D^{\mathrm{op}} $ is induced by applying the oppification to both domain and codomain categories. On objects, $ F^{\mathrm{op}} $ acts identically to $ F $, so $ F^{\mathrm{op}}(A) = F(A) $ for any object $ A $ in $ C^{\mathrm{op}} $. On morphisms, it maps $ f^{\mathrm{op}}: B \to A $ in $ C^{\mathrm{op}} $ (corresponding to $ f: A \to B $ in $ C $) to $ F(f)^{\mathrm{op}}: F(B) \to F(A) $ in $ D^{\mathrm{op}} $. This mapping rule ensures that $ F^{\mathrm{op}} $ is a well-defined functor.[14] The opposite functor $ F^{\mathrm{op}} $ inherits preservation properties from $ F $, but adapted to the reversed structures. Since $ F $ preserves identities, $ F(\mathrm{id}A) = \mathrm{id}{F(A)} $, it follows that
Fop(idAop)=F(idA)op=idF(A)op, F^{\mathrm{op}}(\mathrm{id}_A^{\mathrm{op}}) = F(\mathrm{id}_A)^{\mathrm{op}} = \mathrm{id}_{F(A)}^{\mathrm{op}},
which is the identity morphism in $ D^{\mathrm{op}} $. For composition, if $ f^{\mathrm{op}}: B \to A $ and $ g^{\mathrm{op}}: C \to B $ in $ C^{\mathrm{op}} $ (corresponding to $ f: A \to B $ and $ g: B \to C $ in $ C $), then
Fop(fopgop)=Fop((gf)op)=F(gf)op=F(f)opF(g)op=Fop(fop)Fop(gop), F^{\mathrm{op}}(f^{\mathrm{op}} \circ g^{\mathrm{op}}) = F^{\mathrm{op}}((g \circ f)^{\mathrm{op}}) = F(g \circ f)^{\mathrm{op}} = F(f)^{\mathrm{op}} \circ F(g)^{\mathrm{op}} = F^{\mathrm{op}}(f^{\mathrm{op}}) \circ F^{\mathrm{op}}(g^{\mathrm{op}}),
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 $ F: \mathcal{C} \times \mathcal{D} \to \mathcal{E} $ between categories C\mathcal{C}, D\mathcal{D}, and E\mathcal{E}. It maps a pair of objects (A,B)(A, B) with AOb(C)A \in \mathrm{Ob}(\mathcal{C}) and BOb(D)B \in \mathrm{Ob}(\mathcal{D}) to an object F(A,B)Ob(E)F(A, B) \in \mathrm{Ob}(\mathcal{E}). On morphisms, it sends a pair (f:AA,g:BB)(f: A \to A', g: B \to B') to a morphism F(f,g):F(A,B)F(A,B)F(f, g): F(A, B) \to F(A', B') in E\mathcal{E}, while preserving identities and composition in each variable separately: F(idA,idB)=idF(A,B)F(\mathrm{id}_A, \mathrm{id}_B) = \mathrm{id}_{F(A,B)} and F(f1f2,g)=F(f1,g)F(f2,g)F(f_1 \circ f_2, g) = F(f_1, g) \circ F(f_2, g), with analogous preservation for the second variable.[15] Bifunctors can exhibit mixed variance by incorporating opposite categories. For instance, a bifunctor F:Cop×DEF: \mathcal{C}^{\mathrm{op}} \times \mathcal{D} \to \mathcal{E} is contravariant in the first argument and covariant in the second: it reverses arrows in C\mathcal{C} via F(fop,g)=F(f,g)opF(f^{\mathrm{op}}, g) = F(f, g)^{\mathrm{op}} (adjusted for the target), while acting covariantly on D\mathcal{D}. 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 P:Cop×DSetP: \mathcal{C}^{\mathrm{op}} \times \mathcal{D} \to \mathrm{Set}, contravariant in C\mathcal{C} and covariant in D\mathcal{D}, generalizing relations between categories beyond ordinary functors. It assigns to each pair (C,D)(C, D) a set P(C,D)P(C, D), with action on morphisms (fop,g)(f^{\mathrm{op}}, g) inducing a function P(fop,g):P(C,D)P(C,D)P(f^{\mathrm{op}}, g): P(C', D) \to P(C, D') via pre- and post-composition, preserving the categorical axioms. Profunctors encompass functors, as a functor F:CDF: \mathcal{C} \to \mathcal{D} yields the representable profunctor D(,F()):Cop×DSet\mathcal{D}(-, F(-)): \mathcal{C}^{\mathrm{op}} \times \mathcal{D} \to \mathrm{Set}. They form the morphisms in the bicategory Prof\mathbf{Prof} of small categories, profunctors, and natural transformations.[16] A canonical example of a profunctor is the hom-bifunctor HomC(,):Cop×CSet\mathrm{Hom}_{\mathcal{C}}(-, -): \mathcal{C}^{\mathrm{op}} \times \mathcal{C} \to \mathrm{Set} in a locally small category C\mathcal{C}, which sends (A,B)(A, B) to the hom-set HomC(A,B)\mathrm{Hom}_{\mathcal{C}}(A, B) of morphisms from AA to BB. On morphisms, it acts by (fop,g)(qgqf)(f^{\mathrm{op}}, g) \mapsto (q \mapsto g \circ q \circ f) for q:ABq: A \to B, 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 $ U: \mathbf{Grp} \to \mathbf{Set} $, 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 $ F: \mathbf{Set} \to \mathbf{Grp} $, 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 $ U $, 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 $ P: \mathbf{Set} \to \mathbf{Set} $, defined by sending each set $ X $ to its power set $ \mathcal{P}(X) $, the collection of all subsets of $ X $, and each function $ f: X \to Y $ to the direct image function $ P(f): \mathcal{P}(X) \to \mathcal{P}(Y) $ given by $ P(f)(S) = { f(s) \mid s \in S } $ for $ S \subseteq X $.[21] This covariant functor preserves unions and is monotonic, reflecting the lattice structure inherent in subsets.[20] For a fixed object $ A $ in a category $ \mathbf{C} $, the hom-functor $ \mathrm{Hom}(A, -): \mathbf{C} \to \mathbf{Set} $ maps each object $ B $ to the set $ \mathrm{Hom}(A, B) $ of morphisms from $ A $ to $ B $, and each morphism $ g: B \to C $ to the post-composition map $ \mathrm{Hom}(A, g): \mathrm{Hom}(A, B) \to \mathrm{Hom}(A, C) $ defined by $ h \mapsto g \circ h $.[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 Top\mathbf{Top}_* of pointed topological spaces, where objects are pairs (X,x0)(X, x_0) with XX a topological space and x0Xx_0 \in X a basepoint, and morphisms are continuous maps preserving basepoints. The functor π1:TopGrp\pi_1: \mathbf{Top}_* \to \mathbf{Grp} assigns to each (X,x0)(X, x_0) the fundamental group π1(X,x0)\pi_1(X, x_0), consisting of homotopy classes of based loops at x0x_0 under concatenation, forming a group. For a basepoint-preserving continuous map f:(X,x0)(Y,y0)f: (X, x_0) \to (Y, y_0), π1(f)\pi_1(f) induces the group homomorphism sending a loop class [γ][\gamma] to [fγ][f \circ \gamma]. 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 n0n \geq 0, the functor Hn:TopAbH_n: \mathbf{Top} \to \mathbf{Ab} maps a topological space XX to the nnth singular homology group Hn(X)H_n(X), generated by formal integer linear combinations of continuous maps σ:ΔnX\sigma: \Delta^n \to X (singular nn-simplices), modulo boundaries from the chain complex with alternating-sum boundary operators. Continuous maps f:XYf: X \to Y induce chain maps f#:Cn(X)Cn(Y)f_\#: C_n(X) \to C_n(Y) by postcomposition f#(σ)=fσf_\#(\sigma) = f \circ \sigma, which descend to homomorphisms Hn(f):Hn(X)Hn(Y)H_n(f): H_n(X) \to H_n(Y) on homology. These functors satisfy homotopy invariance: if fgf \simeq g via a homotopy, then Hn(f)=Hn(g)H_n(f) = H_n(g), 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 f:XYf: X \to Y between topological spaces, the direct image functor f:Sh(X)Sh(Y)f_*: \mathbf{Sh}(X) \to \mathbf{Sh}(Y) acts on the category of sheaves of sets (or abelian groups) on XX and YY. It assigns to a sheaf F\mathcal{F} on XX the sheaf fFf_* \mathcal{F} on YY, where for an open set VYV \subseteq Y, the sections are (fF)(V)=F(f1(V))(f_* \mathcal{F})(V) = \mathcal{F}(f^{-1}(V)), with restriction maps induced by those of F\mathcal{F}. Morphisms of sheaves ϕ:FG\phi: \mathcal{F} \to \mathcal{G} on XX map to fϕ:fFfGf_* \phi: f_* \mathcal{F} \to f_* \mathcal{G} by precomposition with f1f^{-1}. This functor is right adjoint to the inverse image functor f1:Sh(Y)Sh(X)f^{-1}: \mathbf{Sh}(Y) \to \mathbf{Sh}(X) and preserves limits, reflecting how local data on XX becomes global on YY via ff. In the slice category context, for subspaces over XX and YY, 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 XX, the functor Γ:Sh(X)Set\Gamma: \mathbf{Sh}(X) \to \mathbf{Set} (or to Ab\mathbf{Ab} for abelian sheaves) assigns to a sheaf F\mathcal{F} on XX its group of global sections Γ(X,F)\Gamma(X, \mathcal{F}), the set of sections over the entire space XX compatible with the sheaf axiom. A morphism ϕ:FG\phi: \mathcal{F} \to \mathcal{G} of sheaves induces Γ(ϕ):Γ(X,F)Γ(X,G)\Gamma(\phi): \Gamma(X, \mathcal{F}) \to \Gamma(X, \mathcal{G}) by applying the sheaf map ϕX:F(X)G(X)\phi_X: \mathcal{F}(X) \to \mathcal{G}(X) 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 F:CDF: \mathcal{C} \to \mathcal{D} and G:DCG: \mathcal{D} \to \mathcal{C}, together with a natural bijection between hom-sets homD(F(A),B)homC(A,G(B))\hom_{\mathcal{D}}(F(A), B) \cong \hom_{\mathcal{C}}(A, G(B)) for all objects AA in C\mathcal{C} and BB in D\mathcal{D}. This bijection is induced by unit and counit natural transformations: the unit η:\idCGF\eta: \id_{\mathcal{C}} \to G F and the counit ε:FG\idD\varepsilon: F G \to \id_{\mathcal{D}}, 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 FGF \dashv G, the functor FF is called the left adjoint to GG, denoted FGF \dashv G, while GG is the right adjoint. Left adjoint functors preserve all colimits, meaning that if a colimit diagram in C\mathcal{C} exists, then FF applied to it yields a colimit in D\mathcal{D}. Conversely, right adjoint functors preserve all limits: if a limit diagram in D\mathcal{D} exists, then GG applied to it forms a limit in C\mathcal{C}. 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 F:CEF: \mathcal{C} \to \mathcal{E} and p:CBp: \mathcal{C} \to \mathcal{B}, the left Kan extension \LanpF:BE\Lan_p F: \mathcal{B} \to \mathcal{E} is a functor equipped with a natural transformation η:F(\LanpF)p\eta: F \to (\Lan_p F) \circ p that is universal: for any other functor K:BEK: \mathcal{B} \to \mathcal{E} with a natural transformation θ:FKp\theta: F \to K \circ p, there exists a unique natural transformation θ:\LanpFK\overline{\theta}: \Lan_p F \to K such that θ=θη\theta = \overline{\theta} \circ \eta. The right Kan extension \RanpF\Ran_p F is defined dually, serving as a right adjoint to the precomposition functor p:[B,E][C,E]p^*: [\mathcal{B}, \mathcal{E}] \to [\mathcal{C}, \mathcal{E}].[29] This construction generalizes many universal properties in category theory, where the Kan extension acts as the "most efficient" extension of FF along pp.

Monads and Universal Constructions

In category theory, every adjunction induces a monad. Specifically, given an adjunction FGF \dashv G with F:CDF: \mathcal{C} \to \mathcal{D} the left adjoint and G:DCG: \mathcal{D} \to \mathcal{C} the right adjoint, the composite endofunctor T=GF:CCT = G \circ F: \mathcal{C} \to \mathcal{C} on the domain category C\mathcal{C} carries the structure of a monad, where the unit natural transformation η:idCT\eta: \mathrm{id}_\mathcal{C} \to T is the unit of the adjunction and the multiplication natural transformation μ:T2T\mu: T^2 \to T is given by μ=GεF\mu = G \varepsilon F, with ε:FGidD\varepsilon: F \circ G \to \mathrm{id}_\mathcal{D} the counit of the adjunction.[30][31] These components satisfy the monad axioms: associativity μTμ=μμT\mu \circ T\mu = \mu \circ \mu T and unit laws μTη=μηT=idT\mu \circ T\eta = \mu \circ \eta T = \mathrm{id}_T.[31] This construction generalizes algebraic structures, such as the monad on the category of sets induced by the free group adjunction, where TT sends a set to the underlying set of its free group.[31] A functor U:ECU: \mathcal{E} \to \mathcal{C} is tripleable if it admits a left adjoint FF such that the induced monad T=UFT = U \circ F on C\mathcal{C} yields an Eilenberg-Moore category CT\mathcal{C}_T (the category of TT-algebras) equivalent to E\mathcal{E} via the comparison functor Φ:ECT\Phi: \mathcal{E} \to \mathcal{C}_T.[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 FF in an adjunction FUF \dashv U typically creates free objects that are initial in comma categories, such as the free group on a set XX being initial among groups equipped with maps from XX.[32] This universality ensures that FF 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 U:BCU: \mathcal{B} \to \mathcal{C} with left adjoint FF is monadic if UU reflects isomorphisms and B\mathcal{B} has coequalizers of reflexive UU-split pairs that are preserved by UU.[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 FF that supports a polymorphic function fmap of type (a -> b) -> F a -> F b, allowing the application of a function from type aa to bb over the structure FaF a 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 $ F : C \to D $ between precategories $ C $ and $ D $ 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 module Categories.Functor.Core, representing a functor between categories $ \mathcal{C} $ and $ \mathcal{D} $ 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]

References

User Avatar
No comments yet.