nLab function

Contents

Context

Set theory

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Category theory

Contents

Idea

A function f:STf \colon S \to T from a set SS (the domain) to a set TT (the codomain) is a prescription which takes any element sSs \in S to a unique element f(s)Tf(s) \in T. One also says that:

  • f(s)f(s) is the value of the function at ss,

  • f(s)Tf(s) \in T is a function of sSs \in S,

and the process of assigning f(s)f(s) to ss is also called function application.

For emphasis one sometimes speaks of total functions to distinguish from partial functions which need not be defined for all elements ss of their domain set SS.

Famous and historically important examples of functions map specifically between sets of numbers (such as the trigonometric functions, zeta functions, etc.). This specialization of the term goes so far that the term function theory is generally understood to refer specifically to analysis over the real or complex numbers (cf. complex analysis).

Instead of “functions” one also speaks of maps or mappings, but these terms are often understood to refer to functions which respect extra structure, hence which are homomorphisms (for instance continuous maps are functions that respect topological structure). See also further alternative terminology below.

Hence one may say that functions are homomorphisms of plain sets. Indeed, functions are the morphisms in the category Set whose objects are sets. Conversely this means that every morphism between objects in any category may be thought of as a function in a generalized sense.

This generalized use of the word is wide spread (and justified) in type theory, where for SS and TT two types, there is a function type denoted STS \to T such that the judgement f:STf \colon S \to T means that ff is a term of function type, hence is a function.

Back in categorical semantics, the function type becomes the internal hom, which in Set is the function set of all functions with given domain and codomain. From this perspective a function is an element of a function set or generally a generalized element of an internal hom-object (exponential object).

Foundations

The formal definition of a function depends on the foundations chosen.

In set theory

  • In material set theory, a function ff is often defined to be a set of ordered pairs such that for every xx, there is at most one yy such that (x,y)f(x,y)\in f. The domain of ff is then the set of all xx for which there exists some such yy. This definition is not entirely satisfactory since it does not determine the codomain (since not every element of the codomain may be in the image); thus to be completely precise it is better to define a function to be an ordered triple (f,A,B)(f,A,B) where AA is the domain and BB the codomain.

  • In structural set theory, the role of functions depends on the particular axiomatization chosen. In ETCS, functions are among the undefined things, whereas in SEAR, functions are defined to be particular relations (which in turn are undefined things).

Remark

(functions as trees)
Functions of sets may be identified with rooted trees of height 2 by treating the domain as the vertices of height 2, the codomain as the vertices of height 1, and letting every height 2 vertex have a single edge to (have its parent be) the value it is sent to by the function.

This is a special case of the equivalence between rooted trees and presheaves on \mathbb{N} (see there).

In dependent type theory

In dependent type theory, a type AA is a contractible type if it comes with an element a:Aa:A and a family of identities x:Ac(x):a= Axx:A \vdash c(x):a =_A x indicating that aa is a center of contraction. A function between types AA and BB could be defined as

  • a family of elements x:Af(x):Bx:A \vdash f(x):B
  • a span (C;z:Cg(z):A;z:Ch(z):B)(C; z:C \vdash g(z):A; z:C \vdash h(z):B) for which the dependent type z:Cg(z)= Ax\sum_{z:C} g(z) =_A x is a contractible type for all x:Ax:A
  • a multivalued partial function (x:AP(x);x:A,p:P(x)f(x,p):B)(x:A \vdash P(x); x:A, p:P(x) \vdash f(x, p):B) for which the dependent type P(x)P(x) is a contractible type for all x:Ax:A
  • a correspondence x:A,y:BR(x,y)x:A, y:B \vdash R(x, y) for which the dependent type y:BR(x,y)\sum_{y:B} R(x, y) is a contractible type for all x:Ax:A.
  • a family of types y:BA(y)y:B \vdash A'(y)
  • an element of the function type f:ABf:A \to B, in dependent type theories with function types.

