Semantics of type theory

From HandWiki

The semantics of type theory involves several closely related types of models, which are constructed and studied in order to justify axioms and new type theories, and to use type theory as an internal language for categories, higher categories and other mathematical structures.

Types of models

Categories with families

Let Fam denote the category of families of sets: an object is a family (Ai)iI where each Ai is a set, and a morphism f:(Ai)iI(Bj)jJ is a function r:IJ together with, for each iI, a function ti:AiBr(i). (This category is equivalent to the arrow category Set of Set through the functor that sends a function f:AI to the family (f1(i))iI, with the natural action on morphisms.)

A category with families (CwF) consists of the following data:[1][2][3]

  • A category, whose class of objects is denoted Con and whose class of morphisms from Γ to Δ is denoted Sub(Γ,Δ). The objects are called contexts and the morphisms are called substitutions.
  • A contravariant functor from the category of contexts to Fam. The image of a context Γ is denoted (Tm(A))ATy(Γ). The elements of Ty(Γ) are called types in context Γ, and the elements of Tm(A) are called terms of type A (in context Γ). The image of a substitution σ:ΔΓ is a morphism (Tm(A))ATy(Γ)(Tm(B))BTy(Δ) in Fam. Its component Ty(Γ)Ty(Δ) is denoted by AA[σ], and for each ATy(Γ), its component Tm(A)Tm(A[σ]) is also denoted tt[σ].
  • A terminal object in the category of contexts, called the empty context and denoted . (Some authors omit this requirement.[4])
  • For each context Γ and for each type ATy(Γ), a representing object for the presheaf on the slice category Con/Γ that sends a substitution σ:ΔΓ to the set Tm(A[σ]) (with action on a morphism δ given by [δ]:Tm(A[σ])Tm(A[σδ])), along with a natural isomorphism witnessing that this object represents the presheaf. This representing object consists of a context denoted (Γ,A), called the extension of Γ by A, along with a substitution wkA:(Γ,A)Γ called weakening. The natural isomorphism sends a substitution σ:ΔΓ and a term tTm(A[σ]) to a substitution denoted (σ,t):Δ(Γ,A), called the extension of σ by t.

Fully unfolding the requirements results in the following presentation of CwFs as a generalized algebraic theory.[5] (The notation (x:A)B(x) stands for the dependent product x:AB(x), and curly braces denote arguments which are left implicit for readability.)

Con:Set(contexts)Sub:ConConSet(substitutions):{ΓΔΣ:Con}SubΔΓSubΣΔSubΣΓ(composition of substitutions)id:{Γ:Con}SubΓΓ(identity substitution):(ΓΔΣΘ:Con)(γ:SubΘΣ)(δ:SubΣΔ)(σ:SubΔΓ)(σδ)γ=σ(δγ)(associativity of composition):(ΓΔ:Con)(σ:SubΔΓ)σid=σ(right identity law):(ΓΔ:Con)(σ:SubΔΓ)idσ=σ(left identity law)Ty:ConSet(types)Tm:(Γ:Con)TyΓSet(terms)[]:{ΓΔ:Con}TyΓSubΔΓTyΔ(substitution in types)[]:{ΓΔ:Con}{A:TyΓ}TmA(σ:SubΔΓ)TmA[σ](substitution in terms):(ΓΔΣ:Con)(δ:SubΣΔ)(σ:SubΔΓ)(A:TyΓ)A[σδ]=A[σ][δ](functoriality of substitution in types):(Γ:Con)(A:TyΓ)A[id]=A(idem):(ΓΔΣ:Con)(δ:SubΣΔ)(σ:SubΔΓ)(A:TyΓ)(t:TmA)t[σδ]=t[σ][δ](functoriality of substitution in terms):(Γ:Con)(A:TyΓ)(t:TmA)t[id]=t(idem):Con(empty context)ε:(Γ:Con)SubΓ(substitution to the empty context):(Γ:Con)(σ:SubΓ)σ=εΓ(uniqueness of substitution to the empty context)(,):(Γ:Con)TyΓCon(context extension)wk:{Γ:Con}{A:TyΓ}Sub(Γ,A)Γ(weakening)(,):{ΓΔ:Con){A:TyΓ}(σ:SubΔΓ)TmA[σ]SubΔ(Γ,A)(substitution extension):(ΓΔΣCon)(σ:SubΔΓ)(δ:SubΣΔ)(A:TyΓ)(t:TmA[σ])(σ,t)δ=(σδ,t[δ])(naturality of substitution extension)hd:{ΓΔ:Con){A:TyΓ}(σ:SubΔ(Γ,A))TmA[wkσ](head term of a substitution):(ΓΔΣ:Con)(A:TyΓ)(σ:SubΔΓ)(δ:SubΣΔ)hd(σδ)=(hdσ)[δ](naturality of head):(ΓΔ:Con)(A:TyΓ)(σ:SubΔ(Γ,A))σ=(wkσ,hdσ)(head is inverse to substitution extension):(ΓΔ:Con)(A:TyΓ)(σ:SubΔΓ)(t:TmA[σ])hd(σ,t)=t(idem)

Other

Other notions of models include comprehension categories, categories with attributes and contextual categories.[4]

Interpretation of type formers

Main models

Models of type theory include the standard model (or set model),[1][3], the term model (or syntactic model, or initial model),[1][3], the setoid model,[citation needed] the groupoid model,[6] the simplicial set model,[7] and several models in cubical sets starting with the BCH (Bezem–Coquand–Huber) model.[8]

References

  1. 1.0 1.1 1.2 Hofmann, Martin (1997). "Syntax and semantics of dependent types". Extensional constructs in intensional type theory. London: Springer. doi:10.1007/978-1-4471-0963-1_2. ISBN 978-1-4471-0963-1. 
  2. Gratzer, Daniel; Angiuli, Carlo. Principles of dependent type theory. https://www.danielgratzer.com/papers/type-theory-book.pdf. Retrieved 2025-11-21. 
  3. 3.0 3.1 3.2 Gratzer, Daniel. "Denotational semantics of type theory". https://www.danielgratzer.com/papers/2023-semantics-primer-lecture-notes.pdf. 
  4. 4.0 4.1 Categorical semantics of dependent type theory in nLab
  5. Generalized algebraic theory in nLab
  6. Hofmann, Martin; Streicher, Thomas (1994). "The groupoid model refutes uniqueness of identity proofs". LICS 1994. IEEE Computer Society Press. 
  7. Kapulkin, Chris; LeFanu Lumsdaine, Peter (2012). "The simplicial model of univalent foundations (after Voevodsky)". Journal of the European Mathematical Society. doi:10.4171/JEMS/1050. 
  8. Bezem, Marc; Coquand, Thierry; Huber, Simon (2014). "A model of type theory in cubical sets". TYPES 2013. 26. Schloss Daghstuhl — Leibniz Zentrum für Informatik. ISBN 978-3-939897-72-9. https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.TYPES.2013.107.