nLab dependent product type

Redirected from "dependent function types".
Dependent product types

Context

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

Dependent product types

Idea

In dependent type theory, a dependent product type x:AB(x)\prod_{x\colon A} B(x), for a dependent type x:AB(x):Typex\colon A\vdash B(x)\colon Type is the type of “dependently typed functions” assigning to each x:Ax\colon A an element of B(x)B(x).

In a model of the type theory in categorical semantics, this is a dependent product. In set theory, it is an element of an indexed product.

It includes function types as the special case when BB is not dependent on AA, product types as a special case when AA is the type of Booleans, and dependent sequence types as a special case when AA is the natural numbers type.

Overview

The inference rules for dependent function types (aka “dependent product types” or “Π\Pi-types”):

Definition

Like any type constructor in type theory, a dependent product type is specified by rules saying when we can introduce it as a type, how to construct terms of that type, how to use or “eliminate” terms of that type, and how to compute when we combine the constructors with the eliminators.

The type formation rule for dependent product type is:

A:Typex:AB(x):Type x:AB(x):Type\frac{A\colon Type \qquad x\colon A \vdash B(x) \colon Type}{\prod_{x\colon A} B(x)\colon Type}

As a negative type

Dependent product types are almost always defined as negative types. In this presentation, primacy is given to the eliminators. The natural eliminator of a dependent product type says that we can apply it to any input:

f: x:AB(x)a:Af(a):B(a)\frac{f\colon \prod_{x\colon A} B(x) \qquad a\colon A}{f(a) \colon B(a)}

The constructor is then determined as usual for a negative type: to construct a term of x:AB(x)\prod_{x\colon A} B(x), we have to specify how it behaves when applied to any input. In other words, we should have a term of type B(x)B(x) containing a free variable x:Ax\colon A. This yields the usual “λ\lambda-abstraction” constructor:

x:Ab:B(x)λx.b: x:AB(x)\frac{x\colon A\vdash b\colon B(x)}{\lambda x.b\colon \prod_{x\colon A} B(x)}

The beta-reduction rule is the obvious one, saying that when we evaluate a λ\lambda-abstraction, we do it by substituting for the bound variable.

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

If we want an eta-conversion rule, the natural one says that every dependently typed function is a λ\lambda-abstraction:

λx.f(x) ηf \lambda x.f(x) \;\to_\eta\; f

As a positive type

It is also possible to present dependent product 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.

(x:Ab:B(x))c:Cf: x:AB(x)funsplit(c,f):C\frac{(x\colon A \vdash b\colon B(x)) \vdash c\colon C \qquad f\colon \prod_{x\colon A} B(x)}{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:Cc\colon C involves a “term of type B(x)B(x) containing a free variable x:Ax\colon A”. However, it is possible to make sense of it. In dependent type theory, we need additionally to allow CC to depend on x:AB(x)\prod_{x\colon A} B(x).

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

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

and its η\eta-conversion rule looks something like

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

Here g: x:AB(x)c:Cg\colon \prod_{x\colon A} B(x) \vdash c\colon C is a term containing a free variable of type x:AB(x)\prod_{x\colon A} B(x). By substituting λx.b\lambda x.b for gg, we obtain a term of type CC which depends on “a term b:B(x)b\colon B(x) containing a free variable x:Ax\colon A”. We then apply the positive eliminator at f: x:AB(x)f\colon \prod_{x\colon A} B(x), and the η\eta-rule says that this can be computed by just substituting ff for gg in cc.

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:

f(a) funsplit(b[a/x],f) funsplit(c,f) c[f(x)/b] \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 funsplitfunsplit only gives us a properly typed dependent eliminator if the negative dependent product type satisfies η\eta-conversion. As usual, if it satisfies propositional eta-conversion 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).

Dependent product types a la Russell and a la Tarski

In dependent type theory, there are two different ways to interpret the term f: x:AB(x)f:\prod_{x:A} B(x):

  1. ff is literally a family of terms in the family of types B(x)B(x) indexed by AA

  2. ff is a term representation for a family of terms in the family of types B(x)B(x) indexed by AA

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

Dependent product types a la Russell and a la Tarski are expressed respectively via the elimination rule of function types:

  • given type AA and the type family x:AB(x)x:A \vdash B(x) and an element f: x:AB(x)f:\prod_{x:A} B(x), one could form the family of terms x:Af(x):Bx:A \vdash f(x):B
ΓAtypeΓ,x:AB(x)typeΓf: x:AB(x)Γ,x:Af(x):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma, x:A \vdash f(x):B(x)}
  • given type AA and the type family x:AB(x)x:A \vdash B(x) one could form the family of terms f: x:AB(x),x:Aeval(f,x):B(x)f:\prod_{x:A} B(x), x:A \vdash \mathrm{eval}(f, x):B(x)
