Type theory MOC

𝚷-types

𝚷-types, also known as dependent function types or dependent products, are motivated in several ways:

  1. 𝚷-types internalize hypothetical judgements.
  2. 𝚷-types generalize binary products ( ×) to a product of a family of types indexed by another type.
  3. 𝚷-types generalize functions ( ) so that the codomain can depend on the input.
  4. 𝚷-types correspond to spaces of sections.
  5. 𝚷-types correspond to universal quantification () over elements of some type.

The core idea is that given a type family (fibration) Γ,𝑥 :𝐴 𝐵(𝑥), a term

Γ𝑓:𝑥:𝐴𝐵(𝑥)

corresponds to a section

Γ,𝑥:𝐴𝑓(𝑥):𝐵(𝑥)

and vice versa.

Standard presentation

Here we give a formal presentation of 𝚷-types in the cartesian calculus of substitutions, following Principles of dependent type theory. #m/def/type The formation, introduction, and elimination rules are given by1

Γ.𝐴𝐵Γ𝚷Γ(𝐴,𝐵)(Π)Γ.𝐴𝑏:𝐵Γ𝜆Γ,𝐴,𝐵(𝑏):𝚷(𝐴,𝐵)(ΠI) Γ𝑎:𝐴Γ𝑓:𝚷(𝐴,𝐵)Γ𝐚𝐩𝐩Γ,𝐴,𝐵(𝑓,𝑎):𝐵[𝐢𝐝.𝑎](ΠE)

while we also have the substitution naturality rules2

Δ𝛾:ΓΓ.𝐴𝐵Δ𝚷(𝐴,𝐵)[𝛾]=𝚷(𝐴[𝛾].𝐵[𝛾.𝐴])(Π-N) Δ𝛾:ΓΓ.𝐴𝑏:𝐵Δ𝜆(𝑏)[𝛾]=𝜆(𝑏[𝛾.𝐴]):𝚷(𝐴,𝐵)[𝛾](ΠI-N) Δ𝛾:ΓΓ𝑎:𝐴Γ𝑓:𝚷(𝐴,𝐵)Δ𝐚𝐩𝐩(𝑓,𝑎)[𝛾]=𝐚𝐩𝐩(𝑓[𝛾],𝑎[𝛾]):𝐵[𝛾.𝑎[𝛾]](ΠE-N)

and judgemental equality rules for 𝛽-computation and 𝜂-unicity

Γ𝑎:𝐴Γ.𝐴𝑏:𝐵Γ𝐚𝐩𝐩(𝜆(𝑏),𝑎)=𝑏[𝐢𝐝.𝑎]:𝐵[𝐢𝐝.𝑎](Π𝛽) Γ𝑓:𝚷(𝐴,𝐵)Γ𝑓=𝜆(𝐚𝐩𝐩(𝑓[𝐩],𝐪)):𝚷(𝐴,𝐵)(Π𝜂)
Meta-well-typed

To show that ΠE-N is meta-well-typed, we show that both terms have the claimed type. First note,

Δ𝛾:ΓΓ𝑎:𝐴Γ𝑓:𝚷(𝐴,𝐵)Γ𝐚𝐩𝐩(𝑓,𝑎):𝐵[𝐢𝐝.𝑎](ΠE)Δ𝐚𝐩𝐩(𝑓,𝑎)[𝛾]:𝐵[𝐢𝐝.𝑎𝛾]

and by ^P2, 𝐢𝐝.𝑎 𝛾 =𝛾.𝑎[𝛾]. On the other hand,

Δ𝛾:ΓΓ𝑎:𝐴Δ𝑎[𝛾]:𝐴[𝛾]Δ𝛾:ΓΓ𝑓:𝚷(𝐴,𝐵)Δ𝑓[𝛾]:𝚷(𝐴,𝐵)[𝛾]Δ𝑓[𝛾]:𝚷(𝐴[𝛾],𝐵[𝛾.𝐴])Δ𝐚𝐩𝐩(𝑓[𝛾],𝑎[𝛾]):𝐵[𝛾.𝐴𝐢𝐝.𝑎[𝛾]](ΠE)

Now ^P2 gives 𝐢𝐝.𝑎 𝛾 =𝛾.𝑎[𝛾], and ^P1 gives 𝛾.𝐴 𝐢𝐝.𝑎[𝛾] =𝛾.𝑎[𝛾], so the types agree.

To see that Π𝜂 is meta-well-typed, note

Γ𝐴Γ.𝐴𝐪:𝐴[𝐩](V)Γ𝐴Γ.𝐴𝐩:Γ(W)Γ𝑓:𝚷(𝐴,𝐵)Γ.𝐴𝑓[𝐩]:𝚷(𝐴,𝐵)[𝐩]Γ.𝐴𝑓[𝐩]:𝚷(𝐴[𝐩],𝐵[𝐩.𝐴])(=Π-N)Γ.𝐴𝐚𝐩𝐩(𝑓[𝐩],𝐪):𝐵[𝐩.𝐴𝐢𝐝.𝐪](ΠE)Γ.𝐴𝐚𝐩𝐩(𝑓[𝐩],𝐪):𝐵(=*)Γ𝜆(𝐚𝐩𝐩(𝑓[𝐩],𝐪)):Π(𝐴,𝐵)(ΠI)

where =* is conversion along the equality

𝐩.𝐴𝐢𝐝.𝐪=(𝐩𝐢𝐝).𝐪[𝐢𝐝]=𝐢𝐝

