functor category

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Category theory
+-- {: .hide}
[[!include category theory - contents]]
=--
#### Mapping space
+--{: .hide}
[[!include mapping space - contents]]
=--
=--
=--

# Functor categories
* table of contents
{: toc}

## Definition

Given [[category|categories]] $C$ and $D$, the **functor category**  -- written $D^C$ or $[C,D]$ -- is the category whose

* [[class]] of [[objects]] is the collection of all [[functors]] $F \colon C \to D$

* [[morphisms]] are [[natural transformations]] between these functors.

### In homotopy type theory

Discussion in [[homotopy type theory]].

Note: the [[HoTT book]] calls a [[internal category in HoTT]] a "precategory" and a [[univalent category]] a "category", but here we shall refer to the standard terminology of "category" and "univalent category" respectively.

For [[categories]] $A,B$, there is a [[category]] $B^A$, called the **functor category**, defined by

* $(B^A)_0$ is the type of [[functors]] from $A$ to $B$.
* $hom_{B^A}(F,G)$ is the type of [[natural transformations]] from $F$ to $G$.

**Proof.** We define $(1_F)_a \equiv 1_{F a}$. Naturality follows by the unit axioms of a [[category]]. For $\gamma : F \to G$ and $\delta : G \to H$, we define $(\delta \circ \gamma)_a \equiv \delta_a \circ \gamma_a$. Naturality follows by associativity. Similarly, the unit and associativity laws for $B^A$ follow from those for $B$. $\square$

We define a **natural isomorphism** to be an [[isomorphism]] in $B^A$.

## Usage

Functor categories serve as the [[hom-categories]] in the [[strict 2-category]] [[Cat]].

In the context of [[enriched category theory]] the functor category is generalized to the *[[enriched functor category]]*.

In the absence of the [[axiom of choice]] (including many [[internal category|internal]] situations), the appropriate notion to use is often instead the [[anafunctor category]].

## Properties

###  Limits and colimits and closure

If $D$ has [[limits]] or [[colimits]] of a certain shape, then so does $[C,D]$ and they are computed pointwise.  (However, if $D$ is not complete, then other limits in $[C,D]$ can exist "by accident" without being pointwise.)

If $C$ is small and $D$ is [[cartesian closed category|cartesian closed]] and [[complete category|complete]], then $[C,D]$ is cartesian closed.  See at _[[cartesian closed category]]_ for a proof.