The first four definitions are interdefinable with each other in dependent type theories with identity types and dependent sum types:

  • From every family of elements x:Af(x):Bx:A \vdash f(x):B, one could define a span by defining the type CC to be a copy of AA, CCopy(A)C \coloneqq \mathrm{Copy}(A), the family of elements z:Cg(z):Az:C \vdash g(z):A to be g(z)π 1(α(x))g(z) \coloneqq \pi_1(\alpha(x)) since for all elements z:Cz:C, the dependent type x:Acopy(x)= Cz\sum_{x:A} \mathrm{copy}(x) =_C z is contractible and with center of contraction z:Cα(z): x:Acopy(x)= Czz:C \vdash \alpha(z):\sum_{x:A} \mathrm{copy}(x) =_C z, and the family of elements x:Ch(x):Bx:C \vdash h(x):B to be h(x)f(g(x))h(x) \coloneqq f(g(x)). For every element x:Ax:A, the dependent type z:Cg(z)= Ax\sum_{z:C} g(z) =_A x is always a contractible type.

  • From every span (C;z:Cg(z):A;z:Ch(z):B)(C; z:C \vdash g(z):A; z:C \vdash h(z):B) for which the dependent type z:Cg(z)= Ax\sum_{z:C} g(z) =_A x is a contractible type for all x:Ax:A, one can define a family of elements x:Af(x):Bx:A \vdash f(x):B as f(x)h(π 1(α(x)))f(x) \coloneqq h(\pi_1(\alpha(x))) for all centers of contraction x:Aα(x): z:Cg(z)= Axx:A \vdash \alpha(x):\sum_{z:C} g(z) =_A x.

  • From every family of elements x:Af(x):Bx:A \vdash f(x):B, one could define a multivalued partial function by defining x:AP(x)x:A \vdash P(x) to be P(x) y:Ax= AyP(x) \coloneqq \sum_{y:A} x =_A y and x:A,p:P(x)f(x,p):Bx:A, p:P(x) \vdash f'(x, p):B to be f(x,p)f(x)f'(x, p) \coloneqq f(x). For every element x:Ax:A, the dependent type y:Ax= Ay\sum_{y:A} x =_A y is always a contractible type.

  • From every multivalued partial function (x:AP(x);x:A,p:P(x)f(x,p):B)(x:A \vdash P(x); x:A, p:P(x) \vdash f(x, p):B) for which the dependent type P(x)P(x) is a contractible type for all x:Ax:A, one could define a family of elements x:Af(x):Bx:A \vdash f'(x):B as f(x)f(x,α(x))f'(x) \coloneqq f(x, \alpha(x)) for all centers of contraction x:Aα(x):P(x)x:A \vdash \alpha(x):P(x).

  • From every family of elements x:Af(x):Bx:A \vdash f(x):B, one could define a correspondence by defining x:A,y:BR(x,y)x:A, y:B \vdash R(x, y) to be R(x,y)f(x)= ByR(x, y) \coloneqq f(x) =_B y. For every element x:Ax:A, the dependent type y:Bf(x)= By\sum_{y:B} f(x) =_B y is always a contractible type.

  • From every correspondence x:A,y:BR(x,y)x:A, y:B \vdash R(x, y) for which the dependent type y:BR(x,y)\sum_{y:B} R(x, y) is a contractible type for all x:Ax:A, one could define a family of elements x:Af(x):Bx:A \vdash f(x):B as f(x)π 1(α(x))f(x) \coloneqq \pi_1(\alpha(x)) for all centers of contraction x:Aα(x): y:BR(x,y)x:A \vdash \alpha(x):\sum_{y:B} R(x, y).

  • The second, third, and fourth definitions of a function are interdefinable via the following relations between spans, multivalued partial functions, and correspondences:

    • From every span one could get a multivalued partial function by defining the type family x:AP(x)x:A \vdash P(x) as P(x) y:Cg(y)= AxP(x) \coloneqq \sum_{y:C} g(y) =_A x and the family of elements x:A,p:P(x)f(x,p):Bx:A, p:P(x) \vdash f(x, p):B as f(x,p)h(π 1(x))f(x, p) \coloneqq h(\pi_1(x)).

    • From every multivalued partial function one could get a span by defining the type CC as C x:AP(x)C \coloneqq \sum_{x:A} P(x) and the family of elements x:Cg(x):Ax:C \vdash g(x):A as g(x)π 1(x)g(x) \coloneqq \pi_1(x).

    • From every multivalued partial function one could get a correspondence by defining the type family x:A,y:BR(x,y)x:A, y:B \vdash R(x, y) as R(x,y) p:P(x)f(x,p)= ByR(x, y) \coloneqq \sum_{p:P(x)} f(x, p) =_B y.

    • From every correspondence one could get a multivalued partial function by defining the type family x:AP(x)x:A \vdash P(x) as P(x) y:BR(x,y)P(x) \coloneqq \sum_{y:B} R(x, y), and the family of elements x:A,p:P(x)h(x,p):Bx:A, p:P(x) \vdash h(x, p):B as h(x,p)π 1(p)h(x, p) \coloneqq \pi_1(p)

    • From every span one could get a correspondence by defining the type family x:A,y:BR(x,y)x:A, y:B \vdash R(x, y) as R(x,y) z:C(g(z)= Ax)×(h(z)= By)R(x, y) \coloneqq \sum_{z:C} (g(z) =_A x) \times (h(z) =_B y).

    • From every correspondence one could get a span by defining the type CC as C x:A y:BR(x,y)C \coloneqq \sum_{x:A} \sum_{y:B} R(x, y), the family of elements z:Cg(z):Az:C \vdash g(z):A as g(z)π 1(z)g(z) \coloneqq \pi_1(z), and the function z:Ch(z):Bz:C \vdash h(z):B as h(z)π 1(π 2(z))h(z) \coloneqq \pi_1(\pi_2(z))