which follows from ^P1 and 𝜂𝐩𝐪.

Internalizing judgemental structure

In terms of Internalizing judgemental structure, we can formalize the correspondence described in the core idea with an operation

𝚷Γ:⎜ ⎜𝐴Ty(Γ)Ty(Γ.𝐴)⎟ ⎟Ty(Γ)

natural in Γ with a family of bijections

𝜄Γ,𝐴,𝐵:Tm(Γ,𝚷Γ(𝐴,𝐵))Tm(Γ.𝐴,𝐵)

also natural in Γ. Translation directly into inference rules gives us almost exactly those given above, except that ΠE would look more like

Γ𝑓:𝚷(𝐴,𝐵)Γ.𝐴𝜆1Γ,𝐴,𝐵(𝑓):𝐵(ΠE)

with the naturality rule

Δ𝛾:ΓΓ𝑓:𝚷(𝐴,𝐵)Δ.𝐴[𝛾]𝜆1(𝑓)[𝛾.𝐴]=𝜆1(𝑓[𝛾]):𝐵[𝛾.𝐴](ΠE-N)

and the judgemental equality rules

Γ.𝐴𝑏:𝐵Γ.𝐴𝜆1(𝜆(𝑏))=𝑏:𝐵(Π𝛽) Γ𝑓:𝚷(𝐴,𝐵)Γ𝑓=𝜆(𝜆1(𝑓)):𝚷(𝐴,𝐵)(Π𝜂)

These are however more awkward to use since they restrict the shape of contexts. The rules presented above are derivable from these by defining 𝐚𝐩𝐩Γ,𝐴,𝐵(𝑓,𝑎) :=𝜆1Γ,𝐴,𝐵(𝑓)[𝐢𝐝.𝑎]:

Proof

The derivation

Γ𝑎:𝐴Γ𝐢𝐝.𝑎:Γ.𝐴Γ𝑓:𝚷(𝐴,𝐵)Γ.𝐴𝜆1(𝑓):𝐵(ΠE)Γ𝜆1(𝑓)[𝐢𝐝.𝑎]:𝐵[𝐢𝐝.𝑎]Γ𝐚𝐩𝐩(𝑓,𝑎):𝐵[𝐢𝐝.𝑎](=)

gives ΠE.

Noting that 𝛾.𝐴 𝐢𝐝.𝑎[𝛾] =𝛾.𝑎[𝛾] =𝐢𝐝.𝑎 𝛾 by ^P1 and ^P2, the derivation

Γ𝑎:𝐴Δ𝛾:ΓΔ𝑎[𝛾]:𝐴[𝛾]Δ𝐢𝐝.𝑎[𝛾]:Δ.𝐴[𝛾]Δ𝛾:ΓΓ𝑓:𝚷(𝐴,𝐵)Δ.𝐴[𝛾]𝜆1(𝑓)[𝛾.𝐴]=𝜆1(𝑓[𝛾]):𝐵[𝛾.𝐴](ΠE-N)Δ𝜆1(𝑓)[𝛾.𝐴𝐢𝐝.𝑎[𝛾]]=𝜆1(𝑓[𝛾])[𝐢𝐝.𝑎[𝛾]]:𝐵[𝛾.𝐴𝐢𝐝.𝑎[𝛾]]Δ𝜆1(𝑓)[𝐢𝐝.𝑎𝛾]=𝜆1(𝑓[𝛾])[𝐢𝐝.𝑎[𝛾]]:𝐵[𝛾.𝑎[𝛾]](=)Δ𝐚𝐩𝐩(𝑓,𝑎)[𝛾]=𝐚𝐩𝐩(𝑓[𝛾],𝑎[𝛾]):𝐵[𝛾.𝑎[𝛾]](=)

gives ΠE-N.

The derivation

Γ𝑎:𝐴Γ𝐢𝐝.𝑎:Γ.𝐴Γ.𝐴𝑏:𝐵Γ.𝐴𝜆1(𝜆(𝑏))=𝑏:𝐵(Π𝛽)Γ𝜆1(𝜆(𝑏))[𝐢𝐝.𝑎]=𝑏[𝐢𝐝.𝑎]Γ𝐚𝐩𝐩(𝜆(𝑏),𝑎)=𝑏[𝐢𝐝.𝑎]:𝐵[𝐢𝐝.𝑎](=)

gives Π𝜂.

Noting 𝐢𝐝 =𝐩.𝐪 =𝐩.𝐴 𝐢𝐝.𝐪 by ^P1, the derivation

Γ𝑓:𝚷(𝐴,𝐵)Γ𝑓=𝜆(𝜆1(𝑓)):𝚷(𝐴,𝐵)(Π𝜂)Γ𝑓=𝜆(𝜆1(𝑓))[𝐩.𝐴𝐢𝐝.𝐪]:𝚷(𝐴,𝐵)(=)Γ𝑓=𝜆(𝜆1(𝑓[𝐩])[𝐢𝐝.𝐪]):𝚷(𝐴,𝐵)Γ𝑓=𝜆(𝐚𝐩𝐩(𝑓[𝐩],𝐪)):𝚷(𝐴,𝐵)(=)

gives Π𝜂.


#state/tidy | #lang/en | #SemBr

Footnotes

  1. For brevity and laziness, the premisses of the 𝚷 formation rule will be considered presuppositions.

  2. Where we invoke Substitution extension by a type.