For functors in computer science, see Function object. For functors in linguistics see Function word.
In
category theory, a branch of mathematics, a
functor is a special type of mapping between categories. Functors can be thought of as
morphisms in the
category of small categories.
Functors were first considered in
algebraic topology, where algebraic objects (like the
fundamental group) are associated to
topological spaces, and algebraic
homomorphisms are associated to
continuous function maps. Nowadays, functors are used throughout modern mathematics to relate various categories. The word "functor" was borrowed by mathematicians from the philosopher Carnap Mac Lane, p. 30.
Definition
Let
C and
D be
category (mathematics). A
functor F from
C to
D is a mapping that
- associates to each object X \in C an object F(X) \in D,
- associates to each morphism f:X\rightarrow Y \in C a morphism F(f):F(X) \rightarrow F(Y) \in D
such that the following two properties hold:
- F(id_{X}) = id_{F(X)} for every object X \in C
- F(g \circ f) = F(g) \circ F(f) for all morphisms f:X \rightarrow Y and g:Y\rightarrow Z.
That is, functors must preserve identity morphisms and composition of morphisms.
A functor from a category to itself is called an
endofunctor.
Covariance and contravariance
There are many constructions in mathematics which 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 to each object X \in C an object F(X) \in D,
- associates to each morphism f:X\rightarrow Y \in C a morphism F(f):F(Y) \rightarrow F(X) \in D such that
- F(id_X)=id_{F(X)} for every object X \in C,
- F(g \circ f) = F(f) \circ F(g) for all morphisms f:X\rightarrow Y and g:Y\rightarrow 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
dual category C^{op}. Some authors prefer to write all expressions covariantly. That is, instead of saying F: C\rightarrow D is a contravariant functor, they simply write F: C^{op} \rightarrow D (or sometimes F:C \rightarrow D^{op}) and call it a functor.
Contravariant functors are also occasionally called
cofunctors.
Examples
Constant functor: The functor
C →
D is one 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.
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 (category theory) (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 is covariant).
Power sets: The power set functor
P :
Set →
Set maps each set to its power set and each function f : X \to Y to the map which sends U \subseteq X to its image f(U) \subseteq Y. One can also consider the contravariant power set functor which sends
f to the map which sends
U to its
inverse image in
Y.
Dual vector space: The map which assigns to every vector space its
dual space and to every linear operator its dual or transpose is a contravariant functor from the category of all vector spaces over a fixed
field (mathematics) 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 function (topology) 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 (mathematics) of homotopy classes of loops based at
x0. If
f :
X →
Y 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 topology (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)(φ) = φ o
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. Likewise, the map which sends every differentiable manifold to its
cotangent bundle and every smooth map to its
pullback (differential geometry) is a contravariant functor.
Doing these constructions pointwise gives covariant and contravariant functors from the category of pointed differentiable manifolds to the category of real vector spaces.
Group actions/representations: Every
group (mathematics) (or
groupoid)
G can be considered as a category with a single object. A functor from
G to
Set is 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.
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 operator as morphisms, then the tensor product V \otimes W defines a functor
C ×
C →
C which is covariant in both arguments.
Forgetful functors: The functor
U :
Grp →
Set which maps a
group (mathematics) to its underlying set and a
group homomorphism to its underlying function of sets is a functor. Functors like these, which "forget" some structure, are termed
forgetful functors. Another example is the functor
Rng →
Ab which maps a
ring (algebra) 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 group (mathematics) 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 φ \mapsto
g o φ o
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 group homomorphism Hom(
f,
g) : Hom(
X2,
Y1) → Hom(
X1,
Y2) is given by φ \mapsto
g o φ o
f.
Functors like these are called representable functors. A major goal in many settings is to determine whether a given functor is representable.
Presheaves: 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 U \subseteq V. Contravariant functors on Open(
X) are called
presheaf 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.
Properties
Two important consequences of the functor axioms are:
On any category
C one can define the
identity functor 1
C which maps each object and morphism to itself. One can also 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. This shows that functors can be considered as morphisms in categories of categories.
A category with a single object is equivalent to a
monoid whose elements are morphisms and whose operation is composition. Functors between monoids, considered as categories, are nothing more than 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.
Bifunctors
A
bifunctor is a generalization of the functor concept to 'two variables'. The Hom functor is a natural example, and is contravariant in one variable, covariant in the other.
Relation to other categorical concepts
Functors themselves can be considered as objects in a category called a
functor category. Morphisms in this category are
natural transformations between functors.
Functors are often defined by
universal property; examples are the tensor product, the direct sum and direct product of groups or vector spaces, construction of free groups and modules, direct limit and
inverse limit limits. The concepts of limit (category theory) generalize several of the above.
Universal constructions often give rise to pairs of adjoint functors.
See also
- Additive functor: a functor between categories whose hom-sets are abelian groups is additive if it is a group homomorphism of the hom-sets
- Adjoint functors: functors F and G are adjoint if Hom(FX,Y)≅Hom(X,GY), where the isomorphism is natural in X and Y
- Derived functor: the image of a short exact sequence under a functor that is only half-exact can be extended to a long exact sequence, the objects of which are images of a derived functor
- Enriched functor
- Essentially surjective functor: a functor every object of whose codomain is isomorphic to the image of an object in the domain
- Exact functor: a functor that takes short exact sequences to short exact sequences
- Faithful functor: a functor that is injective function on the set of morphisms with given domain and codomain
- Forgetful functor: a functor that takes a set with structures to the underlying set with fewer or none of its structures
- Full functor: a functor that is surjection on the set of morphisms with given domain and codomain
- Kan extension
- Smooth functor: a functor F from K-Vect to K-Vect such that Hom(V,W) → Hom(FV,FW) is smooth function. Examples include V*, ΛkV, ΣkV and the like.
References
- S. Mac Lane. Categories for the Working Mathematician. Springer-Verlag: New York, 1971.
- In category theory, a branch of mathematics, a functor is a special type of mapping between categories. Functors can be thought of as morphisms in the category of small categories.
- Most modern object-oriented languages such as C++, Java, Python, Ruby and Lisp support the definition of functors and may even make significant use of them.
- Functors can encapsulate pointers to C functions and to C++ member functions. Thus you can build up a list of pointers to arbitrary functions. You find and introduction to the ...
- Functors are a generalisation of the function "map". The type operator in this case takes a type T and returns type "list of T". The map function takes a function and applies ...
- ... functors: Component type: overview: Summary A Function Object, or Functor (the two terms are synonymous) is simply any ...
- Applicative functors are functors with some extra properties, the most important one is that it allows you to apply functions inside the functor (hence the name) to other values.
- Modules : mem_fun() mem_fun() is used to convert a pointer to a method to a functor. ptr_fun() ptr_fun() is used to convert a pointer to a function to a functor.
- REPRESENTATION THEORY An Electronic Journal of the American Mathematical Society Volume 7, Pages 681{699 (December 3,2003) S1088-4165(03)00189-4 TWISTING FUNCTORS ON O ...
- LONDON MATHEMATICAL SOCIETY INVITED LECTURE SERIES. Calculus of Functors. THOMAS GOODWILLIE. 18 - 23 JUNE 2001. Research Centre in Topology and Related Areas
- Functors support and encourage a number of powerful programming techniques including: programming in a functional style; higher order functions; internal iterators; reuse ...