The first and fifth definitions are interdefinable by the following

  • From every family of elements x:Af(x):Bx:A \vdash f(x):B one could get a family of types by y:B x:Af(x)= Byy:B \vdash \sum_{x:A} f(x) =_B y where A(y) x:Af(x)= ByA'(y) \coloneqq \sum_{x:A} f(x) =_B y.

  • From every family of types y:BA(y)y:B \vdash A'(y) one could get a family of elements x: y:BA(y)π 1(x):Bx:\sum_{y:B} A'(y) \vdash \pi_1(x):B where A y:BA(y)A \coloneqq \sum_{y:B} A'(y).

If the dependent type theory has function types, then

  • From every element of the function type f:ABf:A \to B, one could define a family of elements x:Af(x):Bx:A \vdash f'(x):B as f(x)ev(f,x)f'(x) \coloneqq \mathrm{ev}(f, x), where f:AB,x:Aev(f,x):Bf:A \to B, x:A \vdash \mathrm{ev}(f, x):B appears in the elimination rules for function types.

  • From every family of elements x:Af(x):Bx:A \vdash f(x):B, one could define an element of the function type f:ABf':A \to B as fxf(x)f' \coloneqq x \mapsto f(x), where x:A,f(x):Bxf(x):ABx:A, f(x):B \vdash x \mapsto f(x):A \to B appears in the introduction rules for function types.

In formal category theory

In formal category theory, sets are discrete categories, and a function is a functor between sets. The functoriality structure becomes the property that a function preserves equality:

x=yf(x)=f(y). x = y \Rightarrow f(x) = f(y) .

For classes

One can also speak of functions between proper classes, although the precise details may vary depending on the status of classes with respect to the formal theory.

In ZFC for example, proper classes are by design not formal objects in the theory; rather they are proxied by a formula in the language (for instance, the class VV of all sets is proxied by the formula x=xx = x; intuitively we may think of VV as consisting of all xx satisfying that formula). Then functions f:ABf: A \to B between classes are again classes given by suitable formulas; see for example the MathOverflow discussion what-are-maps-between-proper-classes. If (as described above for material set theory) one wants to describe a function as an ordered triple (f,A,B)(f, A, B), then this too can be accommodated if one defines ordered triples/pairs of classes appropriately; see here for one possibility. Thus functors between categories whose objects and morphisms form proper classes can similarly be described in the language.

Such technical hacks can be avoided by choosing a different foundations. For example, Mac Lane in his Categories for the Working Mathematician assumes ZFC with a universe in which some sets are considered large, such as the set of small sets, so that a category like SetSet (the category of small sets) is again a formal object of the theory.

Alternative terminology

Useful terms, more or less synonymous with function, are assignment, assignation or more specifically assignation on objects. These do not have standard meanings but are useful to signal to readers that the domain of the ‘function’ under consideration is large, or that one is more interested in functorial extensions of this partial assignation (cf. e.g. Richard Garner, Homomorphisms of higher categories, Adv. Math. 224 (2010) 2269-2311 for many examples). In mathematical writing “assignment” is usually synonymous with function or map or “mapping”. For example one might speak of “assigning to each positive number its square root” to refer to the function (): 0\sqrt{(-)} \colon \mathbb{R}_{\geq 0} \to \mathbb{R}.

Authors may resort to verb forms such as “assigns” or “associates” or “sends” in informal writing, perhaps to avoid the bother of specifying an axiomatic framework in which a formal notion like “function” is ensconced. For example, according to Wikipedia, Jacobson defines a functor F:CDF: C \to D between categories as a “mapping” that “associates” to each object XX in CC an object F(X)F(X) in DD, etc. No clarity would be gained by making this any more formal (which as we saw in the case of functions between classes, such as classes of objects of categories, may involve annoyingly technical hacks).

Sometimes the word “assignment” is understood more generally as relation, often when authors define a function to be something that “assigns unique values” (for instance here).

Examples

Many functions that carry special names map some ring or field like the real numbers or complex numbers to itself:

Special properties these may have:

Last revised on June 23, 2024 at 16:02:16. See the history of this page for a list of all contributions to it.