function spectrum

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

#Contents#
* table of contents
{:toc}

## Idea

A _function spectrum_ or _mapping spectrum_ is the analog of a [[mapping space]] in the context of [[stable homotopy theory]]. It makes the [[stable homotopy category]] into a [[closed category]], and together with the [[smash product of spectra]] into a [[symmetric monoidal category|symmetric]] [[closed monoidal category]]

Given two [[spectra]] $X$ and $E$, their _function spectrum_ $F(X,E)$ is the [[internal hom]] in a suitable category of spectra.

In the context of [[generalized (Eilenberg-Steenrod) cohomology]] the generalized $E$-cohomology of a [[topological space]] $X$ is given by the [[homotopy groups]] of the mapping spectrum $[\Sigma_\infty X, E]$.

## Related concepts

* [[smash product of spectra]], [[symmetric monoidal smash product of spectra]]

* [[stable splitting of mapping spaces]]

## References

* [[Harold Hastings]], _On function spectra_, Proceedings of the AMS, volume 44, Number 1, May 1974 ([pdf](http://www.ams.org/journals/proc/1974-044-01/S0002-9939-1974-0343258-4/S0002-9939-1974-0343258-4.pdf))

For [[symmetric spectra]]:

* [[Stefan Schwede]], example 3.38 of _[[Symmetric spectra]]_ (2012)

[[!redirects function spectra]]

[[!redirects mapping spectrum]]
[[!redirects mapping spectra]]


function type

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

# Contents
* table of contents
{: toc}

## Idea

In [[type theory]] a _function type_ $X \to Y$ for two [[types]] $X,Y$ is the [[type]] of [[functions]] from $X$ to $Y$.

In a [[model]] of the type theory in [[categorical semantics]], this is an [[exponential object]]. In [[set theory]], it is a [[function set]]. In [[dependent type theory]], it is a special case of a [[dependent product type]].

Function types are important because they allow the user to [[quantification|quantify]] over [[functions]] in [[type theory]]. In [[material set theory]] functions are sets and one could quantify over sets, while in [[structural set theory]], while functions are different from sets, one could still quantify over the [[sort]] of functions. However, in [[type theory]], one cannot quantify over families of elements $x:A \vdash b(x):B$, which are the analogue of functions in material and structural set theory, since families of elements are not elements of a single type, and quantification only occurs over a single type. Instead, one uses function types whose elements, called functions, represent families of elements, in the same way that the elements of [[type universes]] represent types.

## Overview

[[!include function type natural deduction - table]]

## Definition

Like any type constructor in type theory, a function type is specified by rules saying when we can introduce it as a type, how to [[term introduction|construct terms]] of that type, how to use or "[[term elimination|eliminate]]" terms of that type, and how to compute when we combine the constructors with the eliminators.

The [[type formation]] rule to build a function type is easy:

$$\frac{A\colon Type \qquad B \colon Type}{A\to B\colon Type}$$

### As a negative type

Function types are almost always defined as a [[negative type]].  In this presentation, primacy is given to the eliminators.  The natural eliminator of a function type says that we can [[function application|apply]] it to any input:

$$\frac{f\colon A\to B \qquad a\colon A}{f(a) \colon B}$$

The constructor is then determined as usual for a negative type: to construct a term of $A\to B$, we have to specify how it behaves when applied to any input.  In other words, we should have a term of type $B$ containing a free variable of type $A$.  This yields the usual "$\lambda$-abstraction" constructor:

$$\frac{x\colon A\vdash b\colon B}{\lambda x.b\colon A\to B}$$

The [[∞-reduction]] rule is the obvious one (the ur-example of all $\beta$-reductions), saying that when we evaluate a $\lambda$-abstraction, we do it by substituting for the bound variable.

$$(\lambda x.b)(a) \;\to_\beta\; b[a/x]$$

If we want an [[∞-conversion]] rule, the natural one says that every function is a $\lambda$-abstraction:

$$ \lambda x.f(x) \;\to_\eta\; f$$

### As a positive type

It is also possible to present function types as a [[positive type]].  However, this requires a stronger metatheory, such as a [[logical framework]].  We use the same constructor ($\lambda$-abstraction), but now the eliminator says that to define an operation using a function, it suffices to say what to do in the case that that function is a lambda abstraction.

$$\frac{(x\colon A \vdash b\colon B) \vdash c\colon C \qquad f\colon A\to B}{funsplit(c,f)\colon C}$$

This rule cannot be formulated in the usual presentation of type theory, since it involves a "higher-order judgment": the context of the term $c\colon C$ involves a "term of type $B$ containing a free variable of type $A$".  However, it is possible to make sense of it.  In [[dependent type theory]], we need additionally to allow $C$ to depend on $A\to B$.

The natural $\beta$-reduction rule for this eliminator is

$$ funsplit(c, \lambda x.g) \;\to_\beta c[g/b] $$

and its $\eta$-conversion rule looks something like

$$ funsplit(c[\lambda x.b / g], f) \;\to_\eta\; c[f/g]. $$

Here $g\colon A\to B \vdash c\colon C$ is a term containing a free variable of type $A\to B$.  By substituting $\lambda x.b$ for $g$, we obtain a term of type $C$ which depends on "a term $b\colon B$ containing a free variable $x\colon A$".  We then apply the positive eliminator at $f\colon A\to B$, and the $\eta$-rule says that this can be computed by just substituting $f$ for $g$ in $c$.

### Positive versus negative

As usual, the positive and negative formulations are equivalent in a suitable sense.  They have the same constructor, while we can formulate the eliminators in terms of each other:

$$
\begin{aligned}
  f(a) &\coloneqq funsplit(b[a/x], f)\\
  funsplit(c, f) &\coloneqq c[f(x)/b]
\end{aligned}
$$

The conversion rules also correspond.

In dependent type theory, this definition of $funsplit$ only gives us a properly typed dependent eliminator if the negative function type satisfies $\eta$-conversion.  As usual, if it satisfies [propositional eta-conversion](/nlab/show/eta-conversion#Propositional) then we can transport along that instead---and conversely, the dependent eliminator allows us to prove propositional $\eta$-conversion.  This is the content of Propositions 3.5, 3.6, and 3.7 in [(Garner)](#GarnerSDP).

### Function types a la Russell and a la Tarski

In [[dependent type theory]], there are two different ways to interpret the term $f:A \to B$:

1. $f$ is literally a family of terms in $B$ indexed by $A$

1. $f$ is a term representation for a family of terms in $B$ indexed by $A$

This situation is similar to how there are two notions of [[type universe]] where [[small types]] of a universe are interpreted [[Russell universe|a la Russell]], literally as types, or [[Tarski universe|a la Tarski]], as a term representation of types. Thus, in analogy to type universes, we can refer to function types *a la Russell* and function types *a la Tarski*.

Function types a la Russell and a la Tarski are expressed respectively via the [[elimination rule]] of function types:

* given types $A$ and $B$ and a term $f:A \to B$, one could form the family of terms $x:A \vdash f(x):B$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma \vdash f:A \to B}{\Gamma, x:A \vdash f(x):B}$$

* given types $A$ and $B$, one could form the family of terms $f:A \to B, x:A \vdash \mathrm{eval}(f, x):B$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A \vdash \mathrm{eval}(f, x):B}$$

Function types a la Tarski corresponds to the notion of [[exponential object]] in [[category theory]] where the exponential object $B^A$ literally comes with a morphism $\mathrm{eval}:B^A \times A \to B$, but function types a la Russell are the one most commonly used in [[dependent type theory]].

The conversion rules for function types a la Russell are as follows:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B}{\Gamma, x:A \vdash (\lambda x:A.b(x))(x) \equiv b(x):B}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma \vdash f:A \to B}{\Gamma \vdash f \equiv \lambda x:A.f(x):A \to B}$$

and the conversion rules for function types a la Tarski are as follows:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B}{\Gamma, x:A \vdash \mathrm{eval}(\lambda x:A.b(x), x) \equiv b(x):B}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B \vdash f \equiv \lambda x:A.\mathrm{eval}(f, x):A \to B}$$

For the rest of the article we shall assume the use of function types a la Russell.

### Weak and strict function types

In [[dependent type theory]], **weak function types** are function types for which the [[computation rules]] ($\beta$-conversion) and [[uniqueness rules]] ($\eta$-conversion) are propositional rather than judgmental:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B}{\Gamma, a:A \vdash \beta_{A \to B}^{x:A.b(x)}(a):(\lambda(x:A).b(x))(a) =_{B} b(a)}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B \vdash \eta_{A \to B}(f):f =_{A \to B} \lambda(x:A).f(x)}$$

Weak function types appear in [[weak type theories]].

This contrasts with **strict function types** which use judgmental computation and uniqueness rules:

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B}{\Gamma, a:A \vdash (\lambda(x:A).b(x))(a) \equiv b(a):B}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B \vdash f \equiv \lambda(x:A).f(x):A \to B}$$

Strict function types appear in most dependent type theories such as [[Martin-Löf type theory]], [[observational type theory]], and [[cubical type theory]].

For strict function types, the judgmental computation and uniqueness rules automatically imply the propositional computation and uniqueness rules, as by the rules for [[judgmental equality]] and [[identity types]], judgmental equality of two terms always implies propositional equality of the two terms.

### As types of anafunctions

In [[dependent type theory]], in the same way that one could define [[equivalence types]] as types of [[one-to-one correspondences]], one could also define function types as types of [[anafunctions]]. This requires both [[identity types]] and [[heterogeneous identity types]] being defined first, which we shall write as $a =_A b$ and $x =_{B}^{p} y$ respectively for $a:A$, $b:A$, $p:a =_A b$, $x:B(a)$, and $y:B(b)$.

Rules for function types
$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma \vdash A \to B \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A, y:B \vdash \mathcal{F}_{A, B}(f, x, y) \; \mathrm{type}}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B}{\Gamma \vdash x \mapsto f(x):A \to B}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B}{\Gamma, x:A \vdash \alpha(x):\mathcal{F}_{A, B}(x \mapsto f(x), x, f(x))}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A \vdash \mathrm{ev}(f, x):B}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A \vdash \beta(f, x):\mathcal{F}_{A, B}(f, x, \mathrm{ev}(f, x))}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A, y:B,  u:\mathcal{F}_{A, B}(f, x, y) \vdash \kappa(f, x, y, u):\mathrm{ev}(f, x) =_B y}$$

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B, x:A, y:B,  u:\mathcal{F}_{A, B}(f, x, y) \vdash \eta(f, x, y, u):\beta(f, x) =_{\mathcal{F}_{A, B}(f, x)}^{\kappa(f, x, y, u)} u}$$

By the rules for [[dependent sum types]] and [[dependent product types]], one could derive that

$$\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \to B \vdash \eta(f):\prod_{x:A} \mathrm{isContr}\left(\sum_{y:B} \mathcal{F}_{A, B}(f, x, y) \right)}$$

which is precisely the statement that $\mathcal{F}_{A, B}(f)$ is an [[anafunction]] for all functions $f:A \to B$.

## Properties

### Relation to dependent product types

In [[dependent type theory]] a function type $A \to B$ is the special case the [[dependent product type]] over $a : A$ for the special case that $B$ is regarded as an $A$-[[dependent type]] $x:A \vdash B$ that actually happens to be $A$-independent; this type family $x:A \vdash B$ can always be constructed by the [[weakening rule]] of dependent type theory, which is an [[admissible rule]].

$$
  (X \to A)
  =
  \prod_{x \colon X} A
  \,.
$$

In [[categorical semantics]] this is the statement that a [[section]] of a product [[projection]] $A \times B \to A$ is equivalently just a morphism $A \to B$.

See also at _[[function monad]]_.

### Typal congruence rules and uniqueness rules

