nLab
categorical semantics

Context

Category theory

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

logiccategory theorytype theory
trueterminal object/(-2)-truncated objecth-level 0-type/unit type
falseinitial objectempty type
proposition(-1)-truncated objecth-level 1-type/h-prop
proofgeneralized elementprogram
conjunctionproductproduct type
disjunctioncoproduct ((-1)-truncation of)sum type (bracket type of)
implicationinternal homfunction type
negationinternal hom into initial objectfunction type into empty type
universal quantificationdependent productdependent product type
existential quantificationdependent sum ((-1)-truncation of)dependent sum type (bracket type of)
equivalencepath space objectidentity type
equivalence classquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
completely presented setdiscrete object/0-truncated objecth-level 2-type/preset/h-set
setinternal 0-groupoidBishop set/setoid
universeobject classifiertype of types
modalityclosure operator monadmodal type theory, monad (in computer science)

homotopy levels

semantics

Contents

Idea

One may interpret mathematical logic as being a formal language for talking about the collection of monomorphisms into a given object of a given category: the poset of subobjects of that object.

More generally, one may interpret type theory and notably dependent type theory as being a formal language for talking about slice categories, consisting of all morphisms into a given object.

Conversely, starting with a given theory of logic or a given type theory, we say that it has a categorical semantics if there is a category such that the given theory is that of its slice categories, if it is the internal logic of that category.

Definition

For the general idea, for the moment see at type theory the section An introduction for category theorists and see at relation between type theory and category theory.

Of dependent type theory

We discuss how to interpret judgements of dependent type theory in a given category 𝒞 with finite limits. For more see categorical model of dependent types.

Write cod:𝒞 I𝒞 for its codomain fibration, and write

χ:𝒞 opCat\chi : \mathcal{C}^{op} \to Cat

for the corresponding classifying functor, the self-indexing

χ:Γ𝒞 /Γ\chi : \Gamma \mapsto \mathcal{C}_{/\Gamma}

that sends an object of 𝒞 to the slice category over it, and sends a morphism f:ΓΓ to the pullback/base change functor

f *:𝒞 /Γ𝒞 /Γ.f^\ast : \mathcal{C}_{/\Gamma'} \to \mathcal{C}_{/\Gamma} \,.

We give now rules for choices ”[xyz]” that associate with every string ”xyz” of symbols in type theory objects and morphisms in 𝒞. A collection of such choices following these rules an an interpretation / a choice of categorical semantics of the type theory in the category 𝒞.

Contexts and type judgements

  1. The empty context () in type theory is interpreted as the terminal object of 𝒞

    [()]:=*.[ () ] := * \,.
  2. If Γ is a context which has already been given an interpretation [Γ]Obj(𝒞), then a judgement of the form

    ΓA:Type\Gamma \vdash A : Type

    is interpreted as an object in the slice over Γ

    [ΓA:Type]Obj(𝒞 /Γ),[\Gamma \vdash A : Type] \in Obj(\mathcal{C}_{/\Gamma}) \,,

    hence as a choice of morphism

    [(Γ,x:A)] [ΓA:Type] [Γ]\array{ [(\Gamma, x : A)] \\ \downarrow^{\mathrlap{[\Gamma \vdash A : Type]}} \\ [\Gamma] }

    in 𝒞.

  3. If a judgement of the form ΓA:Type has already found an interpretation, as above, then an extended context of the form (Γ,x:A) is interpreted as the domain object [(Γ,x:A)] of the above choice of morphism.

Terms

Assume for a context Γ and a judgement Γ:A:Type we have already chosen an interpretation [Γ,x:A][ΓA:Type][Γ] as above.

A judgement of the form Γa:A (a term of type A) is to be interpreted as a section of this morphism, equivalently as a morphism in 𝒞 /Γ

[Γ:a:A]:*[Γ,x:A][\Gamma \vdash : a : A] : * \to [\Gamma, x : A]

from the terminal object to [ΓA:Type], which in 𝒞 is a commuting triangle

[Γ] [(Γa:A)] [Γ,x:A] [Γ] [ΓA:Type] [Γ].\array{ [\Gamma] &&\stackrel{[(\Gamma \vdash a : A)]}{\to}&& [\Gamma, x : A] \\ & {}_\mathllap{[\Gamma]}\searrow && \swarrow_{\mathrlap{[\Gamma \vdash A : Type]}} \\ && [\Gamma] } \,.

Variables

For a term Γa:A the context Γ is the collection of free variables in a.

(…)

Substitution

Assume that interpretations for judgements

Γ,x:AB(x):Type\Gamma , x : A \vdash B(x) : Type

and

Γa:A\Gamma \vdash a : A

have been given as above. Then the substitution judgement

ΓB[a/x]:Type\Gamma \vdash B[a/x] : Type

is to be interpreted as follows. The interpretation of the first two terms corresponds to a diagram in 𝒞 of the form

[(Γ,x:A,y:B(x))] [Γ,x:AB(x):Type] [Γ] [Γa:A] [(Γ,x:A)] id [ΓA:Type] [Γ]\array{ &&&& [(\Gamma, x : A, y : B(x))] \\ &&&& \downarrow^{\mathrlap{[\Gamma, x : A \vdash B(x) : Type]}} \\ [\Gamma] &&\stackrel{[\Gamma \vdash a : A]}{\to}&& [(\Gamma, x : A)] \\ & {}_{id}\searrow && \swarrow_{\mathrlap{[\Gamma \vdash A : Type]}} \\ && [\Gamma] }

The interpretation of the substitution statement is then the pullback

[ΓB[a/x]:Type]:=[Γa:A] *[Γ,x:AB(x):Type],[\Gamma \vdash B[a/x] : Type] := [\Gamma \vdash a : A]^* [\Gamma, x : A \vdash B(x) : Type] \,,

hence the morphism in 𝒞 that universally completes the above diagram as

[(Γ,y:B[x/a])] [(Γ,x:A,y:B(x))] [ΓB[a/x]:Type] [Γ,x:AB(x):Type] [Γ] [Γa:A] [(Γ,x:A)] id [ΓA:Type] [Γ]\array{ [(\Gamma, y : B[x/a])] &&\to&& [(\Gamma, x : A, y : B(x))] \\ {}^{\mathllap{[\Gamma \vdash B[a/x] : Type] }}\downarrow &&&& \downarrow^{\mathrlap{[\Gamma, x : A \vdash B(x) : Type]}} \\ [\Gamma] &&\stackrel{[\Gamma \vdash a : A]}{\to}&& [(\Gamma, x : A)] \\ & {}_{id}\searrow && \swarrow_{\mathrlap{[\Gamma \vdash A : Type]}} \\ && [\Gamma] }

Of homotopy type theory

See categorical semantics of homotopy type theory.

References

A standard textbook reference for categorical semantics of logic is section D1.2 of

A discussion of categorical semantics of type theory is for instance in

  • Martin Hofmann, Syntax and semantics of dependent types, Semantics and Logics of Computation (P. Dybjer and A. M. Pitts, eds.), Publications of the Newton Institute, Cambridge University Press, Cambridge, (1997) pp. 79-130.

  • Roy Crole, Categories for types

See also section B.3 of

A comprehensive definition of semantics of homotopy type theory in type-theoretic model categories is in section 2 of

Revised on September 9, 2012 00:20:49 by Urs Schreiber (89.204.130.235)