maths.freeCategory Theory › Objects and arrows › Functor

Functor

In mathematics, specifically category theory, a functor is a mapping between categories.

Functor

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. The latter used functor in a linguistic context; see function word.

Definition

Let \(C\) and \(D\) be categories. A functor \(F\) from \(C\) to \(D\) is a mapping that:

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

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

Covariance and contravariance

There are many constructions in mathematics that would be functors, except 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 \(X\) in \(C\) with an object \(F(X)\) in \(D\),
  • associates each morphism \(f: X\to Y\) in \(C\) with a morphism \(F(f):F(Y) \to F(X)\) in \(D\) such that the following two conditions hold:
    • \(F(\mathrm{id}_X) = \mathrm{id}_{F(X)}\,\!\) for every object \(X\) in \(C\),
    • \(F(g \circ f) = F(f) \circ F(g)\) for all morphisms \(f: X\to Y\) and \(g: Y\to Z\) in \(C\).

Variance of functors (composite):

  • The composite of two functors of the same variance:
    • \(\mathrm{Covariant} \circ \mathrm{Covariant} \to \mathrm{Covariant}\)
    • \(\mathrm{Contravariant} \circ \mathrm{Contravariant} \to \mathrm{Covariant}\)
  • The composite of two functors of opposite variance:
    • \(\mathrm{Covariant} \circ \mathrm{Contravariant} \to \mathrm{Contravariant}\)
    • \(\mathrm{Contravariant} \circ \mathrm{Covariant} \to \mathrm{Contravariant}\)

We see that \((\{\text{Covariant},\text{Contravariant}\},\circ)\cong\mathbb Z/2\mathbb Z\).

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 \(C^\mathrm{op}\). Some authors prefer to write all expressions covariantly. That is, instead of saying \(F: C\to D\) is a contravariant functor, they simply write \(F: C^{\mathrm{op}} \to D\) (or sometimes \(F: C \to D^{\mathrm{op}}\)) and call it a functor.

Contravariant functors are also occasionally called cofunctors.

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

Opposite functor

Every functor \(F:C\to D\) induces the opposite functor \(F^\mathrm{op} : C^\mathrm{op}\to D^\mathrm{op}\), where \(C^\mathrm{op}\) and \(D^\mathrm{op}\) are the opposite categories to \(C\) and \(D\).

By definition, \(F^\mathrm{op}\) maps objects and morphisms in the identical way as does \(F\). Since \(C^\mathrm{op}\) does not coincide with \(C\) as a category, and similarly for \(D\), \(F^\mathrm{op}\) is distinguished from \(F\). For example, when composing \(F: C_0\to C_1\) with \(G: C_1^\mathrm{op}\to C_2\), one should use either \(G\circ F^\mathrm{op}\) or \(G^\mathrm{op}\circ F\). Note that \(\left(F^\mathrm{op}\right)^\mathrm{op} = F\).

Bifunctors and multifunctors

A bifunctor (also known as a binary functor) is a functor whose domain is a product category. For example, the Hom functor is of the type \(C^\mathrm{op}\times C\to \mathbf{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

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\circ 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

Diagram

For categories \(C\) and \(J\), a diagram of type \(J\) in \(C\) is a covariant functor \(D: J\to C\).

(Category theoretical) presheaf

For categories \(C\) and \(J\), a \(J\)-presheaf on \(C\) is a contravariant functor \(D: C\to J\). In the special case when \(J\) is \(\mathbf{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 \(U \subseteq V\). Contravariant functors on Open(X) are called presheaves on X. For instance, by assigning to every open set U the associative algebra of real-valued continuous functions on U, one obtains a presheaf of algebras on X.

Constant functor

A functor \(C\to 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

The identity functor in a category \(C\), denoted \(1_C\) or \(\mathrm{id}_C\), 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 \(D^C\) 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 CC 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 \(f \colon X \to Y\) to the map which sends \(U \in \mathcal{P}(X)\) to its image \(f(U) \in \mathcal{P}(Y)\). One can also consider the contravariant power set functor which sends \(f \colon X \to Y\) to the map which sends \(V \subseteq Y\) to its inverse image \(f^{-1}(V) \subseteq X.\) For example, if \(X = \{0,1\}\), then \(F(X) = \mathcal{P}(X) = \{\{\}, \{0\}, \{1\}, X\}\). Suppose \(f(0) = \{\}\) and \(f(1) = X\). Then \(F(f)\) is the function which sends any subset \(U\) of \(X\) to its image \(f(U)\), in this case \(\{\} \mapsto f(\{\}) = \{\}\). For the other values,

\(\begin{aligned} \{0\} \mapsto f(\{0\}) &= \{f(0)\} = \{\{\}\}, \\ \{1\} \mapsto f(\{1\}) &= \{f(1)\} = \{X\}, \\ \{0,1\} \mapsto f(\{0,1\}) &= \{f(0), f(1)\} = \{\{\}, X\}. \end{aligned}\)

Note that \(f(\{0, 1\})\) consequently generates the trivial topology on \(X\). Also note that although the function \(f\) in this example mapped to the power set of \(X\), that need not be the case in general.

Condensed: the full section is in Wikipedia.

Relation to other categorical concepts

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

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

Universal constructions often give rise to pairs of adjoint functors.

Computer implementations

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

Teraz ty Žiadna kalkulačka túto rovnicu nevyrieši, ale jej časti sú vypočítateľné.Skúste niektorú z nižšie uvedených, alebo napíšte vlastnú.

Udržujte svoje vlastné pracovné

Bezplatný účet pridáva poznámky ku každej lekcii, záznam o tom, čo ste dokončili, vaše vyriešené problémy na jednom mieste, a učiteľa, ktorého sa môžete opýtať na túto stránku.Math samotná je otvorená pre každého, prihlásený alebo nie.

Zaregistrovať sa Prihlásenie

Symboly použité tu

Ťuknutím na ľubovoľný symbol zobrazíte úplnú definíciu, obrázok a význam každého písmena.

Otázky, ktoré ľudia kladú

What is a functor?

A map between categories that sends objects to objects and arrows to arrows while respecting composition. Taking the fundamental group of a space is a functor from spaces to groups.

Časti tejto stránky sú upravené z Wikipedia (CC BY-SA 4.0). Tu sú zhrnuté a znovu vysvetlené; chyby sú naše.

Viac v kategórii Category Theory