ΓAtypeΓ,x:AB(x)typeΓ,f: x:AB(x),x:Aeval(f,x):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x), x:A \vdash \mathrm{eval}(f, x):B(x)}

Dependent product types a la Tarski corresponds to the notion of dependent product in category theory where the dependent product Π(A,B)\Pi(A, B) literally comes with a morphism eval:Π(A,B)×AΣ(A,B)\mathrm{eval}:\Pi(A, B) \times A \to \Sigma(A, B) in the slice category C/AC/A, but dependent product types a la Russell are the one most commonly used in dependent type theory.

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

ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,x:A(λx:A.b(x))(x)b(x):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, x:A \vdash (\lambda x:A.b(x))(x) \equiv b(x):B(x)}
ΓAtypeΓ,x:AB(x)typeΓf: x:AB(x)Γfλx:A.f(x): x:AB(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma \vdash f \equiv \lambda x:A.f(x):\prod_{x:A} B(x)}

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

ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,x:Aeval(λx:A.b(x),x)b(x):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, x:A \vdash \mathrm{eval}(\lambda x:A.b(x), x) \equiv b(x):B(x)}
ΓAtypeΓ,x:AB(x)typeΓ,f: x:AB(x)fλx:A.eval(f,x): x:AB(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash f \equiv \lambda x:A.\mathrm{eval}(f, x):\prod_{x:A} B(x)}

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

Weak and strict dependent product types

In dependent type theory, weak dependent product types are dependent product types for which the computation rules (β\beta-conversion) and uniqueness rules (η\eta-conversion) are propositional rather than judgmental:

ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,a:Aβ AB x:A.b(x)(a):(λ(x:A).b(x))(a)= B(x)b(a)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, a:A \vdash \beta_{A \to B}^{x:A.b(x)}(a):(\lambda(x:A).b(x))(a) =_{B(x)} b(a)}
ΓAtypeΓ,x:AB(x)typeΓ,f: x:AB(x)η AB(f):f= x:AB(x)λ(x:A).f(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash \eta_{A \to B}(f):f =_{\prod_{x:A} B(x)} \lambda(x:A).f(x)}

Weak dependent product types appear in weak type theories.

This contrasts with strict dependent product types which use judgmental computation and uniqueness rules:

ΓAtypeΓ,x:AB(x)typeΓ,x:Ab(x):B(x)Γ,a:A(λ(x:A).b(x))(a)b(a):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash b(x):B(x)}{\Gamma, a:A \vdash (\lambda(x:A).b(x))(a) \equiv b(a):B(x)}
ΓAtypeΓ,x:AB(x)typeΓ,f: x:AB(x)fλ(x:A).f(x): x:AB(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:\prod_{x:A} B(x) \vdash f \equiv \lambda(x:A).f(x):\prod_{x:A} B(x)}

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

For strict dependent product 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.

In terms of function types

Given a dependent type theory with function types, dependent sum types, and identity types, the dependent product type of a type family B(x)B(x) indexed by x:Ax:A can be defined as the type of functions f:A x:AB(x)f:A \to \sum_{x:A} B(x) from AA to the dependent sum type x:AB(x)\sum_{x:A} B(x) such that the composite of ff with the first projection function π 1:( x:AB(x))A\pi_1:\left(\sum_{x:A} B(x)\right) \to A is the identity function on AA

x:AB(x) f:A x:AB(x)λx:A.π 1(f(x))= AAid A\prod_{x:A} B(x) \coloneqq \sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A

The underlying family of elements is then given by the composite of f:A x:AB(x)f:A \to \sum_{x:A} B(x) with the second projection function of the dependent sum type:

x:Aπ 2(f(x)):B(x)x:A \vdash \pi_2(f(x)):B(x)

Similarly, given a family of elements x:Ab(x):B(x)x:A \vdash b(x):B(x), one could construct the function

λx:A.(x,b(x)):A x:AB(x)\lambda x:A.(x, b(x)):A \to \sum_{x:A} B(x)

such that given x:Ax:A, π 1(λx:A.(x,b(x))(x))x\pi_1(\lambda x:A.(x, b(x))(x)) \equiv x. By lambda abstraction, one has

λx:A.π 1(λx:A.(x,b(x))(x))id A\lambda x:A.\pi_1(\lambda x:A.(x, b(x))(x)) \equiv \mathrm{id}_A

and so the dependent function is given by

(λx:A.(x,b(x)),refl AA(id A)): f:A x:AB(x)λx:A.π 1(f(x))= AAid A(\lambda x:A.(x, b(x)), \mathrm{refl}_{A \to A}(\mathrm{id}_A)):\sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A

