nLab partial function type


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
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




In the same way that one could define equivalence types as types of one-to-one correspondences and function types as types of anafunctions, one could define partial function types as types of partial anafunctions.

Partial anafunctions are type families x:A,y:BR(x,y)typex\colon A, y \colon B \vdash R(x, y) \; \mathrm{type} which comes with a family of witnesses

x:Ap(x):isProp( y:BR(x,y))x \colon A \vdash p(x) \colon \mathrm{isProp}\left(\sum_{y:B} R(x, y) \right)

that for each element x:Ax\colon A, the dependent sum type y:BR(x,y)\sum_{y \colon B} R(x, y) is a mere proposition. From every partial anafunction, one could derive the partial function

x:A,p: y:BR(x,y)f(x,p):Bx:A, p:\sum_{y:B} R(x, y) \vdash f(x, p):B

and for every mere proposition-valued type family x:AP(x)x:A \vdash P(x) and every partial function x:A,p:P(x),f(x,p):Bx:A, p:P(x), \vdash f(x, p):B, one could define the partial anafunction 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

Defining partial function types requires both identity types and heterogeneous identity types being defined first, which we shall write as a= Aba =_A b and x= B pyx =_{B}^{p} y respectively for a:Aa:A, b:Ab:A, p:a= Abp:a =_A b, x:B(a)x:B(a), and y:B(b)y:B(b). We use the notation ABA \rightharpoonup B to represent the type of partial functions between AA and BB.

Rules for partial function types

The rules for partial function types are as follows:

ΓAtypeΓBtypeΓABtypeΓAtypeΓBtypeΓ,f:AB,x:A,y:B𝒫 A,B(f,x,y)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma \vdash A \rightharpoonup B \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \rightharpoonup B, x:A, y:B \vdash \mathcal{P}_{A, B}(f, x, y) \; \mathrm{type}}
ΓAtypeΓBtypeΓ,x:AP(x)typeΓ,x:A,p:P(x),q:P(x)τ 1(x,p,q):p= P(x)qΓ,x:A,p:P(x)f(x,p):BΓ(x,p)f(x,p):AB\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash P(x) \; \mathrm{type} \quad \Gamma, x:A, p:P(x), q:P(x) \vdash \tau_{-1}(x, p, q):p =_{P(x)} q \quad \Gamma, x:A, p:P(x) \vdash f(x, p):B}{\Gamma \vdash (x, p) \mapsto f(x, p):A \rightharpoonup B}
ΓAtypeΓBtypeΓ,x:AP(x)typeΓ,x:A,p:P(x),q:P(x)τ 1(x,p,q):p= P(x)qΓ,x:A,p:P(x)f(x,p):BΓ,x:A,p:P(x)α(x,p):𝒫 A,B((x,p)f(x,p),x,f(x,p))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash P(x) \; \mathrm{type} \quad \Gamma, x:A, p:P(x), q:P(x) \vdash \tau_{-1}(x, p, q):p =_{P(x)} q \quad \Gamma, x:A, p:P(x) \vdash f(x, p):B}{\Gamma, x:A, p:P(x) \vdash \alpha(x, p):\mathcal{P}_{A, B}((x, p) \mapsto f(x, p), x, f(x, p))}
ΓAtypeΓBtypeΓ,x:AP(x)typeΓ,x:A,p:P(x),q:P(x)τ 1(x,p,q):p= P(x)qΓ,f:AB,x:A,p:P(x)ev(f,x,p):B\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash P(x) \; \mathrm{type} \quad \Gamma, x:A, p:P(x), q:P(x) \vdash \tau_{-1}(x, p, q):p =_{P(x)} q}{\Gamma, f:A \rightharpoonup B, x:A, p:P(x) \vdash \mathrm{ev}(f, x, p):B}
ΓAtypeΓBtypeΓ,x:AP(x)typeΓ,x:A,p:P(x),q:P(x)τ 1(x,p,q):p= P(x)qΓ,f:AB,x:A,p:P(x)β(f,x,p): A,B(f,x,ev(f,x,p))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type} \quad \Gamma, x:A \vdash P(x) \; \mathrm{type} \quad \Gamma, x:A, p:P(x), q:P(x) \vdash \tau_{-1}(x, p, q):p =_{P(x)} q}{\Gamma, f:A \rightharpoonup B, x:A, p:P(x) \vdash \beta(f, x, p):\mathcal{F}_{A, B}(f, x, \mathrm{ev}(f, x, p))}
ΓAtypeΓBtypeΓ,f:AB,x:A,y:B,u:𝒫 A,B(f,x,y),z:B,v:𝒫 A,B(f,x,z)κ(f,x,y,u,z,v):y= Bz\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \rightharpoonup B, x:A, y:B, u:\mathcal{P}_{A, B}(f, x, y), z:B, v:\mathcal{P}_{A, B}(f, x, z) \vdash \kappa(f, x, y, u, z, v):y =_B z}
ΓAtypeΓBtypeΓ,f:AB,x:A,y:B,u:𝒫 A,B(f,x,y),z:B,v:𝒫 A,B(f,x,z)η(f,x,y,u,z,v):u= 𝒫 A,B(f,x) κ(f,x,y,u,z,v)v\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \rightharpoonup B, x:A, y:B, u:\mathcal{P}_{A, B}(f, x, y), z:B, v:\mathcal{P}_{A, B}(f, x, z) \vdash \eta(f, x, y, u, z, v):u =_{\mathcal{P}_{A, B}(f, x)}^{\kappa(f, x, y, u, z, v)} v}

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

ΓAtypeΓBtypeΓ,f:ABη(f): x:AisProp( y:B𝒫 A,B(f,x,y))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma \vdash B \; \mathrm{type}}{\Gamma, f:A \rightharpoonup B \vdash \eta(f):\prod_{x:A} \mathrm{isProp}\left(\sum_{y:B} \mathcal{P}_{A, B}(f, x, y) \right)}

which is precisely the statement that 𝒫 A,B(f)\mathcal{P}_{A, B}(f) is a partial anafunction for all partial functions f:ABf:A \rightharpoonup B.

See also

Last revised on January 6, 2023 at 01:33:07. See the history of this page for a list of all contributions to it.