nLab recursive function

Contents

Context

Induction

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

Contents

Idea

A recursive function is any function defined by recursion (i.e. non-dependent induction).

Recursive functions could be contrasted with inductively defined dependent functions, where one uses terms of a general dependent product type rather than a function type. Alternatively, they could be considered as a special case of an inductively defined dependent function where the target type family does not actually depend upon the source.

Similar to the case with induction, recursive functions could be generalized to higher recursive functions, where functions are recursively defined not only on the term constructors, but also the identity constructors of an higher inductive type.

Recursive functions defined on the natural numbers are particularly important for computability. For more see also at partial recursive function.

Example

Example

The negation function

¬:BoolBool \neg \colon \mathrm{Bool} \to \mathrm{Bool}

on the booleans type is recursively defined by sending \top to \bot and \bot to \top :

¬= Bool ¬= Bool \begin{array}{l} \neg \top =_{\mathrm{Bool}} \bot \\ \neg \bot =_{\mathrm{Bool}} \top \end{array}

Example

The double function

double: \mathrm{double} \colon \mathbb{N} \to \mathbb{N}

on the natural numbers type is recursively defined by sending 00 to 00 and s(n)s(n) to s(s(double(n)))s(s(\mathrm{double}(n))):

double(0)= 0 n:double(s(n))= s(s(double(n))) \begin{array}{l} \mathrm{double}(0) =_{\mathbb{N}} 0 \\ n:\mathbb{N} \vdash \mathrm{double}(s(n)) =_{\mathbb{N}} s(s(\mathrm{double}(n))) \end{array}

Example

This last example is an example of a higher recursive function. Given a type AA, elements a:Aa:A and b:Ab:A, and identity q:a= Abq:a =_A b, there is a higher recursive function f:𝕀Af:\mathbb{I} \to A from an interval type 𝕀\mathbb{I} to AA, recursively defined by

β f 0:f(0)= Aa β f 1:f(1)= Ab β f p:ap f(p)= f(0)= Af(1)trans f(0),b,f(1)(trans f(0),a,b(β f 0,q),sym f(1),b(β f 1)) \begin{array}{l} \beta_f^0:f(0) =_A a \\ \beta_f^1:f(1) =_A b \\ \beta_f^p:\mathrm{ap}_f(p) =_{f(0) =_A f(1)} \mathrm{trans}_{f(0), b, f(1)}(\mathrm{trans}_{f(0), a, b}(\beta_f^0, q), \mathrm{sym}_{f(1), b}(\beta_f^1)) \end{array}

where ap f:(0= 𝕀1)(f(0)= Af(1))\mathrm{ap}_f:(0 =_\mathbb{I} 1) \to (f(0) =_A f(1)) is the function application to identities, trans a,b,c:(a= Ab)×(b= Ac)(a= Ac)\mathrm{trans}_{a, b, c}:(a =_A b) \times (b =_A c) \to (a =_A c) is transitivity, and sym a,b:(a= Ab)(b= Aa)\mathrm{sym}_{a, b}:(a =_A b) \to (b =_A a) is symmetry of identities.

References

See also:

Last revised on January 19, 2023 at 16:11:29. See the history of this page for a list of all contributions to it.