The typal computation rule for function types is provable from the other four typal type formers of function types. Given types $A$ and $B$ and function $f:A \to B$, we have, by the elimination rule and the introduction rule, a function $\lambda x:A.f(x):A \to B$, which by the uniqueness rules of dependent product types are equal to each other
$$\eta_{A \to B}(f):f =_{A \to B} \lambda x:A.f(x)$$
By the inductively defined function $\mathrm{idtohomotopy}$ which takes [[identifications]] between functions to [[homotopies]] between functions]], we have that
$$\mathrm{idtohomotopy}(f, \lambda x:A.f(x))(\eta_{A \to B}(f)):\prod_{x:A} f(x) =_{A \to B} (\lambda x:A.f(x))(x)$$
which is the typal computation rule for function types.

### Function types as hom-objects
 {#AsHomObjects}

Function types play the role of [[hom-objects]] in a kind of [[enriched category]] whose objects are the [[types]]. (In fact, in the presence of compatible [[product types]] this is a [[cartesian closed category]]-structure, cf. [Lambek & Scott 1986](relation+between+type+theory+and+category+theory#LambekScott86)). They have [[identity functions]] and a [[composition]]-operation which together satisfy the [[associativity]] and [[unitality]] laws:

* For strict function types, the associative and unital laws are represented by judgmental equality

* For weak function types, the associative and unital laws are represented by [[associator]] and [[unitor]] [[homotopies]], and, assuming [[function extensionality]], also by [[associator]] and [[unitor]] [[identifications]]. In addition, there is also an infinite tower of [[coherence laws]] representing the [[(infinity,1)-category|$(\infty,1)$-categorical structure]] of function types by constructing the [[pentagonator]] and so forth, but this isn't demonstrated in this section, and is unnecessary in the presence of a [[set truncation axiom]] like [[UIP]] or [[axiom K]].

#### Strict function types

\begin{definition}
Given a type $A$, we define the **identity function** on $A$ as the function

$$\mathrm{id}_A \equiv \lambda (x:A).x:A \to A$$
\end{definition}

\begin{theorem}
By the computation rules for strict function types, the identity function on a type $A$ comes with a family of judgmental equalities

$$x:A \vdash \mathrm{id}_A(x) \equiv x:A$$
\end{theorem}

\begin{definition}
Given types $A$, $B$, and $C$ and functions $f:A \to B$, and $g:B \to C$, **function composition** of $f$ and $g$ is defined as

$$g \circ_{A, B, C} f \equiv \lambda (x:A).g(f(x)):A \to C$$
\end{definition}

\begin{theorem}
By the computation rules for strict function types, function composition comes with a family of judgmental equalities

$$x:A \vdash (g \circ_{A, B, C} f)(x) \equiv g(f(x)):C$$
\end{theorem}

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, there is a family of judgmental equalities

$$x:A \vdash (\mathrm{id}_B \circ_{A, B, B} f)(x) \equiv f(x):B$$
\end{theorem}

\begin{proof}
By the computation rule for strict function types, there is a family of judgmental equalities

$$x:A \vdash (\mathrm{id}_B \circ_{A, B, B} f)(x) \equiv \mathrm{id}_B(f(x)):B$$

and a family of judgmental equalities

$$x:A \vdash \mathrm{id}_B(f(x)) \equiv f(x):B$$

Now, by the [[structural rules]] for [[judgmental equality]], there is a family of judgmental equalities

$$x:A \vdash (\mathrm{id}_B \circ_{A, B, B} f)(x) \equiv f(x):B$$
\end{proof}

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, there is a family of judgmental equalities

$$x:A \vdash (f \circ_{A, A, B} \mathrm{id}_A)(x) \equiv f(x):B$$
\end{theorem}

\begin{proof}
By the computation rule for strict function types, there is a family of judgmental equalities

$$x:A \vdash (f \circ_{A, A, B} \mathrm{id}_A)(x) \equiv f(\mathrm{id}_A(x)):B$$

and a family of identifications

$$x:A \vdash f(\mathrm{id}_A(x)) \equiv f(x):B$$

Now, by the [[structural rules]] for [[judgmental equality]], there is a family of judgmental equalities

$$x:A \vdash (f \circ_{A, A, B} \mathrm{id}_A)(x) \equiv f(x):B$$
\end{proof}

\begin{theorem}
For all types $A$, $B$, $C$, and $D$, and functions $f:A \to B$, $g:B \to C$, and $h:C \to D$, there is a family of judgmental equalities

$$x:A \vdash (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) \equiv ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x):D$$
\end{theorem}

\begin{proof}
By the computation rule for strict function types, there are families of judgmental equalities

$$x:A \vdash (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) \equiv h((g \circ_{A, B, C} f)(x)):D$$

$$x:A \vdash ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x) \equiv (h \circ_{B, C, D} g)(f(x)):D$$

$$x:A \vdash (h \circ_{B, C, D} g)(f(x)) \equiv h(g(f(x))):D$$

$$x:A \vdash h((g \circ_{A, B, C} f)(x)) \equiv h(g(f(x)):D$$

Now, by the [[structural rules]] for [[judgmental equality]], there is a family of judgmental equalities

$$x:A \vdash (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) \equiv ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x):D$$
\end{proof}

Now, the judgmental [[uniqueness rule]] for strict function types implies function extensionality for judgmental equality: for types $A$ and $B$ and functions $f:A \to B$ and $g:A \to B$ such that there is a family of judgmental equalities $x:A \vdash f(x) \equiv g(x):B$, there is a judgmental equality $f \equiv g:A \to B$. (See exercise 2.1 of [Rijke 2022](#Rijke22))

As a result, the associative and unital laws hold for functions:

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, there is a judgmental equality

$$\mathrm{id}_B \circ_{A, B, B} f \equiv f:A \to B$$
\end{theorem}

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, there is a judgmental equality

$$f \circ_{A, A, B} \mathrm{id}_A \equiv f:A \to B$$
\end{theorem}

\begin{theorem}
For all types $A$, $B$, $C$, and $D$, and functions $f:A \to B$, $g:B \to C$, and $h:C \to D$, there is a judgmental equality

$$(h \circ_{A, C, D} (g \circ_{A, B, C} f)) \equiv ((h \circ_{B, C, D} g) \circ_{A, B, D} f):A \to D$$
\end{theorem}

#### Weak function types

\begin{definition}
Given a type $A$, we define the **identity function** on $A$ as the function

$$\mathrm{id}_A \equiv \lambda (x:A).x:A \to A$$
\end{definition}

\begin{theorem}
By the computation rules for weak function types, the identity function on a type $A$ comes with a family of identifications

$$x:A \vdash \beta_{A \to A}^{x:A.x}(x):\mathrm{id}_A(x) =_{A} x$$
\end{theorem}

\begin{definition}
Given types $A$, $B$, and $C$ and functions $f:A \to B$, and $g:B \to C$, **function composition** of $f$ and $g$ is defined as

$$g \circ_{A, B, C} f \equiv \lambda (x:A).g(f(x)):A \to C$$
\end{definition}

\begin{theorem}
By the computation rules for weak function types, function composition comes with a family of identifications

$$x:A \vdash \beta_{A \to C}^{x:A.g(f(x))}(x):(g \circ_{A, B, C} f)(x) =_{C} g(f(x))$$
\end{theorem}

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, the dependent function type

$$\prod_{x:A} (\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} f(x)$$

has a homotopy.
\end{theorem}

\begin{proof}
By the computation rule for weak function types, there is a family of identifications

$$x:A \vdash \beta_{A \to B}^{x:A.\mathrm{id}_B(f(x))}(x):(\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} \mathrm{id}_B(f(x))$$

and a family of identifications

$$x:A \vdash \beta_{B \to B}^{x:A.f(x)}(x):\mathrm{id}_B(f(x)) =_{B} f(x)$$

Now, by concatenating the individual identifications together and then using lambda abstraction, we have the homotopy

$$\lambda (x:A).\beta_{A \to B}^{x:A.\mathrm{id}_B(f(x))}(x) \bullet \beta_{B \to B}^{x:A.f(x)}(x):\prod_{x:A} (\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} f(x)$$
\end{proof}

\begin{definition}
For types $A$ and $B$ and function $f:A \to B$, we define the **left unitor homotopy** as the homotopy

$$\mathrm{lunith}_{A, B}(f) \equiv \lambda (x:A).\beta_{A \to B}^{x:A.\mathrm{id}_B(f(x))}(x) \bullet \beta_{B \to B}^{x:A.f(x)}(x):\prod_{x:A} (\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} f(x)$$
\end{definition}

\begin{theorem}
For all types $A$ and $B$ and functions $f:A \to B$, the dependent function type

$$\prod_{x:A} (f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(x)$$

has a homotopy.
\end{theorem}

\begin{proof}
By the computation rule for weak function types, there is a family of identifications

$$x:A \vdash \beta_{A \to B}^{x:A.f(\mathrm{id}_A(x))}(x):(f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(\mathrm{id}_A(x))$$

and also by the action on identifications of the function $f:A \to B$, a family of identifications

$$x:A \vdash \mathrm{ap}_B(f, \mathrm{id}_A(x), x, \beta_{A \to A}^{x:A.x}(x)):f(\mathrm{id}_A(x)) =_{B} f(x)$$

Now, by concatenating the individual identifications together and then using lambda abstraction, we have the homotopy

$$\lambda (x:A).\beta_{A \to B}^{x:A.f(\mathrm{id}_A(x))}(x) \bullet \mathrm{ap}_B(f, \mathrm{id}_A(x), x, \beta_{A \to A}^{x:A.x}(x)):\prod_{x:A} (f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(x)$$
\end{proof}

\begin{definition}
For types $A$ and $B$ and function $f:A \to B$, we define the **right unitor homotopy** as the homotopy

$$\mathrm{runith}_{A, B}(f) \equiv \lambda (x:A).\beta_{A \to B}^{x:A.f(\mathrm{id}_A(x))}(x) \bullet \mathrm{ap}_B(f, \mathrm{id}_A(x), x, \beta_{A \to A}^{x:A.x}(x)):\prod_{x:A} (f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(x)$$
\end{definition}

\begin{theorem}
For all types $A$, $B$, $C$, and $D$, and functions $f:A \to B$, $g:B \to C$, and $h:C \to D$, the dependent function type

$$\prod_{x:A} (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x)$$

has a homotopy.
\end{theorem}

\begin{proof}
By the computation rule for weak function types, there are families of identifications

$$x:A \vdash \beta_{A \to D}^{x:A.h((g \circ_{A, B, C} f)(x))}(x):(h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} h((g \circ_{A, B, C} f)(x))$$

$$x:A \vdash \beta_{A \to D}^{x:A.(h \circ_{B, C, D} g)(f(x))}(x):((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x) =_{D} (h \circ_{B, C, D} g)(f(x))$$

$$x:A \vdash \beta_{A \to D}^{x:A.h(g(f(x)))}(x):(h \circ_{B, C, D} g)(f(x)) =_{D} h(g(f(x)))$$

and also by the action on identifications of the function $h:C \to D$, there is a family of identifications

$$x:A \vdash \mathrm{ap}_D(h, (g \circ_{A, B, C} f)(x), g(f(x)), \beta_{A \to C}^{x:A.g(f(x))}(x)):h((g \circ_{A, B, C} f)(x)) =_{D} h(g(f(x))$$

Now, by concatenating and inverting the individual identifications together and then using lambda abstraction, we have the homotopy

$$\begin{array}{c}
	\lambda (x:A).\beta_{A \to D}^{x:A.h((g \circ_{A, B, C} f)(x))}(x) \bullet \mathrm{ap}_D(h, (g \circ_{A, B, C} f)(x), g(f(x)), \beta_{A \to C}^{x:A.g(f(x))}(x)) \\
	 \bullet \beta_{A \to D}^{x:A.h(g(f(x)))}(x)^{-1} \bullet \beta_{A \to D}^{x:A.(h \circ_{B, C, D} g)(f(x))}(x)^{-1}:\prod_{x:A} (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x)
\end{array}
$$
\end{proof}

\begin{definition}
For types $A$, $B$, $C$, and $D$ and functions $f:A \to B$, $f:B \to C$, and $h:C \to D$, we define the **associator homotopy** as the homotopy

$$\begin{array}{c}
	\mathrm{assoch}_{A, B, C, D}(f, g, h) \equiv \lambda (x:A).\beta_{A \to D}^{x:A.h((g \circ_{A, B, C} f)(x))}(x) \bullet \mathrm{ap}_D(h, (g \circ_{A, B, C} f)(x), g(f(x)), \beta_{A \to C}^{x:A.g(f(x))}(x)) \\
	 \bullet \beta_{A \to D}^{x:A.h(g(f(x)))}(x)^{-1} \bullet \beta_{A \to D}^{x:A.(h \circ_{B, C, D} g)(f(x))}(x)^{-1}:\prod_{x:A} (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x)
\end{array}
$$
\end{definition}

Now, recall that the canonical $\mathrm{idtohomotopy}$ function

$$\mathrm{idtohomotopy}_{A, B}(f, g):f =_{A \to B} g \to \prod_{x:A} f(x) =_{B} g(x)$$

is inductively defined by

$$\mathrm{idtohomotopy}_{A, B}(f, f)(\mathrm{refl}_{A \to B}(f)) \equiv \lambda (x:A).\mathrm{refl}_{B}(f(x)):\prod_{x:A} f(x) =_{B} g(x)$$

[[function extensionality]] states that $\mathrm{idtohomotopy}_{A, B}(f, g)$ is an [[equivalence of types]] for all functions $f:A \to B$ and $g:A \to B$

$$\mathrm{funext}_{A, B}:\prod_{f:A \to B} \prod_{g:A \to B} \mathrm{isEquiv}(\mathrm{idtohomotopy}_{A, B}(f, g))$$

Thus, there is an [[inverse function]]

$$\mathrm{idtohomotopy}_{A, B}(f, g)^{-1}:\left(\prod_{x:A} \mathrm{Id}_{B}(f(x), g(x))\right) \to f =_{A \to B} g$$

With function extensionality, we can now prove the associative and unital laws, showing that function are a category:

\begin{theorem}
Assuming function extensionality, for all types $A$ and $B$ and functions $f:A \to B$, the identity type

$$\mathrm{id}_B \circ_{A, B, B} f =_{A \to B} f$$

has an identification.
\end{theorem}

\begin{proof}
By function extensionality, the function

$$\mathrm{idtohomotopy}_{A, B}(\mathrm{id}_B \circ_{A, B, B} f, f):(\mathrm{id}_B \circ_{A, B, B} f =_{A \to B} f) \to \prod_{x:A} (\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} f(x)$$

has an inverse function

$$\mathrm{idtohomotopy}_{A, B}(\mathrm{id}_B \circ_{A, B, B} f, f)^{-1}:\left(\prod_{x:A} (\mathrm{id}_B \circ_{A, B, B} f)(x) =_{B} f(x)\right) \to (\mathrm{id}_B \circ_{A, B, B} f =_{A \to B} f)$$

One then gets the identification

$$\mathrm{idtohomotopy}_{A, B}(\mathrm{id}_B \circ_{A, B, B} f, f)^{-1}(\mathrm{lunith}_{A, B}(f)):\mathrm{id}_B \circ_{A, B, B} f =_{A \to B} f$$
\end{proof}

\begin{definition}
For types $A$ and $B$ and function $f:A \to B$, we define the **left unitor** as the identification

$$\mathrm{lunit}_{A, B}(f) \equiv \mathrm{idtohomotopy}_{A, B}(\mathrm{id}_B \circ_{A, B, B} f, f)^{-1}(\mathrm{lunith}_{A, B}(f)):\mathrm{id}_B \circ_{A, B, B} f =_{A \to B} f$$
\end{definition}

\begin{theorem}
Assuming function extensionality, for all types $A$ and $B$ and functions $f:A \to B$, the identity type

$$f \circ_{A, A, B} \mathrm{id}_A =_{A \to B} f$$

has an identification.
\end{theorem}

\begin{proof}
By function extensionality, the function

$$\mathrm{idtohomotopy}_{A, B}(f \circ_{A, A, B} \mathrm{id}_A, f):(f \circ_{A, A, B} \mathrm{id}_A =_{A \to B} f) \to \prod_{x:A} (f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(x)$$

has an inverse function

$$\mathrm{idtohomotopy}_{A, B}(f \circ_{A, A, B} \mathrm{id}_A, f)^{-1}:\left(\prod_{x:A} (f \circ_{A, A, B} \mathrm{id}_A)(x) =_{B} f(x)\right) \to (f \circ_{A, A, B} \mathrm{id}_A =_{A \to B} f)$$

One then gets the identification

$$\mathrm{idtohomotopy}_{A, B}(f \circ_{A, A, B} \mathrm{id}_A, f)^{-1}(\mathrm{runith}_{A, B}(f)):f \circ_{A, A, B} \mathrm{id}_A =_{A \to B} f$$
\end{proof}

\begin{definition}
For types $A$ and $B$ and function $f:A \to B$, we define the **right unitor** as the identification

$$\mathrm{runit}_{A, B}(f) \equiv \mathrm{idtohomotopy}_{A, B}(f \circ_{A, A, B} \mathrm{id}_A, f)^{-1}(\mathrm{runith}_{A, B}(f)):f \circ_{A, A, B} \mathrm{id}_A =_{A \to B} f$$
\end{definition}

\begin{theorem}
Assuming function extensionality, for all types $A$, $B$, $C$, and $D$ and functions $f:A \to B$, $f:B \to C$, and $h:C \to D$, the identity type

$$h \circ_{A, C, D} (g \circ_{A, B, C} f) =_{A \to D} (h \circ_{B, C, D} g) \circ_{A, B, D} f$$

has an identification.
\end{theorem}

\begin{proof}
By function extensionality, the function

$$
\begin{array}{c}
	\mathrm{idtohomotopy}_{A, D}(h \circ_{A, C, D} (g \circ_{A, B, C} f), (h \circ_{B, C, D} g) \circ_{A, B, D} f): \\
	(h \circ_{A, C, D} (g \circ_{A, B, C} f) =_{A \to D} (h \circ_{B, C, D} g) \circ_{A, B, D} f) \\
	\to \prod_{x:A} (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x)
\end{array}
$$

has an inverse function

$$
\begin{array}{c}
	\mathrm{idtohomotopy}_{A, D}(h \circ_{A, C, D} (g \circ_{A, B, C} f), (h \circ_{B, C, D} g) \circ_{A, B, D} f)^{-1}: \\
	\left(\prod_{x:A} (h \circ_{A, C, D} (g \circ_{A, B, C} f))(x) =_{D} ((h \circ_{B, C, D} g) \circ_{A, B, D} f)(x)\right) \\
	\to (h \circ_{A, C, D} (g \circ_{A, B, C} f) =_{A \to D} (h \circ_{B, C, D} g) \circ_{A, B, D} f)
\end{array}
$$

One then gets the identification

$$
\begin{array}{c}
	\mathrm{idtohomotopy}_{A, D}(h \circ_{A, C, D} (g \circ_{A, B, C} f), (h \circ_{B, C, D} g) \circ_{A, B, D} f)^{-1}(\mathrm{assoch}_{A, B, C, D}(f, g, h)):\\
	h \circ_{A, C, D} (g \circ_{A, B, C} f) =_{A \to D} (h \circ_{B, C, D} g) \circ_{A, B, D} f
\end{array}
$$
\end{proof}

\begin{definition}
For types $A$, $B$, $C$, and $D$ and functions $f:A \to B$, $f:B \to C$, and $h:C \to D$, we define the **associator** as the identification

$$
\begin{array}{c}
	\mathrm{assoc}_{A, B, C, D}(f, g, h) \equiv \mathrm{idtohomotopy}_{A, D}(h \circ_{A, C, D} (g \circ_{A, B, C} f), (h \circ_{B, C, D} g) \circ_{A, B, D} f)^{-1}(\mathrm{assoch}_{A, B, C, D}(f, g, h)):\\
	h \circ_{A, C, D} (g \circ_{A, B, C} f) =_{A \to D} (h \circ_{B, C, D} g) \circ_{A, B, D} f
\end{array}
$$
\end{definition}

### Typal congruence rules

These are called *typal congruence rules* because they are the analogue of the judgmental [[congruence rules]] which use [[identity types]] and [[equivalence types]] instead of [[judgmental equality]].

#### Strict function types

Since [[function types]] are negative types, we first present the typal congruence rule for the elimination rule of function types

\begin{theorem}
Given types $A$ and $B$, functions $f:A \to B$ and $g:A \to B$ and an identification $p:f =_{A \to B} g$ there are families of identifications $x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_B g(x)$.
\end{theorem}

\begin{proof}
We simply define the dependent function $\mathrm{compelim}$ to be the canonical inductively defined function $\mathrm{idtohomotopy}$ which takes identifications between functions to homotopies between functions.
\end{proof}

The next is the typal congruence rule for the introduction rule of function types. However, unlike the case for the other two rules, one needs function extensionality.

\begin{theorem}
Assuming [[function extensionality]], given types $A$ and $B$, families of elements $x:A \vdash b(x):B$ and $x:A \vdash b'(x):B$, and families of [[identifications]] $x:A \vdash p(x):b(x) =_B b'(x)$, there is an identification
$$\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{A \to B} \lambda (x:A).b'(x)$$
\end{theorem}

\begin{proof}
By the computation rule of strict function types, there are families of judgmental equalities

$$x:A \vdash ((\lambda x:A.b(x))(x) \equiv b(x):B$$
$$x:A \vdash ((\lambda x:A.b'(x))(x) \equiv b'(x):B$$

Thus, by the [[structural rules]] of [[judgmental equality]], there are families of identificaitons

$$x:A \vdash p(x):(\lambda x:A.b(x))(x) =_B (\lambda x:A.b'(x))(x)$$

and by $\lambda$-abstraction, one gets the dependent function

$$\lambda (x:A).p(x):\prod_{x:A} (\lambda x:A.b(x))(x) =_B (\lambda x:A.b'(x))(x)$$

By [[function extensionality]], there is an [[equivalence of types]]

$$\mathrm{funext}:(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x)) \simeq \prod_{x:A} \mathrm{Id}_B((\lambda x:A.b(x))(x), (\lambda x:A.b'(x))(x))$$

which yields an identification

$$\mathrm{funext}^{-1}(\lambda (x:A).p(x)):(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x))$$

We define

$$\mathrm{congintro}_{x:A.p(x)} \coloneqq \mathrm{funext}^{-1}(\lambda (x:A).p(x)):(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x))$$
\end{proof}

Finally, we present the typal congruence rule for the formation rule of function types, which relies upon the previous two results.

\begin{theorem}
Given types $A$, $A'$, $B$, $B'$ and equivalences $e_A:A \simeq A'$ and $e_B:B \simeq B'$, there is an equivalence
$$\mathrm{congform}(e_A, e_B):(A \to B) \simeq (A' \to B')$$
\end{theorem}

\begin{proof}
We define the function $\mathrm{congform}(e_A, e_B):(A \to B) \to (A' \to B')$ by

$$\mathrm{congform}(e_A, e_B) \coloneqq \lambda (f:A \to B).\lambda x:A'.e_B(f(e_A^{-1}(x)))$$

and the inverse function by

$$\mathrm{congform}(e_A, e_B)^{-1} \coloneqq \lambda (g:A' \to B').\lambda x:A.e_B^{-1}(g(e_A(x)))$$

Now it suffices to construct homotopies

$$\prod_{f:A \to B} \mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{A \to B} f$$

$$\prod_{g:A' \to B'} \mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) =_{A' \to B'} g$$

from where it implies that $\mathrm{congform}(e_A, e_B)$ has a coherent inverse and contractible fibers and is thus an [[equivalence of types]].

By definition,
$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B^{-1}((\lambda x:A'.e_B(f(e_A^{-1}(x))))(e_A(x)))$$

By the computation rules of strict function types, there is a family of judgmental equalities
$$x:A \vdash (\lambda x:A'.e_B(f(e_A^{-1}(x))))(e_A(x)) \equiv e_B(f(e_A^{-1}(e_A(x))))$$
and thus by the structural rules of [[judgmental equalities]] and the judgmental congruence rules for function types, a judgmental equality
$$\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) \equiv \lambda x:A.e_B^{-1}(e_B(f(e_A^{-1}(e_A(x)))))$$

The equivalence $e_B:B \simeq B'$ has a family of identifications
$$x:B \vdash \mathrm{ret}_{e_B}(x):e_B^{-1}(e_B(x)) =_{B} x$$
witnessing that $e_B^{-1}$ is a [[retraction]] of $e_B$.

This means that by applying the canonical inductively defined function $\mathrm{idtohomotopy}$ which takes identifications between functions to homotopies between functions, one gets the family of identifications
$$\mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))):e_B^{-1}(e_B(f(e_A^{-1}(e_A(x))))) =_{B} f(e_A^{-1}(e_A(x)))$$

Similarly, the equivalence $e_A:A \simeq A'$ has a family of identifications
$$x:B \vdash \mathrm{ret}_{e_A}(x):e_A^{-1}(e_A(x)) =_{A} x$$
witnessing that $e_A^{-1}$ is a [[retraction]] of $e_A$.

This means by applying $f$ to the above family of identifications, one gets the family of identifications
$$x:A \vdash \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)):f(e_A^{-1}(e_A(x))) =_{B} f(x)$$

By concatenation of identifications, one gets the family of identifications

$$x:A \vdash \mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))) \bullet \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)):e_B^{-1}(e_B(f(e_A^{-1}(e_A(x))))) =_{B} f(x)$$

By lambda abstraction, one gets the homotopy
$$\lambda x:A.\mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))) \bullet \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x)):\prod_{x:A} e_B^{-1}(e_B(f(e_A^{-1}(e_A(x))))) =_{B} f(x)$$
and by function extensionality, this is the same as
$$\mathrm{funext}^{-1}(\lambda x:A.\mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))) \bullet \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x))):\lambda (x:A).e_B^{-1}(e_B(f(e_A^{-1}(e_A(x))))) =_{A \to B} \lambda x:A.f(x)$$