One also has π 2(λx:A.(x,b(x))(x))b(x)\pi_2(\lambda x:A.(x, b(x))(x)) \equiv b(x) which is the associated computation rule for dependent function types. Meanwhile, from the judgmental η\eta-conversion rules for negative dependent sum types and function types, one could prove the judgmental η\eta-conversion rule for dependent function types. Given

f: f:A x:AB(x)λx:A.π 1(f(x))= AAid Af:\sum_{f:A \to \sum_{x:A} B(x)} \lambda x:A.\pi_1(f(x)) =_{A \to A} \mathrm{id}_A

one has

f(λx:A.(x,π 2(f(x))),π 2(f))f \equiv (\lambda x:A.(x, \pi_2(f(x))), \pi_2(f))

As types of dependent anafunctions

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 dependent function types as types of dependent anafunctions. This requires both identity types and indexed 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 Agda notation (x:A)B(x)(x:A) \to B(x) for dependent function types rather than the dependent product type notation x:AB(x)\prod_{x:A} B(x) or Π(x:A).B(x)\Pi(x:A).B(x) in this section.

Rules for dependent function types

ΓAtypeΓ,x:AB(x)typeΓ(x:A)B(x)typeΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x),x:A,y:B(x) A,B(f,x,y)type\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma \vdash (x:A) \to B(x) \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x) \vdash \mathcal{F}_{A, B}(f, x, y) \; \mathrm{type}}
ΓAtypeΓ,x:AB(x)typeΓ,x:Af(x):B(x)Γλx.f(x):(x:A)B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B(x)}{\Gamma \vdash \lambda x.f(x):(x:A) \to B(x)}
ΓAtypeΓ,x:AB(x)typeΓ,x:Af(x):B(x)Γ,x:Aα(x): A,B(λx.f(x),x,f(x))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma, x:A \vdash f(x):B(x)}{\Gamma, x:A \vdash \alpha(x):\mathcal{F}_{A, B}(\lambda x.f(x), x, f(x))}
ΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x),x:Aev(f,x):B(x)\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A \vdash \mathrm{ev}(f, x):B(x)}
ΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x),x:Aβ(f,x): A,B(f,x,ev(f,x))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A \vdash \beta(f, x):\mathcal{F}_{A, B}(f, x, \mathrm{ev}(f, x))}
ΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x),x:A,y:B(x),u: A,B(f,x,y)κ(f,x,y,u):ev(f,x)= B(x)y\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x), u:\mathcal{F}_{A, B}(f, x, y) \vdash \kappa(f, x, y, u):\mathrm{ev}(f, x) =_{B(x)} y}
ΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x),x:A,y:B(x),u: A,B(f,x,y)η(f,x,y,u):β(f,x)= A,B(f,x) κ(f,x,y,u)u\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x), x:A, y:B(x), 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 pair types and dependent function types, one could derive that

ΓAtypeΓ,x:AB(x)typeΓ,f:(x:A)B(x)η(f):(x:A)isContr((y:B)× A,B(f,x,y))\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type}}{\Gamma, f:(x:A) \to B(x) \vdash \eta(f):(x:A) \to \mathrm{isContr}\left((y:B) \times \mathcal{F}_{A, B}(f, x, y)\right)}

which is precisely the statement that A,B(f)\mathcal{F}_{A, B}(f) is a dependent anafunction for all dependent functions f:(x:A)B(x)f:(x:A) \to B(x).

Properties

Universal property of dependent product types

The universal property of dependent product types states that for all types AA and type families x:AB(x)x:A \vdash B(x), there is a family of functions

π A: x:A( x:AB(x))B(x)\pi_A:\prod_{x:A} \left(\prod_{x:A} B(x)\right) \to B(x)

such that for any other type CC and family of functions f: x:ACB(x)f:\prod_{x:A} C \to B(x), there is a unique function c:C x:AB(x)c:C \to \prod_{x:A} B(x) such that

x:A y:Cπ A(x)(c(y))= B(x)f(x)(y)\prod_{x:A} \prod_{y:C} \pi_A(x)(c(y)) =_{B(x)} f(x)(y)

If there is a type universe UU, then one could wrap this into a single axiom.

up A,B: C:U f: x:ACB(x)!c:C x:AB(x). x:A y:Cπ A(x)(c(y))= B(x)f(x)(y)\mathrm{up}_{A, B}:\prod_{C:U} \prod_{f:\prod_{x:A} C \to B(x)} \exists!c:C \to \prod_{x:A} B(x).\prod_{x:A} \prod_{y:C} \pi_A(x)(c(y)) =_{B(x)} f(x)(y)

Typal computation and uniqueness rules