### Accessibility and local presentability
  {#LocalPresentability}

Functor categories enjoy the following accessibility
and local presentability properties, as explained
by [[Zhen Lin Low]] at [nForum](http://nforum.mathforge.org/discussion/6152).

* $\kappa$-[[accessible functors]] from a $\kappa$-[[accessible category]] to any accessible category form an accessible category.  (It is not so easy to say what the accessibility rank is here.)

* $\kappa$-accessible functors from a $\kappa$-accessible category to any locally $\lambda$-[[locally presentable category|presentable category]] form a locally $\lambda$-presentable category.

* Cocontinuous functors between [[locally presentable categories]] form a locally presentable category.  More precisely, if $C$ and $D$ are locally $\kappa$-presentable, then so is $[C,D]$.

* Continuous accessible functors between locally presentable categories form the opposite of a locally presentable category.  More precisely, if $C$ and $D$ are locally $\kappa$-presentable, then so is $[C,D]^{\rm op}$.

Indeed, the point is this: given a $\kappa$-[[accessible category]] $\mathcal{C} \simeq Ind^\kappa (\mathcal{A})$ ($\mathcal{A}$ essentially small), the category of $\kappa$-accessible functors $\mathcal{C} \to \mathcal{D}$ (for arbitrary $\mathcal{D}$; here by "$\kappa$-accessible" we mean simply "preserves $\kappa$-filtered colimits") is naturally equivalent to the category of all $\mathcal{A} \to \mathcal{D}$. It should be well known that:

1. If $\mathcal{D}$ is accessible, then so is $[\mathcal{A}, \mathcal{D}]$.

2. {#FunctorsIntoLocallyPresCatAreLocallyPres} If $\mathcal{A}$ is [[small category|small]] and $\mathcal{D}$ is locally $\lambda$-presentable, then also the functor category $[\mathcal{A}, \mathcal{D}]$ is locally presentable.

3. Colimit-preserving functors out of a locally $\kappa$-presentable category are $\kappa$-accessible.

4. A right adjoint between locally $\kappa$-presentable categories is $\kappa$-accessible if and only if its left adjoint is strongly $\kappa$-accessible (i.e. preserves $\kappa$-presentable objects as well as $\kappa$-filtered colimits); and every limit-preserving accessible functor between locally presentable categories is a right adjoint.

Statement 2 is [Adámek & Rosický (1994), Cor. 1.54](#AdámekRosický94). Statement 3 is obvious, and statement 4 is a straightforward exercise.

In general, accessible functors between accessible
categories do not form an accessible category
due to size issues.
The best one can hope for is a [[class-accessible category]].
Let $\mathcal{C}$ be an accessible category that is _not_ essentially small.
Consider the category $\mathcal{A}$ of all accessible functors $\mathcal{C} \to \mathbf{Set}$.
This is the same as the smallest full replete subcategory of $[\mathcal{C}, \mathbf{Set}]$ containing all representable functors and closed under small colimits.
In particular, $\mathcal{A}$ is accessible if and only if $\mathcal{A}$ locally presentable.
We claim $\mathcal{A}$ is not accessible.

Indeed, suppose $\mathcal{A}$ has a small generating family, say $\mathcal{G}$.
Then for some regular cardinal $\kappa$, every member of $\mathcal{G}$ is $\kappa$-accessible.
So consider $\mathcal{C} (X, -)$ for some object $X$ that is _not_ $\kappa$-presentable.
(Such an $X$ exists because $\mathcal{C}$ is _not_ essentially small.)
Since $\mathcal{G}$ generates, there is a small diagram of $\kappa$-accessible functors whose colimit is $\mathcal{C} (X, -)$.
But then $\mathcal{C} (X, -)$ is a retract of a $\kappa$-accessible functor and hence $\kappa$-accessible: a contradiction.
That said, $\mathcal{A}$ is a [[class-locally presentable category]].

### In homotopy type theory

#### Lemma 9.2.4 ####
A natural transformation $\gamma : F \to G$ is an isomorphism in $B^A$ if and only if each $\gamma_a$ is an isomorphism in $B$.

**Proof.** If $\gamma$ is an [[isomorphism]], then we have $\delta : G \to F$ that is its inverse. By definition of composition in $B^A$, $(\delta \gamma)_a \equiv \delta_a \gamma_a$. Thus, $\delta \gamma = 1_F$ and $\gamma \delta=1_G$ imply that $\delta_a \gamma_a = 1_{F a}$ and $\gamma_a \delta_a = 1_{G a}$, so $\gamma_a$ is an isomorphism.

Conversely, suppose each $\gamma_a$ is an [[isomorphism]], with inverse called $\delta_a$. We define a [[natural transformation]] $\delta : G \to F$ with components $\delta_a$; for the naturality axiom we have
$$F f \circ \delta_a=\delta_b \circ \gamma_b \circ F f \circ \delta_a = \delta_b \circ G f \circ \gamma_a \circ \delta_a = \delta_b \circ G f$$

Now since composition and identity of [[natural transformations]] is determined on their components, we have $\gamma \delta=1_G$ and $\delta \gamma 1_F.\ \square$

#### Theorem 9.2.5 ####
If $A$ is a [[category]] and $B$ is a [[univalent category]], then $B^A$ is a [[univalent category]].

**Proof.** Let $F,G:A\to B$; we must show that $idtoiso:({F}={G}) \to (F\cong G)$ is an [[equivalence]].

  To give an inverse to it, suppose $\gamma:F\cong G$ is a [[natural isomorphism]].
  Then for any $a:A$, we have an [[isomorphism]] $\gamma_a:F a \cong G a$, hence an [[identity]] $isotoid(\gamma_a):{F a}={G a}$.
  By [[function extensionality]], we have an [[identity]] $\bar{\gamma}:{F_0}=_{(A_0\to B_0)}{G_0}$.

  Now since the last two axioms of a [[functor]] are [[mere propositions]], to show that ${F}={G}$ it will suffice to show that for any $a,b:A$, the functions

  $$ F_{a,b}:hom_A(a,b) \to hom_B(F a,F b) $$
  $$ G_{a,b}:hom_A(a,b) \to hom_B(G a,G b) $$

  become equal when [[transported]] along $\bar\gamma$.
  By computation for [[function extensionality]], when applied to $a$, $\bar\gamma$ becomes equal to $isotoid(\gamma_a)$.

+--{.query}
This reference needs to be included. For now as transports are not yet written up I didn't bother including a reference to the page [[univalent category]]. -Ali
=--

But by [**INCLUDE ME**], [[transporting]] $F f:hom_B(F a,F b)$ along $isotoid(\gamma_a)$ and $isotoid(\gamma_b)$ is equal to the composite $\gamma_b\circ F f\circ \inv{(\gamma_a)}$, which by naturality of $\gamma$ is equal to $G f$.

  This completes the definition of a function $(F\cong G) \to (F =G)$.
  Now consider the composite
  $$ (F= G) \to (F\cong G) \to (F =G). $$
  Since hom-sets are [[sets]], their [[identity types]] are [[mere propositions]], so to show that two [[identities]] $p,q:F =G$ are equal, it suffices to show that $p =_{{F_0}={G_0}}{q}$.
  But in the definition of $\bar\gamma$, if $\gamma$ were of the form $idtoiso(p)$, then $\gamma_a$ would be equal to $idtoiso(p_a)$ (this can easily be proved by induction on $p$).
  Thus, $isotoid(\gamma_a)$ would be equal to $p_a$, and so by [[function extensionality]] we would have ${\bar\gamma}={p}$, which is what we need.

  Finally, consider the composite
  $$(F\cong G)\to  ( F = G) \to (F\cong G). $$
  Since identity of [[natural transformations]] can be tested componentwise, it suffices to show that for each $a$ we have ${idtoiso(\bar\gamma)_a}={\gamma_a}$.
  But as observed above, we have ${idtoiso(\bar\gamma)_a}={idtoiso((\bar\gamma)_a)}$, while ${(\bar\gamma)_a}={isotoid(\gamma_a)}$ by computation for [[function extensionality]].
  Since $isotoid$ and $idtoiso$ are inverses, we have ${idtoiso(\bar\gamma)_a}={\gamma_a}$ as desired. $\square$

## Size issues

If $C$ and $D$ are [[small category|small]], then $[C,D]$ is also small.

If $C$ is small and $D$ is [[locally small category|locally small]], then $[C,D]$ is still locally small.

Even if $C$ and $D$ are locally small, if $C$ is not small, then $[C,D]$ will usually not be locally small.

As a partial converse to the above, if $C$ and $[C,Set]$ are locally small, then $C$ must be [[essentially small category|essentially small]]; see [Freyd & Street (1995)](http://tac.mta.ca/tac/volumes/1995/n9/1-09abs.html).

## Related concepts

* [[enriched functor category]]

* [[Prof]]

* [[2-functor 2-category]]

* [[(infinity,1)-category of (infinity,1)-functors]]

* [[simplicial mapping complex]]

* [[inertia groupoid]]

## References ##

See most references at *[[category theory]]*, such as

* [[Saunders MacLane]], §II.4 of: *[[Categories for the Working Mathematician]]*, Graduate Texts in Mathematics **5** Springer (1971, second ed. 1997) [[doi:10.1007/978-1-4757-4721-8](https://link.springer.com/book/10.1007/978-1-4757-4721-8)]

Discussion of [[locally presentable category|local presentability]]:

* {#AdámekRosický94} [[Jiří Adámek]], [[Jiří Rosický]], Cor. 1.54 in: *[[Locally presentable and accessible categories]]*, London Mathematical Society Lecture Note Series **189**, Cambridge University Press (1994) [[doi:10.1017/CBO9780511600579](https://doi.org/10.1017/CBO9780511600579)]

[[!redirects functor category]]
[[!redirects functor categories]]
[[!redirects diagram category]]
[[!redirects diagram categories]]

[[!redirects category of functors]]
[[!redirects categories of functors]]

[[!redirects functor groupoid]]
[[!redirects functor groupoids]]


functor comprehension principle

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Category theory
+-- {: .hide}
[[!include category theory - contents]]
=--
#### 2-category theory
+--{: .hide}
[[!include 2-category theory - contents]]
=--
#### Homotopy theory
+-- {: .hide}
[[!include homotopy - contents]]
=--
=--
=--

\tableofcontents

Consider the statement:

> If $f$ is a fully faithful and essentially surjective functor, then it is an [[equivalence of categories]].

If we use a set-theoretic foundation for mathematics, then this statement is equivalent to the [[axiom of choice]].  However, as we now show, in the [[michaelshulman:internal logic of a 2-category|internal logic]] of a [[regular 2-category]], it is simply *true*.  Thus, it should really be regarded as a "functor comprehension principle" or an "axiom of non-choice," analogous for categories to the fact (true in any regular 1-category) that any injective and surjective function of sets is an isomorphism, or equivalently that one can always make "choices" when those choices are uniquely specified.

We start by characterizing full, faithful, and eso morphisms in the internal logic.

## Faithful morphisms

Consider first the following theory with two 1-types $A$ and $B$:

* $x:A \vdash f(x):B$
* $x:A, y:A, \alpha: hom_A(x,y), \beta : hom_A(x,y), f(\alpha)=f(\beta) \vdash \alpha = \beta$

Of course, the first axiom interprets by a morphism $f\colon A\to B$.  This induces a map from $ker(A) \to (f/f)$ over $A\times A$.  The context of the second axiom above is the kernel pair of this map (as a map between discrete objects in $K/A\times A$); thus the second axiom asserts that this kernel pair factors through the diagonal of $ker(A)$, and hence is monic.  But this is equivalent to saying that $f$ is faithful, so a model of this theory in a lex 2-category is precisely a faithful morphism.

## Full and ff morphisms

Now consider the following theory, again with two 1-types $A$ and $B$:

* $x:A \vdash f(x):B$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash \exists \bar{\gamma}:hom_A(x,y). f(\bar{\gamma})=\gamma$

In a regular 2-category, the truth of this axiom asserts that the map $ker(A) \to (f/f)$ is eso, which implies that $f$ is a [[michaelshulman:full morphism]].  The converse is true at least in an exact 2-category.  It is also true if $f$ is additionally faithful, since then $ker(A) \to (f/f)$ is ff, hence (if also eso) an equivalence, so that $f$ is ff (and in particular full).  Therefore, a model of the combined theory

* $x:A \vdash f(x):B$
* $x:A, y:A, \alpha: hom_A(x,y), \beta : hom_A(x,y), f(\alpha)=f(\beta) \vdash \alpha = \beta$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash \exists \bar{\gamma}:hom_A(x,y). f(\bar{\gamma})=\gamma$

in a regular 2-category is precisely a ff morphism.

In a merely lex 2-category, we can instead consider the theory

* $x:A \vdash f(x):B$
* $x:A, y:A, \alpha: hom_A(x,y), \beta : hom_A(x,y), f(\alpha)=f(\beta) \vdash \alpha = \beta$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash \bar{\gamma}:hom_A(x,y)$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash f(\bar{\gamma})=\gamma$

The first two axioms give a faithful morphism $f\colon A\to B$, as above, and now the third and fourth axioms supply a section of the map $ker(A) \to (f/f)$, which is thus both ff and split epic, hence an equivalence.  Thus, a model of this theory in a lex 2-category is also precisely a ff morphism.

I don't know whether there is a theory in lex 2-logic whose models in lex 2-categories are precisely full morphisms, but I suspect not.  I also don't know whether there is a theory in regular 2-logic whose models in non-exact regular 2-categories are precisely full morphisms.

## Eso morphisms

Now consider the regular 2-theory

* $x:A \vdash f(x):B$
* $y:B \vdash \exists x:A. \exists i:iso_B(f(x),y)$

Since $iso_B(f(x),y)$ in context $x:A,y:B$ is interpreted by $(1,f)\colon A\to A\times B$, the second axiom asserts that the image of the composite $A \overset{(1,f)}{\to} A\times B \to B$ is all of $B$, i.e. that this composite is eso.  But this composite is clearly just $f$, so a model of this theory is precisely an eso morphism.

Of course, we can then write the combined theory

* $x:A \vdash f(x):B$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash \exists \bar{\gamma}:hom_A(x,y). f(\bar{\gamma})=\gamma$
* $y:B \vdash \exists x:A. \exists i:iso_B(f(x),y)$

whose models in exact 2-categories are precisely the eso+full morphisms.

## Equivalences

It follows from the above considerations that a model of the following theory:

* $x:A \vdash f(x):B$
* $x:A, y:A, \alpha: hom_A(x,y), \beta : hom_A(x,y), f(\alpha)=f(\beta) \vdash \alpha = \beta$
* $x:A, y:A, \gamma: hom_B(f(x),f(y)) \vdash \exists \bar{\gamma}:hom_A(x,y). f(\bar{\gamma})=\gamma$
* $y:B \vdash \exists x:A. \exists i:iso_B(f(x),y)$

in a regular 2-category is precisely a morphism $f$ which is ff and eso, i.e. an equivalence.  Since this theory evidently asserts that $f$ is "faithful, full, and essentially surjective on objects" in the internal logic, this is the desired "functor comprehension principle."

Of course, in a [[Heyting 2-category]], the latter three axioms can equivalently be stated as

* $\vdash \forall x:A, \forall y:A, \forall \alpha: hom_A(x,y), \forall \beta : hom_A(x,y), f(\alpha)=f(\beta) \Rightarrow \alpha = \beta$
* $\vdash \forall x:A, \forall y:A, \forall \gamma: hom_B(f(x),f(y)), \exists \bar{\gamma}:hom_A(x,y). f(\bar{\gamma})=\gamma$
* $\vdash \forall y:B, \exists x:A. \exists i:iso_B(f(x),y)$

which have perhaps the most familiar form.

## References

The above definitions and observations are originally due to

* [[Michael Shulman]], _[[michaelshulman:functor comprehension principle]]_


functor of descent type

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Category theory
+-- {: .hide}
[[!include category theory - contents]]
=--
#### Locality and descent
+--{: .hide}
[[!include descent and locality - contents]]
=--
=--
=--

* table of contents
{: toc}

## Idea

A functor is of *descent type* if it satisfies "half" of the condition to be [[monadic]].

## Definition

A functor $U:B\to A$ is of **descent type** (or is **premonadic**) if

1. it has a [[left adjoint]] $F:A\to B$, and
2. for all $b\in B$ the canonical [[fork]] $F U F U b \underoverset{F U \epsilon}{\epsilon F U}{\rightrightarrows} F U b \xrightarrow{\epsilon} b$ is a [[coequalizer]].

The second condition is equivalent to asking that the [[comparison functor]] $B \to A^{U F}$ from $B$ to the [[Eilenberg-Moore category]] of the [[monad]] $U F$ is [[fully faithful]]. When the comparison functor is [[essentially surjective]] (hence an [[equivalence of categories]]), $U$ is of [[effective descent type]] or [[monadic]].

## Examples

By [[monadic descent]], a morphism $f$ in the base of a [[fibration]] is a [[descent morphism]] if and only if $f^*$ is of descent type.  This is presumably the origin of the terminology; $f$ is an [[effective descent morphism]] when $f^*$ is monadic.

## Related pages

* [[monadic functor]], [[monadicity theorem]]
* [[descent]], [[monadic descent]]

[[!redirects descent type]]
[[!redirects functors of descent type]]
[[!redirects premonadic functor]]
[[!redirects premonadic functors]]