By the computation rules of strict function types and the structural rules of judgmental equality, the type
$$\lambda (x:A).e_B^{-1}(e_B(f(e_A^{-1}(e_A(x))))) =_{A \to B} \lambda x:A.f(x)$$
is judgmentally equal to $\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{A \to B} f$, so we have
$$\mathrm{funext}^{-1}(\lambda x:A.\mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))) \bullet \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x))):\mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{A \to B} f$$

$\lambda$-abstraction on functions $f:A \to B$ leads to the dependent function

$$\lambda (f:A \to B).\mathrm{funext}^{-1}(\lambda x:A.\mathrm{idtohomotopy}(\lambda x:A.e_B^{-1}(e_B(x)), \lambda x:A.x, f(e_A^{-1}(e_A(x))) \bullet \mathrm{ap}(f, e_A^{-1}(e_A(x)), x, \mathrm{ret}_{e_A}(x))):\prod_{f:A \to B} \mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{A \to B} f$$

By a similar argument swapping the types around and the corresponding equivalences with inverse equivalences; one also has
$$\lambda (g:A' \to B').\mathrm{funext}^{-1}(\lambda x:A'.\mathrm{idtohomotopy}(\lambda x:A'.e_B(e_B^{-1}(x)), \lambda x:A'.x, g(e_A(e_A^{-1}(x))) \bullet \mathrm{ap}(g, e_A(e_A^{-1}(x)), x, \mathrm{ret}_{e_A^{-1}}(x))):\prod_{g:A' \to B'} \mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) =_{A' \to B'} g$$

Thus, $\mathrm{congform}(e_A, e_B):(A \to B) \to (A' \to B')$ is an equivalence of types.
\end{proof}

#### Weak function types

\begin{theorem}
Given types $A$, $A'$, $B$, $B'$ and equivalences $e_A:A \simeq A'$ and $e_B:B \simeq B'$, there is an equivalence
$$\mathrm{congform}(e_A, e_B):(A \to B) \simeq (A' \to B')$$
\end{theorem}

\begin{proof}
We define the function $\mathrm{congform}(e_A, e_B):(A \to B) \to (A' \to B')$ by

$$\mathrm{congform}(e_A, e_B) \coloneqq \lambda (f:A \to B).\lambda x:A'.e_B(f(e_A^{-1}(x)))$$

and the inverse function by

$$\mathrm{congform}(e_A, e_B)^{-1} \coloneqq \lambda (g:A' \to B').\lambda x:A.e_B^{-1}(g(e_A(x)))$$

Now it suffices to construct homotopies

$$\prod_{f:A \to B} \mathrm{congform}(e_A, e_B)^{-1}(\mathrm{congform}(e_A, e_B)(f)) =_{A \to B} f$$

$$\prod_{g:A' \to B'} \mathrm{congform}(e_A, e_B)(\mathrm{congform}(e_A, e_B)^{-1}(g)) =_{A' \to B'} g$$

from where it implies that $\mathrm{congform}(e_A, e_B)$ has a coherent inverse and contractible fibers and is thus an [[equivalence of types]].

To be finished...
\end{proof}

Since [[function types]] are negative types, we first present the typal congruence rule for the elimination rule of function types

\begin{theorem}
Given types $A$ and $B$, functions $f:A \to B$ and $g:A \to B$ and an identification $p:f =_{A \to B} g$ there are families of identifications $x:A \vdash \mathrm{compelim}(f, g, p)(x):f(x) =_B g(x)$.
\end{theorem}

\begin{proof}
We simply define the dependent function $\mathrm{compelim}$ to be the canonical inductively defined function $\mathrm{idtohomotopy}$ which takes identifications between functions to homotopies between functions.
\end{proof}

The next is the typal congruence rule for the uniqueness rule of function types.

\begin{theorem}
Given types $A$ and $B$, functions $f:A \to B$ and $g:A \to B$, and an identification $p:f =_{A \to B} g$, there is an identification

$$\mathrm{etaCong}_{A \to B}(f, g, p):\mathrm{transport}_{h:A \to B.h =_{A \to B} \lambda x:A.h(x)}(f, g, p)(\eta_{A \to B}(f)) =_{g =_{A \to B} \lambda x:A.g(x)} \eta_{A \to B}(g)$$
\end{theorem}

\begin{proof}
We simply define $\mathrm{etaCong}_{A \to B}(f, g, p)$ to be the [[dependent function application to identifications]]
$$\mathrm{apd}_{h:A \to B.h =_{A \to B} \lambda x:A.h(x)}(\lambda x:A \to B.\eta_{A \to B}(x), f, g, p)$$
where
$$f:A \to B \vdash \eta_{A \to B}(f):f =_{A \to B} \lambda x:A.f(x)$$
is the family of elements in the conclusion of the uniqueness rule for weak function types.
\end{proof}

The next is the typal congruence rule for the introduction rule of function types. However, unlike the case for the other two rules, one needs function extensionality.

\begin{theorem}
Assuming [[function extensionality]], given types $A$ and $B$, families of elements $x:A \vdash b(x):B$ and $x:A \vdash b'(x):B$, and families of [[identifications]] $x:A \vdash p(x):b(x) =_B b'(x)$, there is an identification
$$\mathrm{congintro}_{x:A.p(x)}:\lambda (x:A).b(x) =_{A \to B} \lambda (x:A).b'(x)$$
\end{theorem}

\begin{proof}
By the computation rule of weak function types, there are families of identifications

$$x:A \vdash \beta_{A \to B}^{x:A.b(x)}(b(x)):((\lambda x:A.b(x))(x) =_{B} b(x)$$
$$x:A \vdash \beta_{A \to B}^{x:A.b'(x)}(b'(x)):((\lambda x:A.b'(x))(x) =_{B} b'(x)$$

Thus, there are families of identifications

$$x:A \vdash \beta_{A \to B}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{A \to B}^{x:A.b'(x)}(b'(x))^{-1}:(\lambda x:A.b(x))(x) =_B (\lambda x:A.b'(x))(x)$$

and by $\lambda$-abstraction, one gets the dependent function

$$\lambda (x:A).\beta_{A \to B}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{A \to B}^{x:A.b'(x)}(b'(x))^{-1}:\prod_{x:A} (\lambda x:A.b(x))(x) =_B (\lambda x:A.b'(x))(x)$$

By [[function extensionality]], there is an [[equivalence of types]]

$$\mathrm{funext}:(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x)) \simeq \prod_{x:A} (\lambda x:A.b(x))(x) =_B (\lambda x:A.b'(x))(x)$$

which yields an identification

$$\mathrm{funext}^{-1}(\lambda (x:A).\beta_{A \to B}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{A \to B}^{x:A.b'(x)}(b'(x))^{-1}):(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x))$$

We define

$$\mathrm{congintro}_{x:A.p(x)} \coloneqq \mathrm{funext}^{-1}(\lambda (x:A).\beta_{A \to B}^{x:A.b(x)}(b(x)) \bullet p(x) \bullet \beta_{A \to B}^{x:A.b'(x)}(b'(x))^{-1}):(\lambda x:A.b(x)) =_{A \to B} (\lambda x:A.b'(x))$$
\end{proof}

### Application in logic

In [[logic]], functions types express [[implication]]. More precisely, for $\phi, \psi$ two [[propositions]], under [[propositions as types]] the [[implication]] $\phi \Rightarrow \psi$ is the function type $\phi \to \psi$ (or rather the [[bracket type]] of that if one wishes to force this to be of type $Prop$ again ).

### Graph of a function

Given a type $A$ and $B$, there is a function

$$\mathrm{graph}:\left(A \to B\right) \to \left(A \to A \times B\right)$$

which takes a function $f:A \to B$ and returns the **[[graph of a function]]**
$$\mathrm{graph}(f):A \to (A \times B)$$
defined by $\mathrm{graph}(f)(x) \equiv (x, f(x))$ for all $x:A$. As a [[dependent anafunction]] the graph of the function is represented by the [[identity type]] family

$$x:A, y:B \vdash f(x) =_{B} y$$

and so is equivalently the [[dependent sum type]]

$$\mathrm{graph}(f) \coloneqq \sum_{x:A} \sum_{y:B} f(x) =_{B} y$$

## Related concepts

* [[function application]]

* [[function monad]]

* [[dependent product type]]

* [[equivalence type]], [[embedding type]]

* [[partial function type]]

* [[lambda calculus]]

* [[implication]], [[linear implication]]

* [[extension type]]

## References

A textbook account in the context of [[programming languages]] is in section III of

* [[Robert Harper]], _[[Practical Foundations for Programming Languages]]_

Another textbook account could be found in section 2.2 of:

* {#Rijke22} [[Egbert Rijke]], *[[Introduction to Homotopy Type Theory]]*, Cambridge Studies in Advanced Mathematics, Cambridge University Press ([arXiv:2212.11082](https://arxiv.org/abs/2212.11082))

See also

* [[Richard Garner]], *On the strength of dependent products in the type theory of Martin-Löf*.
 {#GarnerSDP}

[[!redirects function type]]
[[!redirects function types]]

[[!redirects strict function type]]
[[!redirects strict function types]]

[[!redirects weak function type]]
[[!redirects weak function types]]

[[!redirects Russell function type]]
[[!redirects Russell function types]]

[[!redirects strict Russell function type]]
[[!redirects strict Russell function types]]

[[!redirects weak Russell function type]]
[[!redirects weak Russell function types]]

[[!redirects function type a la Russell]]
[[!redirects function types a la Russell]]

[[!redirects strict function type a la Russell]]
[[!redirects strict function types a la Russell]]

[[!redirects weak function type a la Russell]]
[[!redirects weak function types a la Russell]]

[[!redirects Tarski function type]]
[[!redirects Tarski function types]]

[[!redirects strict Tarski function type]]
[[!redirects strict Tarski function types]]

[[!redirects weak Tarski function type]]
[[!redirects weak Tarski function types]]

[[!redirects function type a la Tarski]]
[[!redirects function types a la Tarski]]

[[!redirects strict function type a la Tarski]]
[[!redirects strict function types a la Tarski]]

[[!redirects weak function type a la Tarski]]
[[!redirects weak function types a la Tarski]]


function type natural deduction - table

| | [[type theory]] | [[category theory]] |
|--|--|--|
|  | [[syntax]] | [[semantics]] |
|  |  [[natural deduction]] |  [[universal construction]] |
|  | **[[function type]]** | **[[internal hom]]** |
| [[type formation]] | $\frac{\vdash\: X \colon Type \;\;\;\;\; \vdash\; A\colon Type}{\vdash \; \left(X \to A\right) \colon Type}$ |  |
| [[term introduction]] | $\frac{x \colon X \;\vdash\; a(x) \colon A}{\vdash (x \mapsto a\left(x\right)) \colon \left(X \to A\right) }$ |  |
| [[term elimination]] | $\frac{\vdash\; f \colon \left(X \to A\right)\;\;\;\; \vdash \; x \colon X}{\;\;\;\vdash\; f(x) \colon A}$ |   |
| [[computation rule]] | $(y \mapsto a(y))(x) = a(x)$ |   |


functional

# Functionals
* table of contents
{: toc}

## Disambiguation

This is about functionals in the sense of [[higher-order logic]], which is the original sense and which has only that name.  For functionals in the sense of [[functional analysis]], see _[[linear functional]]_; for the relation between these, see under Examples below.  For functionals on [[infinite-dimensional manifolds]], see at _[[nonlinear functional]]_.

## Definition

In a [[type theory]] with [[function types]], given a [[type]] $X$, a __functional__ of base type $X$ is a [[term]] of type $X^{X^X}$ aka $(X \to X) \to X$.  This should be distinguished from (on the one hand) an [[operator]], which is a term of type $(X^X)^{X^X}$ aka $(X \to X) \to (X \to X)$, and (on the other hand) a [[endofunction|function]], which (in this context) is a term of type $X^X$ aka $X \to X$.

More generally, any term whose type has the form $A^{B^C}$ aka $(C \to B) \to A$ may be called a functional, although usually not if any of these types is very trivial (since any type has this form, up to equivalence, if $B,C \coloneqq 1$).

Although one typically interprets type theory within [[set theory]] so that operations between types become [[functions]], one may also use [[partial functions]], which is necessary for many of the examples below.

A functional could also be interpreted within [[category theory]] as a [[simplex|simplicial]] [[2-morphism]] in the [[2-category|2-]][[category of sets]].

## Examples

In [[variational calculus]] one studies functions on spaces of [[sections]] of [[jet bundles]] or other [[mapping spaces]].  The notion of [[nonlinear functional]] is an abstraction of this.  For example, such functionals appear in [[physics]] as [[action functionals]].  See [[covariant phase space]] and [[path integral]] for other functionals in physics.

If we interpret $X$ as the [[real line]], then $X^X$ consists of real-valued maps of a real variable, which form a [[vector space]].  The [[linear maps]] from $X^X$ to $X$ are the original [[linear functionals]].  In [[functional analysis]], we now replace $X^X$ with an arbitrary [[topological vector space]] $V$ (originally but no longer necessarily taken to be a [[vector subspace|subspace]] of $X^X$) and consider linear maps from $V$ to $X$ instead; so these linear functionals are actually unstructured operations in a type-theoretic sense.

[[!redirects functional]]
[[!redirects functionals]]


functional analysis

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Functional analysis
+-- {: .hide}
[[!include functional analysis - contents]]
=--
=--
=--

# Contents
* table of contents
{: toc}

**Functional analysis** can be defined as the study of objects (and their [[homomorphism]]s) with an [[algebra|algebraic]] and a [[topology|topological]] structure such that the algebraic operations are continuous. But usually the algebraic structure is fixed to be the one of a [[vector space]].

## Idea

Various sets of real or complex-valued functions (usually [[continuous function|continuous]] or at least [[measurable function|measurable]]) have not only the structure of a [[vector space]] but also an additional [[topological structure]]. To study these systematically, various classes of [[topological vector spaces]] were gradually developed and studied, often irrespective of the nature of the elements. Hence one can study (for example) Banach spaces of anything, not necessarily of functions. Naturally more and more general structures were studied.

Thus __functional analysis__ is a field of [[mathematics]] studying compatible algebraic and topological structure, where 'algebraic' most often refers to linear spaces with structure (e.g. ordered vector spaces, real algebras etc.) and 'topological' may refer to mere topology but also to [[metric space|metric]] refinements like norm etc. The underlying [[ground field]] is most often [[real number|real]] or [[complex numbers]]. In addition to the study of topological vector spaces, various interesting classes or examples of operators on them are in focus of this subject.

Functional analysis gets its name from the original examples of [[topological vector space]] as [[function space]]s.

Main classical areas is the subject of topological vector spaces (important classes include [[Hilbert spaces]], [[Banach spaces]], [[Frechet space]]s, and a pretty general class of [[locally convex space|locally convex topological vector spaces]]). The [[spectral theory]], [[measure theory]], [[ergodic theory]] and [[representation theory]] of these gave rise to the study of [[operator algebras]], out of which the mainstream variety of [[noncommutative geometry]] also arose.

See also [[reflexive Banach space]], [[bounded operator]], [[compact operator]], [[Fredholm operator]], [[Sobolev space]], [[Lebesgue space]].

## References

See

* [[functional analysis bibliography]]

The [English Wikipedia entry](http://en.wikipedia.org/wiki/Functional_analysis) has a fair list of books on the subject.

In [[mathematical physics]]:

* [[Michael Reed]], [[Barry Simon]]: *[[Methods of Modern Mathematical Physics]]*, Academic Press (1978), Volume I: *Functional Analysis* $[$[ISBN:9780125850506](https://www.elsevier.com/books/i-functional-analysis/reed/978-0-08-057048-8), [pdf](http://www.astrosen.unam.mx/~aceves/Metodos/ebooks/reed_simon1.pdf)$]$

There are also variations in $p$-[[adic analysis]] and a [[topos]]-theoretic approach initiated by (I think?) [[William Lawvere]].

category: analysis


functional analysis - contents

* **[[functional analysis|Functional Analysis]]**

## Overview diagrams

* [[TVS relationships|topological vector spaces]]

* [[diagram of LCTVS properties|locally convex topological vector spaces]]

## Basic concepts

* [[topological vector space]]

  * [[locally convex topological vector space]]

  * [[Banach space|Banach Spaces]]

    * [[reflexive Banach space|reflexive]]

  * [[Smith space (functional analysis)|Smith Spaces]]

  * [[Hilbert space|Hilbert Spaces]], [[Fréchet space|Fréchet Spaces]], [[Sobolev space|Sobolev spaces]], [[Lebesgue space|Lebesgue Spaces]]

  * [[bornological vector space|Bornological Vector Spaces]]

  * [[barrelled topological vector space|Barrelled Vector Spaces]]

* [[linear operator]]

  * [[bounded linear operator|bounded]], [[unbounded linear operator|unbounded]], [[self-adjoint operator|self-adjoint]], [[compact operator|compact]], [[Fredholm operator|Fredholm]]

  * [[spectrum of an operator]]

* [[operator algebras]]

  * [[functional calculus]]

## Theorems

* [[Stone-Weierstrass theorem]]

* [[spectral theory]]

  * [[spectral theorem]]

  * [[Gelfand duality]]

* [[functional calculus]]

* [[Riesz representation theorem]]

* [[measure theory]]

## Topics in Functional Analysis

* [[basis in functional analysis|Bases]]

* [[algebraic theories in functional analysis|Algebraic Theories in Functional Analysis]]

* [[an elementary treatment of Hilbert spaces|An Elementary Treatment of Hilbert Spaces]]

* [[isomorphism classes of Banach spaces|When are two Banach spaces isomorphic?]]

[Edit this sidebar](/nlab/edit/functional+analysis+-+contents)


functional analysis bibliography

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Functional analysis
+-- {: .hide}
[[!include functional analysis - contents]]
=--
=--
=--

**A Bibliography for [[functional analysis|Functional Analysis]] Entries**

* Walter Rudin, _Functional analysis_
* A. A. Kirillov, A. D. Gvišiani, Теоремы и задачи функционального анализа (theorems and exercises in functional analysis), Moskva, Nauka 1979, 1988
* A. Ya. Helemskii, _Lectures and exercises on functional analysis_ (pretty categorical point of view!) Translations of Math. Monographs __233__ (AMS 2006)

* [[Sergiu Klainerman]], _Lecture notes in analysis_, 2011 ([pdf](https://web.math.princeton.edu/~seri/homepage/courses/Analysis2011.pdf))

* K. Yosida, _Functional analysis_
* H. H. Schaefer, _Topological vector spaces_, GTM 3, Springer.
* Gottfried Köthe, _Topological vector spaces_, (two volumes)
* Nelson Dunford, Jacob T Schwartz, _Linear operators, spectral theory, self adjoint operators in Hilbert space_ (Part 2) (1967, paperback 1988). Wiley.
* R. Kadison, _Introduction to operator algebras_
* Gerald B. Folland, _A course in abstract harmonic analysis_, Studies in Advanced Mathematics. CRC Press, Boca Raton, FL, 1995. x+276 pp. [gBooks](http://books.google.com/books?hl=en&lr=&id=0VwYZI1DypUC)
* Zbigniew Semadeni, _Banach spaces of continuous functions_, vol. I, [gBooks](http://books.google.com/books/about/Banach_spaces_of_continuous_functions.html?id=vCDvAAAAMAAJ)
* Andreas Kriegl, Peter Michor, _The convenient setting of global analysis_ (free download [here] (http://www.ams.org/publications/online-books/surv53-index))
{#KM}

* Kolmogorov, Fomin, _Elements of the theory of functions and functional analysis_
* F.Riesz and Nagy, Functional Analysis
* [[Elias Stein]], R. Shakarchi, _Functional Analysis: An Introduction to Further Topics in Analysis_, Princeton University Press 2011, ISBN 0691113874.
* Haim Brezis, _Functional analysis, Sobolev spaces and partial differential equations_,
* Georgi E. Shilov, _Elementary functional analysis_
* Eliott H. Lieb, Michael Loss, _Analysis_, Grad. Studies in Math. __14__, Amer. Math. Soc. 2001 (2nd ed.)

category: analysis


functional calculus

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Functional analysis
+--{: .hide}
[[!include functional analysis - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

What is called _functional calculus_ or _function calculus_ are operations by which for $f$ a [[function]] (on the [[complex number]]s , for instance) and $a$ a suitable [[linear operator]] (on a [[Hilbert space]], for instance) one makes sense of the expression $f(a)$ as a new operator. Usually one requires that the assignment $f \mapsto f(a)$ is an algebra [[homomorphism]], but not always, namely in some contexts as [[quantization]] the ordering effects may not respect the homomorphism property, see [[Weyl functional calculus]].

## Statements

Let $A$ be a [[C-star algebra]] (possibly non-commutative) and $a \in A$ a [[normal operator]]. With $sp(a)$ the [[operator spectrum]] of $a$ write $C(sp(a))$ for the commutative $C^\ast$-algebra of continuous complex-valued functions on $sp(a)$. Finally write $\iota : \in C(sp(A))$ for the function $\iota : x \mapsto x$.

+-- {: .num_theorem}
###### Theorem

There is a unique [[star-algebra]] [[homomorphism]]

$$
  \phi_a : C(sp(a)) \to A
$$

such that $\phi(\iota) = a$.

For all $f \in C(sp(a))$ we have that $\phi(f) \in A$ is a [[normal operator]].

=--

This appears for instance as ([KadisonRingrose, theorem 4.4.5](#KadisonRingrose)).

+-- {: .proof}
###### Proof

Let $\langle a \rangle \subset A$ be the $C^\ast$-algebra generated by $a$, or in fact any commutative $C^\ast$-subalgebra of $A$ containing $a$.

Then by [[Gelfand duality]] there is a [[compact topological space]] $X$ and an [[isomorphism]] $\psi : \langle a \rangle \stackrel{\simeq}{\to} C(X)$.

Define a morphism

$$
  (-) \circ \psi(a) :  C(sp(a)) \to C(X)
$$

by $f \mapsto f \circ \psi(a)$. This is a [[continuous map|continuous]] $\ast$-algebra homomorphism. Therefore so is the composite

$$
  \phi
   :
  C(sp(a)) \stackrel{(-)\circ \psi(a)}{\to}
  C(X)
  \stackrel{\psi^{-1}}{\to}
  \langle a\rangle
  \hookrightarrow
  A
  \,.
$$

And this satisfies $\phi(\iota) = \psi^{-1}(\iota \circ \psi(a)) = \psi^{-1}\psi (a) = a$.

This establishes the existence of $\phi$. To see uniqueness, notice that any other morphism with these properties coincides with $\phi$ on all [[polynomial]]s in $\iota$ and $\bar \iota$. By the [[Stone-Weierstrass theorem]] such polynomials form an everywhere-[[dense subset]] of $C(sp(a))$. Since moreover one can see that the two morphisms must be isometric (...) it follows that they in fact agree.

=--

## References

A standard textbook is for instance

* Richard Kadison, John Ringrose, _Fundamentals of the theory of operator algebra_ , Academic Press (1983)
 {#KadisonRingrose}

See also

* [[eom]], _[Functional calculus](http://eom.springer.de/F/f042030.htm)_

* [[Planet Math]], _[Borel functional calculus](http://planetmath.org/encyclopedia/BorelFunctionalCalculus.html)_


functional cup product

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Cohomology
+--{: .hide}
[[!include cohomology - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

For $X \overset{f}{\longrightarrow} Y$ a [[continuous function]], $u,v \in H^{2k}(Y)$ two [[cocycles]] (in [[ordinary cohomology]]) of even degree, and $a,b$ [[cochains]] on $X$ witnessing trivializations of the pullback $f^\ast u$ and of the [[cup product]] $u \cup v$, respectively, the [[cocycle]] expression

$$
  a \cup f^\ast v - f^\ast b
  \;\in\;
  H^{4k-1}(X)
$$

is called a _functional cup product_ in ([Steenrod 49](#Steenrod49)).

This appears notably as the [[homotopy Whitehead integral formula|homotopy version]] of [[Whitehead's integral formula]] ([Whitehead 47](#Whitehead47)) for the [[Hopf invariant]] (see [Haefliger 78, Remark on p. 17](#Haefliger78), [Griffith-Morgan 81, Section 14.5](#GriffithMorgan81)). More recently [Sinha-Walter 13, Example 1.9](#SinhaWalter13) speak of _homotopy period_ expressions. A transparent proof is given in [FSS 19](#FSS19), relating to the [[Hopf-Wess-Zumino term]] of the [[M5-brane]].

## Related concepts

* [[homotopy Whitehead integral formula]]

* [[intersection pairing]]

* [[Hopf-Wess-Zumino term]]

## References

* {#Whitehead47} [[J. H. C. Whitehead]], _An expression of Hopf's invariant as an integral_, Proc. Nat. Acad. Sci. USA 33 (1947), 117–123 ([jstor:87688](https://www.jstor.org/stable/87688))

* {#Steenrod49} [[Norman Steenrod]], _Cohomology Invariants of Mappings_, Annals of Mathematics Second Series, Vol. 50, No. 4 (Oct., 1949), pp. 954-988 ([jstor:1969589 ](https://www.jstor.org/stable/1969589 ))

* {#Haefliger78} [[André Haefliger]], p. 3 of _Whitehead products and differential forms_, In: P.A. Schweitzer (ed.), _Differential Topology, Foliations and Gelfand-Fuks Cohomology_, Lecture Notes in Mathematics, vol 652. Springer 1978 ([doi:10.1007/BFb0063500](https://doi.org/10.1007/BFb0063500))

* {#GriffithMorgan81} [[Phillip Griffiths]], [[John Morgan]], Section 14.5 of _Rational Homotopy Theory and Differential Forms_,  Progress in Mathematics Volume 16, Birkhauser (1981, 2013) ([doi:10.1007/978-1-4614-8468-4](https://doi.org/10.1007/978-1-4614-8468-4))

* {#SinhaWalter13} [[Dev Sinha]], [[Ben Walter]], _Lie coalgebras and rational homotopy theory II: Hopf invariants_, Trans. Amer. Math. Soc. 365 (2013), 861-883  ([arXiv:0809.5084](https://arxiv.org/abs/0809.5084), [doi:10.1090/S0002-9947-2012-05654-6](https://doi.org/10.1090/S0002-9947-2012-05654-6))

* [[Jean Dieudonné]], Section IV.4.B of: _A History of Algebraic and Differential Topology, 1900 - 1960_, Modern Birkhäuser Classics 2009 ([ISBN:978-0-8176-4907-4](https://www.springer.com/de/book/9780817649067))

* {#FSS19} [[Domenico Fiorenza]], [[Hisham Sati]], [[Urs Schreiber]], _[[schreiber:Twisted Cohomotopy implies M5 WZ term level quantization]]_, Comm. Math. Phys. 2020 ([arXiv:1906.07417](https://arxiv.org/abs/1906.07417))

[[!redirects functional cup products]]

[[!redirects homotopy period]]
[[!redirects homotopy periods]]


functional derivative

## Idea

A generalization of the concept of [[derivative]] from [[functions]] to (non-linear) [[functionals]].

## Related concepts

* [[Fréchet derivative]], [[Gâteaux derivative]]

* [[variational calculus]]

[[!redirects functional derivatives]]


functional equation

#Contents#
* table of contents
{:toc}

## Idea
 {#Idea}

Generally, a _functional equation_ is an [[equation]] between values of a [[function]] which serves to characterize that function.

Specifically one speaks of the functional equations which characterize the [[Riemann zeta function]], [[Jacobi theta functions]] and more generally [[zeta functions]], [[L-functions]]. These equations correspond, under [[Mellin transform]], to the "automorphy" of the [[theta functions]]/[[automorphic forms]] that they come from (e.g. [Gelbhart 84, starting p. 184](#Gelbhart84), see [Baez 05](#Baez05) for exposition).

The generalization of Mellin transforms from [[automorphic forms]] to [[automorphic representations]] are [[automorphic L-functions]], and there are various complementary approaches to the proof of the functional equation of an [[automorphic L-function]]:

1. The first one, fully developed by [[Roger Godement|Godement]] and Jacquet for the principal linear group, following closely the approach explained in Tate's thesis, is given by the use of Poisson summation formula. This approach extends to automorphic representations of classical groups by using Arthur's result on the [[Langlands functoriality]] of automorphic representations along an embedding $G\subset \GL_n$: the principal automorphic L-function (obtained by applying Godement-Jacquet to the transfered representation) associated to an automorphic representation of $G$ will fulfill the functional equation because of Poisson's summation formula.

1. Another one, explained in a quite general setting by Langlands, is given by evaluating at a given point the functional equation for Eisenstein series.

1. A different but very important approach was developed by Rankin-Selberg for $\mathrm{GL}_2$, and Piatetski-Shapiro and his school for more general groups, and has the advantage of allowing not only to get the functional equation, but also an important [[converse theorem]] that roughly says that an L-function is automorphic if and only if a given family of (Rankin-Selberg) L-functions
containing it fulfills the functional equation. This shows that automorphicity and the functional equation are deeply related, i.e., almost equivalent, when one formulates it precisely.

## Related concepts

* [[Poisson summation formula]]

## References

### General

(...)

Exposition includes

* {#Baez05} [[John Baez]], _[TWF 217](http://math.ucr.edu/home/baez/week217.html)_

* {#Gelbhart84} [[Stephen Gelbart]], _An elementary introduction to the Langlands program_,  Bull. Amer. Math. Soc. (N.S.) 10 (1984), no. 2, 177–219 ([web](http://www.ams.org/journals/bull/1984-10-02/S0273-0979-1984-15237-6/))

### For zeta functions and similar

* E. Kowalski, first part of _Automorphic forms, L-functions and number theory (March 12–16) Three Introductory lectures_ ([pdf](http://www.math.ethz.ch/~kowalski/lectures.pdf))

[[!redirects functional equations]]


functional morphism in a dagger 2-poset

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
###Context###
#### Higher category theory
+--{: .hide}
[[!include higher category theory - contents]]
=--
=--
=--

## Contents ##
* table of contents
{:toc}

## Idea ##

A morphism similar to how functional relations are defined in [[Rel]]

## Definition ##

A morphism $f \in hom_A(a,b)$ of a [[dagger 2-poset]] $A$ is a **functional morphism** or a **partial map** if $f \circ f^\dagger \leq 1_b$.

## See also ##

* [[onto morphism in a dagger 2-poset]]
* [[entire morphism in a dagger 2-poset]]
* [[injective morphism in a dagger 2-poset]]
* [[map in a dagger 2-poset]]


functional programming

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Constructivism, Realizability, Computability
+-- {: .hide}
[[!include constructivism - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Idea

(...)

## Functional programming languages

* [[Haskell]] (in [[type theory]])

* [[Coq]], [[Agda]] (in [[dependent type theory]])

* [[Quipper]] (for [[quantum computation]])

## Related concepts

* [[imperative programming]]

* [[object-oriented programming]]

* [[function type]]

* [[continuation-passing style]]

* [[monad (in computer science)]]

* [[programming language]]

* [[list of mathematics software]]

## References

Textbook accounts:

* [[Simon Thompson]], *Haskell: the Craft of Functional Programming*, Addison-Wesley (1996) [[webpage](https://www.haskellcraft.com/craft3e/Home.html), [pdf](https://simonjohnthompson.github.io/craft3e/craft3e.pdf)]

  > (with examples in [[Haskell]])

* Guy Cousineau, Michel Mauny, *The Functional Approach to Programming*, Cambridge University Press  (2012) [[doi:10.1017/CBO9781139173018]( https://doi.org/10.1017/CBO9781139173018)]

* {#Winitzki} [[Sergei Winitzki]], *The Science of Functional Programming -- A tutorial, with examples in Scala* [[leanpub:sofp](https://leanpub.com/sofp)]

  > (with examples in [[Scala]])

and with emphasis on the relation to [[type theory]]:

* [[Simon Thompson]], *[[Type Theory and Functional Programming]]*, Addison-Wesley (1991) [ISBN:0-201-41667-0, [webpage](http://www.cs.kent.ac.uk/people/staff/sjt/TTFP), [pdf](http://www.cs.kent.ac.uk/people/staff/sjt/TTFP/ttfp.pdf)]

Exposition of the [[categorical semantics]] of functional programming (such as via [[monads in computer science]]):

* {#Milewski19} [[Bartosz Milewski]] (compiled by Igal Tabachnik), *Category Theory for Programmers*, Blurb (2019) [[pdf](https://github.com/hmemcpy/milewski-ctfp-pdf/releases/download/v1.3.0/category-theory-for-programmers.pdf), [github](https://github.com/hmemcpy/milewski-ctfp-pdf), [webpage](https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/), [ISBN:9780464243878](https://www.blurb.com/b/9621951-category-theory-for-programmers-new-edition-hardco)]

* [[Bartosz Milewski]], *The Dao of Functional Programming* (2023) [[pdf](https://github.com/BartoszMilewski/Publications/blob/master/TheDaoOfFP/DaoFP.pdf), [github](https://github.com/BartoszMilewski/Publications/tree/master/TheDaoOfFP)]

See also:

* Wikipedia, _[Functional programming](https://en.wikipedia.org/wiki/Functional_programming)_

* {#Backus1977} John Backus, _Can programming be liberated from the von Neumann style? A functional style and its algebra of programs_, Communications of the ACM Volume 21 Number 8, 1978 ([pdf](http://www.thocp.net/biographies/papers/backus_turingaward_lecture.pdf))

* {#Cousineau1986} G. Cousineau, P.-L. Curien, M. Mauny, _The Categorical Abstract Machine_, Science of Computer Programming 8, 1987 ([pdf](https://core.ac.uk/download/pdf/82453178.pdf))

* {#Meijer1991} Erik Meijer, Maarten Fokkinga, Ross Paterson, _Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire_, 1991 ([doi:10.1.1.41.125](https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.125))

* {#Moggi1991} [[Eugenio Moggi]], _Notions of computations and monads_, 1991 ([pdf](https://person.dibris.unige.it/moggi-eugenio/ftp/ic91.pdf))

* David R. Cok, *Reasoning about functional programming in Java and C++*, ISSTA '18: Companion Proceedings for the ISSTA/ECOOP 2018 WorkshopsJuly 2018 Pages 37–39 ([doi:10.1145/3236454.3236483](https://doi.org/10.1145/3236454.3236483))

  > (building functional programming into [[imperative programming languages]])

Discussion of aspects of [[quantum computing]] in terms of [[monad (in computer science)|monads]] in functional programming are in

* [[Thorsten Altenkirch]], Alexander Green, _The quantum IO monad_, in _Semantic Techniques in Quantum Computation_, January 2009, appeared in 2010 ([pdf](http://www.cs.nott.ac.uk/~txa/publ/qio-chapter.pdf), [talk slides](http://www.cs.nott.ac.uk/~txa/talks/qnet06.pdf))

[[!redirects functional program]]
[[!redirects functional programs]]
[[!redirects functional programming language]]
[[!redirects functional programming languages]]


functional relation

+-- {: .rightHandSide}
+-- {: .toc .clickDown tabindex="0"}
### Context
#### Relations
+-- {: .hide}
[[!include relations - contents]]
=--
=--
=--

#Contents#
* table of contents
{:toc}

## Definition

A binary [[relation]] from a [[set]] $X$ to a set $Y$ is called **functional** if every element of $X$ is related to at most one element of $Y$.  Notice that this is the same thing as a [[partial function]], seen from a different point of view.  A (total) [[function]] is precisely a relation that is both functional and [[entire relation|entire]].

## Properties

Like any relation, a functional relation $r$ can be viewed as a [[span]]
$$ \array {
  &                    & \Delta_r \\
  & \swarrow_{\iota_r} &          & \searrow^{\phi_r} \\
X &                    &          &                   & Y
} $$
Such a span is a relation iff the pairing map from the **domain** $\Delta_r$ to $X \times Y$ is an [[injection]], and such a relation is functional iff the **inclusion** map $\iota_r$ is also an injection. Such a relation is entire iff the inclusion map $\iota_r$ is a [[surjection]].

(Total) functions are precisely left adjoints in the bicategory of relations, in other words relations $r: X \to Y$ in $Rel$ for which there exists $s: Y \to X$ satisfying

$$r \circ s \leq 1_Y; \qquad 1_X \leq s \circ r.$$

For if a relation $r: X \to Y$ is a function, then

1. $r r^{op} \leq 1_Y$: this just says that if $r^{op}(y, x)$ and $r(x, y')$, then $y = y'$. Equivalently, if $r(x, y)$ and $r(x, y')$ then $y = y'$: this holds precisely because $r$ is functional or well-defined.

1. $1_X \leq r^{op} r$: this says that if $x = x'$ in $X$, then there exists $y$ in $Y$ such that $r(x, y)$ and $r^{op}(y, x')$, i.e., there exists $y$ such that $r(x, y)$ and $r(x', y)$. This holds precisely because a function is an entire relation.

On the other hand, suppose $r: X \to Y$ is a left adjoint.

1. From $1_X \leq s r$ we deduce that if $x = x'$ in $X$, then there exists $y$ in $Y$ such that $r(x, y)$ and $s(y, x')$; in particular $r$ is entire.

1. Suppose $r(x, y)$. From $x = x$ there exists $y'$ such that $r(x, y')$ and $s(y', x)$. Thus $s(y', x)$ and $r(x, y)$; from $s r \leq 1_Y$ we infer $y' = y$. We conclude at most one $y$ satisfies $r(x, y)$, making $r$ functional.

Since $r$ is a function, it has a right adjoint $r$, and by uniqueness of right adjoints, we may conclude $s = r^{op}$. The [[monad]] $t = r^{op} r$ has a unit $1_X \leq t$ ($t$ is reflexive) and a multiplication $t t \leq t$ ($t$ is transitive), and also $t^{op} = (r^{op} r)^{op} = r^{op} r^{op\; op} = r^{op} r = t$ ($t$ is symmetric). So the monad $t$ is an [[equivalence relation]]. The above reasoning may be internalized to apply to the [[bicategory of relations]] internal to a [[regular category]], in which case this equivalence relation is exactly the [[kernel pair]] of the map $r$. The [[comonad]] $c = r r^{op}$ has a counit $c \leq 1_Y$ ($c$ is coreflexive), and such coreflective relations in $Set$ correspond to subsets of $Y$. More generally, in a regular category, the subobject of $Y$ named by $c$ is the [[image]] of $r$ (the [[coequalizer]] of the kernel pair).

Further remarks: surjectivity of a function $r: X \to Y$ can be expressed as the condition $1_Y \leq r \circ r^{op}$, and injectivity as $r^{op} \circ r \leq 1_X$.

## Related pages

* [[anafunction]]

## References

* [[Peter Freyd]] and André Scedrov, *[[Categories, Allegories]]*, Mathematical Library Vol. 39, North-Holland (1990).

* [[Robin Houston]], *Fun with Rel*, blog post at Bosker Blog (June 14, 2006). ([link](https://bosker.wordpress.com/2006/06/14/fun-with-rel/))

[[!redirects functional relations]]


functor

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

#Contents#
* table of contents
{:toc}

## Idea

* A *functor* is a [[homomorphism]] of [[categories]].

* A functor between [[small categories]] is a [[homomorphism]] of the [[underlying]] [[graphs]] that respects the [[composition]] of [[edges]].

So, for $C$, $D$ two [[categories]], a functor $F \colon C \to D$ consists of

1. a component-[[function]] of the [[classes]] of [[objects]];

   $F_0 \colon Obj(C) \to Obj(D)$

* a component-[[function]] of [[sets]] of [[morphisms]]

  $F_1 \colon Mor(C) \to Mor(D)$

  or equivalently:

  for each [[pair]] $x,y \in Obj(C)$ of [[objects]], a component-[[function]]

  \[
    \label{ComponentFunctionOnHomSets}
    F_{x,y} \;\colon\; C(x,y) \xrightarrow{\;\;} D(F(x), F(y))
  \]

  between [[hom-sets]];

such that:

* it respects [[source]] and [[target]] of [[morphisms]]: $F_1$ coincides with $F_0$ on source and target objects;

* it respects [[identity morphisms]]: $F(id_X) = id_{F(X)}$;

* it respects [[composition]]: the image of the composite of two morphisms under $F$ is the composite of their images.

These last two properties are the decisive ones of a functor; they are called the **functoriality conditions**.  These are a direct generalization of the notion of [[homomorphism]] (of [[monoids]], [[groups]], [[algebras]], etc.) to the case that there are more objects. As a slogan:

The notion of functor is a [[horizontal categorification]] of that of [[homomorphism]].

## Definition

### External definition

A **functor** $F$ from a [[category]] $C$ to a category $D$ is a map sending each [[object]] $x \in C$ to an object $F(x) \in D$ and each [[morphism]] $f : x \to y$ in $C$ to morphism $F(f) : F(x) \to F(y)$ in $D$, such that

* $F$ preserves [[composition]]: $F(g\circ f) = F(g)\circ F(f)$ whenever the left-hand side is well-defined,

* $F$ preserves [[identity morphisms]]: for each object $x \in C$, $F(1_x) = 1_{F(x)}$.

Or equivalently, since compositions $g f = g\circ f$ (commuting triangles) and identities $1_x$ (commuting loops) are both simple commuting diagrams, we can combine the above conditions to the single statement

* $F$ preserves [[commuting diagrams]].

Given [[morphisms]] $f \colon X\to Y$, $g \colon Y\to Z$, and $h \colon X\to Z$, declaring the triangle commutes amounts to declaring
$$h = g\circ f.$$
In this case, for $F:C\to D$ to preserve the commutative triangle means
$$F(h) = F(g)\circ F(f)$$
as depicted below

Preserving commuting triangles means $F$ preserves compositions.

Given morphisms $f:X\to Y$, $g:Y\to Z$, and $h:Z\to X$, declaring the loop commutes amounts to declaring
$$1_X = h\circ g\circ f.$$
In this case, for $F:C\to D$ to preserve the commutative loop means
$$F(1_X) = F(h)\circ F(g)\circ F(f)$$
as depicted below

However, it means more than that. Since any commutative loop is equal to the identity morphism, we must also have
$$1_{F(X)} = F(h)\circ F(g)\circ F(f)$$
implying
$$F(1_X) = 1_{F(X)}.$$

Preserving commuting loops means $F$ preserves identity morphisms.

Another equivalent way to say this is that a functor $F : C \to D$ is precisely a morphism of [[simplicial sets]] $N(F) : N(C) \to N(D)$ between the [[nerves]] of these categories

* the [[objects]] of $C$ and $D$ are the 0-cells of $N(C)$ and $N(D)$, so $N(F)_0 : N(F)_0 \to N(F)_0$ maps objects of $C$ to objects of $D$;

* the [[morphisms]] of $C$ and $D$ are the 1-cells of $N(C)$ and $N(D)$, so $N(F)_1 : N(F)_1 \to N(F)_1$ maps morphisms of $C$ to objects of $D$;

* the identity morphisms of $C$ and $D$ are the degenerate 1-cells of $N(C)$ and $N(D)$, so the fact that $N(F)$ respects degeneracy maps means that $F$ respects identities;

* the commuting triangles of $C$ and $D$ are the 2-cells of $N(C)$ and $N(D)$, so the fact that $N(F)$ maps 2-cells to 2-cells means that it respects commuting triangles, hence that it respects composition.

See [[nerve]] for more details on this.

The functors between two categories $C$ and $D$ form themselves a category, the [[functor category]] $[C,D]$, whose morphisms are [[natural transformations]]. Equipped with these functor categories as [[hom-objects]], we have a $2$-[[2-category|category]] [[Cat]] of categories, functors and natural transformations.  In other words, functors are [[morphisms]] in $Cat$.

### Internal definition {#InternalDefinition}

If $C$ and $D$ are [[internal categories]] in some ambient category $A$, then an __internal functor__ $F : C \to D$ is

* a morphism of objects $F_0 : C_0 \to D_0$ in $A$;

* a morphisms of morphisms $F_1 : C_1 \to D_1$ in $A$;

* such that the following diagrams commute

  * respect for the source map:
  $
 \array{
  C_1 &\stackrel{f_1}{\to}& D_1
  \\
  \downarrow^s && \downarrow^s
  \\
  C_0
  &\stackrel{f_0}{\to}&
  D_0
 }
$;

   * respect for the target map:
  $
 \array{
  C_1 &\stackrel{f_1}{\to}& D_1
  \\
  \downarrow^t && \downarrow^t
  \\
  C_0
  &\stackrel{f_0}{\to}&
  D_0
 }
$;

   * respect for identities
  $
 \array{
   C_0 &\stackrel{f_0}{\to}&
   D_0
   \\
   \downarrow^i && \downarrow^i
   \\
   C_1 &\stackrel{f_1}{\to}& D_1
 }
$;

   * respect for composition
  $
  \array{
    C_1 \times_{t,s}
   C_1 &\stackrel{f_1\times_{t,s} f_1}{\to}&
   D_1 \times_{t,s} D_1
  \\
   \downarrow^{\circ} && \downarrow^{\circ}
  \\
  C_1 &\stackrel{f_1}{\to}& D_1
  }
$.

This reproduces the external definition of functors above for [[small categories]], which are categories [[internalization|internal to]] [[Set]]

In many cases, this notion is too restrictive, and we should use internal [[anafunctors]] instead.

### Enriched definition

In [[enriched category theory]] a functor maps not [[hom-sets]] but the given [[hom-objects]] to each other, in a way that respects their composition. This is described at

* [[enriched functor]].

### Profunctors

A generalization of the notion of [[enriched functor]] is the notion of [[profunctor]].

### Higher categorical functors

In [[higher category theory]] there are corresponding higher notions of functor, such as

* [[2-functor]]

  * [[strict 2-functor]]

  * [[pseudofunctor]]

  * [[lax functor]]

* [[(∞,1)-functor]]

* See also an informal discussion about an [[experimental alternative definition of functor]].

### In homotopy type theory

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

The definition of functor in homotopy type theory is a straightforward translation of the ordinary one.  However, the notion of [[univalent category]] allows us to construct some such functors that in classical mathematics would require either the [[axiom of choice]] or the use of [[anafunctors]].

 {#Definition}

Let $A$ and $B$ be [[categories]]. Informally, a **functor** $F : A \to B$ consists of

* A function $F_0 : A_0 \to B_0$
* For each $a,b:A$, a function $F_{a,b}:hom_A(a,b) \to hom_B(F a,F b)$, generally also denoted $F$.
* For each $a:A$, we have $F(1_a)=1_{F a}$.
* For each $a,b,c: A$ and $f:hom_A(a,b)$ and $g:hom_A(b,c)$, we have

$$F(g \circ f) = F g \circ F f$$

Formally, the type of functors from $A$ to $B$ is

$$ Func(A,B) \coloneqq
\sum_{F_0:A_0\to B_0} \sum_{F:\prod_{a,b:A} hom_A(a,b) \to \hom_B(F a,F b)} \Big(\prod_{a:A} F(1_a) = 1_{F a}\Big) \times \Big( \prod_{a,b,c:A} \prod_{f:\hom_A(a,b)} \prod_{g:\hom_A(b,c)} F(g \circ f) = F g \circ F f\Big) $$

A formal definition in [[Coq]] can be found in [Ahrens-Kapulkin-Shulman 13](#AhrensKapulkinShulman13).

## Properties

These properties come from the [[HoTT book]].

By induction on [[identity]], a functor also preserves $idtoiso$ (See [[category]]).

### Composition of functors ###

For functors $F:A\to B$ and $G:B \to C$, their composite $G \circ F : A \to C$ is given by

* The composite $(G_0 \circ F_0): A_0 \to C_0$
* For each $a,b:A$, the composite
$$(G_{F a, F b} \circ F_{a,b}):hom_A(a,b)\to hom_C(G F a, G F b)$$

### Lemma 9.2.9 in HoTT book###
Composition of functors is associative $H(G F)=(H G)F$.

**Proof:** Since composition of functions is associative, this follows immediately for the actions on objects and on homs. And since hom-sets are sets, the rest of the data is automatic. $\square$

### Lemma 9.2.10 in HoTT book###
Lemma 9.2.9 is coherent, i.e. the following pentagon of equalities commutes:

$$
   \array{
     && (K H)(G F)
     \\
     & \nearrow
     &&
     \searrow
     \\
     ((K H) G) F
     && &&
     K (H (G F))
     \\
     \downarrow
     && &&
     \uparrow
     \\
     (K(H G)) F
     && \longrightarrow &&
     K( (H G) F)
   }
$$

## Types of functors

Specific types of functors are important in applications. See for instance

* [[essentially surjective functor]]

* [[full functor]]

* [[faithful functor]]

* [[full and faithful functor]]

And for more background on this see [[stuff, structure, property]].

##Examples

### Morphisms of monoids and groups

For $A,B$ [[monoids]] or $G, H$ [[groups]], let $\mathbf{B}A, \mathbf{B}B$, $\mathbf{B}G$, $\mathbf{B}H$ be the corresponding one-object [[category|categories]] (as described at [[delooping]]). Then functors

$$
  \mathbf{B}A \to \mathbf{B}B
$$

are canonically in bijection with monoid homomorphisms $A \to B$ and accordingly functors

$$
  \mathbf{B}G \to \mathbf{B}H
$$

are canonically in bijection with group homomorphisms $G \to H$.

### Representations

With $\mathbf{B}G$ as above, functors on $\mathbf{B}G$ with values in [[Vect]] are the same as linear [[representations]] of the [[group]] $G$. In fact, we have a canonical isomorphism of categories

$$
  Funct(\mathbf{B}G, Vect) \simeq Rep(G)
$$

of the [[functor category]] with the representation category.

### Linear Maps

Let $\mathbf{B} End(U)$ and $\mathbf{B} End(V)$ be one-object categories whose objects are each finite-dimensional vector space and whose morphisms are all of the linear [[endomorphisms]] on that space, i.e. one-object [[full subcategory|full subcategories]] of $Fin Vect$.

#### Left Inverses

If the linear map $F:U\to V$ has a left inverse, i.e.

$$F^*\circ F = 1_U,$$

where $F^*$ is the [[preimage]], then we can construct a functor

$$F_*:\mathbf{B} End(U)\to\mathbf{B} End(V)$$

by defining its action on objects by

$$F_*(U) = F_* U$$

where $F_*$ on the right-hand side is the [[image]] and its action on endomorphisms by

$$F_*(f) = F f F^*.$$

Composition follows immediately

$$F_*(f g) = F f g F^* = F f F^* F g F^* = F_*(f) F_*(g).$$

Identity morphisms are preserved since for any vector $y$ in $F_*U\subset V$, then

$$y = F x$$

for some vector $x$ in $U$ and we have

$$F_*(1_U)y = F\circ F^* y = F\circ F^*\circ F x = F x = y$$

so that

$$F_*(1_U) = 1_{F_*(U)}$$

as required. Hence, $F_*$ is a functor.

#### Right Inverses

If the linear map $F:U\to V$ has a right inverse, i.e.

$$F\circ F^* = 1_V,$$

where $F^*$ is the preimage, then we can construct a functor

$$F^*:\mathbf{B} End(V)\to\mathbf{B} End(U)$$

by defining its action on objects by

$$F^*(V) = F^*V$$

where $F^*$ on the right-hand side is preimage, and its action on endomorphisms by

$$F^*(f) = F^* f F.$$

Composition follows immediately

$$F^*(f g) = F^* f g F = F^* f F F^* g F = F^*(f) F^*(g).$$

Identity morphisms are preserved since for any vector $x$ in $F^*V\subset U$, then

$$x = F^*y$$

for some vector $y$ in $V$ and we have

$$F^*(1_V)x = F^*\circ F x = F^*\circ F \circ F^* y = F^* y = x$$

so that

$$F^*(1_V) = 1_{F^*(V)}$$

as required. Hence, $F^*$ is a functor.

### Presheaves

Functors $F : C \to Set$ with values in [[Set]] are also called [[presheaf|presheaves]]. As such one calls them presheaves on the [[opposite category]] $C^{op}$ of $C$. See [[presheaf]] for more on this.

### Functors and generalized elements {#OnGeneralizedElements}

For $C$ a [[category]], and $X \in C$ an [[object]], and $U$ any other object, a [[morphism]] $x : U \to X$ may be regarded as a [[generalized element]] of $X$, written $x \in X$ (For this language applied to the category [[Set]] of sets see [[ETCS]]. For the general case see [[type theory]]).

The _[[set]]_ of generalized elements of an object $X \in C$ is thus the union of [[hom-sets]] $\coprod_{U \in C} Hom_C(U,X)$.

While a [[morphism]] $f : X \to Y$ in an  arbitrary category $C$ need not at all come to us as a function of sets, it always induces a function of sets of _generalized elements_ : it sends the generalized element $x : U \to X$ of $X$ to the generalized element

$$
  f(x) : U \stackrel{x}{\to} X \stackrel{f}{\to} Y
$$

of $Y$, using the composition of the morphism $f$ with the morphism $x$ in $C$.

In terms of this notation, the functoriality condition on a functor $F : C \to D$, which is

$$
  F(U \stackrel{x}{\to} X \stackrel{f}{\to} Y)
  =
  F(U) \stackrel{F(x)}{\to} F(X) \stackrel{F(f)}{\to} F(Y)
$$

appears as

$$
  F(f(x)) = F(f)(F(x))
  \,.
$$

This can be illustrated in the following diagram

which provides an alternative expression of the functoriality condition as simply a statement that commuting diagrams in $C$ map to commuting diagrams in $D$.

## Related concepts

* [[endofunctor]]

* [[bifunctor]]

* [[profunctor]]

* [[multifunctor]]

* [[function]]

* **functor**

  * [[endofunctor]]

  * [[polynomial functor]]

* [[2-functor]] / [[pseudofunctor]]

  * [[monoidal functor]]

* [[n-functor]]

* [[(∞,1)-functor]]

* [[(∞,n)-functor]]

[[!include properties of functors -- contents]]

## References

Textbook accounts:

* [[Saunders MacLane]], §I.3 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)]

* [[Francis Borceux]], Section 1.2 in: *[[Handbook of Categorical Algebra]]* Vol. 1: *Basic Category Theory* [[doi:10.1017/CBO9780511525858](https://doi.org/10.1017/CBO9780511525858)]

See also the references at:

* [[category theory#references|category theory - references]].

* [[André Joyal]]'s CatLab: _[[joyalscatlab:Functors]]_

For functors in homotopy type theory

* {#AhrensKapulkinShulman13} [[nLab:Benedikt Ahrens]], [[nLab:Chris Kapulkin]], [[nLab:Michael Shulman]], section 4 of _Univalent categories and the Rezk completion_, Mathematical Structures in Computer Science 25.5 (2015): 1010-1039 ([arXiv:1303.0584](http://arxiv.org/abs/1303.0584))

* {#HoTTBook} [[nLab:UF-IAS-2012|Univalent Foundations Project]], section 9.2 of _[[HoTT Book|Homotopy Type Theory – Univalent Foundations of Mathematics]]_, IAS 2013

[[Coq]] code formalizing the concept of functors includes the following:

* _[functors_transformations.v](https://github.com/benediktahrens/rezk_completion/blob/master/functors_transformations.v)_

Formalization in [[cubicalAgda]]:

* [[1lab]], *[Functors](https://1lab.dev/Cat.Functor.Base.html#functors)*

[[!redirects functors]]
[[!redirects covariant functor]]
[[!redirects covariant functors]]

[[!redirects internal functor]]
[[!redirects internal functors]]

[[!redirects functorial]]


functor 2-category

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

#Contents#
* table of contents
{:toc}

## Idea

The analog of _[[functor category]]_ as [[categories]] are generalized to ([[strict 2-category|strict]] or [[bicategory|weak]]) _[[2-categories]]_.  There are various versions of this depending on how strict the functors and the transformations between them are.  In general, for $\mathcal{C}$ and $\mathcal{D}$ two [[2-categories]], their _functor 2-category_ is the 2-category whose

1. [[objects]] are strict, pseudo, lax, or colax [[2-functors]] from $\mathcal{C}$ to $\mathcal{D}$,

1. [[1-morphisms]] are [[strict 2-natural transformation|strict]], [[pseudonatural transformation|pseudo]], [[lax natural transformation|lax]], or colax natural transformations of 2-functors;

1. [[2-morphisms]] are [[modifications]] between these.

Such functor 2-categories are the [[hom-objects]] in various versions of the [[3-category]] [[2Cat]].

## Related concepts

* [[functor category]]

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

[[!redirects functor 2-categories]]

[[!redirects 2-functor 2-category]]
[[!redirects 2-functor 2-categories]]

[[!redirects bifunctor bicategory]]
[[!redirects bifunctor bicategories]]