The typal computation rule for function types is provable from the other four typal type formers of function types. Given type AA, type family x:AB(x)x:A \vdash B(x) and dependent function f: x:AB(x)f:\prod_{x:A} B(x), we have, by the elimination rule and the introduction rule, a dependent function λx:A.f(x): x:AB(x)\lambda x:A.f(x):\prod_{x:A} B(x), which by the uniqueness rules of dependent product types are equal to each other

η x:AB(x)(f):f= x:AB(x)λx:A.f(x)\eta_{\prod_{x:A} B(x)}(f):f =_{\prod_{x:A} B(x)} \lambda x:A.f(x)

By the inductively defined function idtohomotopy\mathrm{idtohomotopy} which takes identifications between dependent functions to homotopies between dependent functions, we have that

idtohomotopy(f,λx:A.f(x))(η x:AB(x)(f)): x:Af(x)= B(x)(λx:A.f(x))(x)\mathrm{idtohomotopy}(f, \lambda x:A.f(x))(\eta_{\prod_{x:A} B(x)}(f)):\prod_{x:A} f(x) =_{B(x)} (\lambda x:A.f(x))(x)

which is the typal computation rule for dependent function types.

Application in logic

In logic, dependent functions types express universal quantifications. More precisely, for x:Aϕ(x)x:A \vdash \phi(x) a predicate on a type AA, under propositions as types the universal quantification x:A.ϕ(x)\forall x:A.\phi(x) is the dependent product type x:Aϕ(x)\prod_{x:A} \phi(x) (or rather the bracket type of that if one wishes to force this to be of type PropProp again ).

Graph of a dependent function

Given a type AA and a type family x:AB(x)x:A \vdash B(x), there is a function

graph:( x:AB(x))(A x:AB(x))\mathrm{graph}:\left(\prod_{x:A} B(x)\right) \to \left(A \to \sum_{x:A} B(x)\right)

which takes a dependent function f: x:AB(x)f:\prod_{x:A} B(x) and returns the graph of a dependent function

graph(f):A x:AB(x)\mathrm{graph}(f):A \to \sum_{x:A} B(x)

defined by graph(f)(x)(x,f(x))\mathrm{graph}(f)(x) \equiv (x, f(x)) for all x:Ax:A. As a dependent anafunction the graph of the dependent function is represented by the identity type family

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

Relation to sections

A family of type x:AB(x)x:A \vdash B(x) is equivalently a type BB with a function f:BAf:B \to A. Then each B(x)B(x) is defined as the fiber of ff at element x:Ax:A. Then the dependent product of a function is defined as the dependent product type

Π A,B(f) x:A y:Bf(y)= Ax\Pi_{A, B}(f) \coloneqq \prod_{x:A} \sum_{y:B} f(y) =_A x

or equivalently, due to the type theoretic axiom of choice, as the dependent sum type

Π A,B(f) g:AB x:Af(g(x))= Ax\Pi_{A, B}(f) \coloneqq \sum_{g:A \to B} \prod_{x:A} f(g(x)) =_A x

which says that gg is a section of ff. One could eliminate the use of the dependent product type entirely by using the definition of dependent product type from function types:

Π A,B(f) g:AB h:A x:Af(g(x))= Axpr Ah= AAid A\Pi_{A, B}(f) \coloneqq \sum_{g:A \to B} \sum_{h:A \to \sum_{x:A} f(g(x)) =_A x} \mathrm{pr}_{\sum}^{A} \circ h =_{A \to A} \mathrm{id}_A

Categorical interpretation

In categorical semantics, the dependent product types are relative right adjoints to context extension in comprehension categories.

There is also another interpretation in category theory of the dependent product type over x:AB(x)typex:A \vdash B(x) \; \mathrm{type} as the terminal AA-indexed wide span under B(x)B(x), the object x:AB(x)\prod_{x:A} B(x) with a family of morphisms

π A(x):( x:AB(x))B(x)\pi_A(x):\left(\prod_{x:A} B(x)\right) \to B(x)

such that for any other object CC with a family of morphisms f(x):CB(x)f(x):C \to B(x), there exists a unique morphism u C:C x:AB(x)u_C:C \to \prod_{x:A} B(x) such that

π A(x)u C=f(x)\pi_A(x) \circ u_C = f(x)

References

The standard rules for type-formation, term introduction/elimination and computation of dependent product type are listed for instance in part I of

Another textbook account could be found in section 2.1 of:

as well as sections 1.4 and 2.9 of:

See also:

  • Richard Garner, On the strength of dependent products in the type theory of Martin-Löf, arXiv.

On the categorical semantics of dependent product types as relative right adjoints to context extension in comprehension categories:

Last revised on August 14, 2025 at 16:23:38. See the history of this page for a list of all contributions to it.