nLab categorical semantics

Contents

Context

Categorical algebra

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

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 𝒞\mathcal{C} with finite limits. For more see categorical model of dependent types.

Write cod:𝒞 I𝒞cod : \mathcal{C}^I \to \mathcal{C} 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 𝒞\mathcal{C} to the slice category over it, and sends a morphism f:ΓΓf : \Gamma \to \Gamma' to the pullback/base change functor

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

We give now rules for choices “[xyz][x y z]” that associate with every string “xyzx y z” of symbols in type theory objects and morphisms in 𝒞\mathcal{C}. A collection of such choices following these rules is an interpretation / a choice of categorical semantics of the type theory in the category 𝒞\mathcal{C}.

Contexts and type judgements

  1. The empty context ()() in type theory is interpreted as the terminal object of 𝒞\mathcal{C}

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

    ΓA:Type \Gamma \vdash A : Type

    is interpreted as an object in the slice over [Γ][\Gamma]

    [Γ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 𝒞\mathcal{C}.

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

Terms

Assume for a context Γ\Gamma and a judgement ΓA:Type\Gamma \vdash A : Type we have already chosen an interpretation [Γ,x:A][ΓA:Type][Γ][\Gamma, x : A] \stackrel{[\Gamma \vdash A : Type]}{\to} [\Gamma] as above.

A judgement of the form Γa:A\Gamma \vdash a : A (a term of type AA) is to be interpreted as a section of this morphism, equivalently as a morphism in 𝒞 /[Γ]\mathcal{C}_{/[\Gamma]}

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

from the terminal object to [ΓA:Type][\Gamma \vdash A : Type], which in 𝒞\mathcal{C} is a commuting triangle

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

Variables

For a term Γa:A\Gamma \vdash a : A the context Γ\Gamma is the collection of free variables in aa.

(…)

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 𝒞\mathcal{C} of the form

[(Γ,x:A,y:B(x))] [Γ,x:AB(x):Type] [Γ] [Γa:A] [(Γ,x:A)] id [ΓA:Type] [Γ] \array{ &&&& \big[ (\Gamma, x \colon A, y \colon B(x)) \big] \\ &&&& \Big\downarrow \mathrlap{ {}^{ \big[ \Gamma, x \colon A \,\vdash\, B(x) \colon Type \big] } } \\ [\Gamma] && \overset{ [\Gamma \vdash a \colon A] } {\longrightarrow} && \big[ (\Gamma, x \colon A) \big] \\ & {}_{id}\searrow && \swarrow_{\mathrlap{[\Gamma \vdash A \colon 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 𝒞\mathcal{C} 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.

Examples

Terminology

Most usage in mathematics of the adjective “categorical” in relation to category theory is a shorthand, and arguably an unfortunate one, for “category theoretic”, i.e. for “as seen through the lens of, hence as treated with the concepts and tools of category theory”.

Compare to “numerical” versus “number theoretic”: The interest of number theory is not in numerical methods! Numerical statements are made by engineers. For category theorists it’s worse: Their profession is not to do categorical arguments, not in the dictionary sense of “categorical” as “unambiguous, absolute, unqualified”.

While the careful dictionaries list a secondary sense of “categorical”, as “relating to a category”, they hardly have the categories of Kant in mind here, much less those of Eilenberg & MacLane; instead they refer to categorization: Merriam-Webster offers “categorical systems for classifying books” as an example for what “categorical” could refer to, in this secondary sense, in common language. Therefore it does not seem to help much that this secondary common sense of “categorical” is offered as the primary sense of “categorial” (without the second “c”!). But this is probably the rationale behind a more widespread use of “categorial semantics” over “categorical semantics” in the field of formal logic.

All this notwithstanding, the use in mathematics of “categorical”, as in categorical semantics is wide-spread, even standard. Since unfortunate choice of terminology in mathematics is rather common (compare “perverse schobers”!), and since the primary purpose of mathematical terminology is communication rather than, yes, proper categorization, there may not be much gain in opposing this trend, and not much success to doing so by replacing unfortunate terminology with something that looks like the same unfortunate terminology but with a typo in it.

References

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

The categorical semantics of dependent type theory in locally cartesian closed categories is essentially due to

  • R. A. G. Seely, Locally cartesian closed categories and type theory, Math. Proc. Camb. Phil. Soc. (1984) 95 (pdf)

For more references on this see at relation between category theory and type theory.

See also:

Lecture notes on this include for instance.

  • 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. (web, )

  • Roy L. Crole, Categories for types, Cambridge University Press (1994) [doi:10.1017/CBO9781139172707]

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

Last revised on April 18, 2024 at 08:40:11. See the history of this page for a list of all contributions to it.