nLab
type-theoretic definition of category

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-proposition, mere proposition
proofgeneralized elementprogram
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
cut elimination for implicationcounit for hom-tensor adjunctionbeta reduction
introduction rule for implicationunit for hom-tensor adjunctioneta conversion
logical 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/path type
equivalence classquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive 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, (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

Type-theoretic definition of category

Motivation

There are two main styles of definition of category in the literature: one which immediately generalises to the usual definition of internal category and one which immediately generalises to the usual definition of enriched category. Here we consider the latter definition, and show how it may naturally be expressed in dependent type theory.

Note that in a type theory without identity types, where types are presets (without an inherent equality predicate), it is not manifestly possible to express concepts that violate the principle of equivalence; in that categories are not necessarily strict. In homotopy type theory, we have identity types, but they are not extensional; thus it is also possible to define non-strict categories there (but there is a subtlety; see below).

Definition

In a dependent type theory with dependent record types? we can define a type of categories as follows.

We use a two-dimensional syntax, which is convenient to allow inference of implicit parameters?, and to signify notation. We read the horizontal line as a rule, so for instance the second line means that whenever aa and bb have type Obj\mathrm{Obj}, then we have a type hom(a,b)\hom(a,b) (with equality).

The notation p∶−Pp\coloneq P signifies that pp is a proof of the proposition PP (under propositions as types or propositions as some types, this may be the same as p:Pp\colon P, but many type theories treat propositions as distinct from types).

{ Obj:Type, a,b:Objhom(a,b):Type =, a:Obj1 a:hom(a,a), f:hom(b,c)g:hom(a,b)fg:hom(a,c), g:hom(a,b)left-unit∶−1 bg=g, f:hom(a,b)right-unit∶−f1 a=f, f:hom(c,d)g:hom(b,c)h:hom(a,b)-assoc∶−f(gh)=(fg)h }\begin{aligned} \biggl\{&\mathrm{Obj}\colon\mathrm{Type}, \\ &\frac{a,b\colon\mathrm{Obj}}{\hom(a,b)\colon\mathrm{Type}_=}, \\ &\frac{a\colon\mathrm{Obj}}{1_a\colon\hom(a,a)}, \\ &\frac{f\colon\hom(b,c) \quad g\colon\hom(a,b)}{f\circ g\colon\hom(a,c)}, \\ &\frac{g\colon\hom(a,b)}{\mathrm{left}\text{-}\mathrm{unit}\coloneq 1_b\circ g=g}, \\ &\frac{f\colon\hom(a,b)}{\mathrm{right}\text{-}\mathrm{unit}\coloneq f\circ 1_a=f}, \\ &\frac{f\colon\hom(c,d) \quad g\colon\hom(b,c) \quad h\colon\hom(a,b)}{\circ\text{-}\mathrm{assoc}\coloneq f\circ(g\circ h) = (f\circ g)\circ h} \\ &\!\biggr\} \end{aligned}

Here, Type\mathrm{Type} is a type of types, and Type =\mathrm{Type}_= is a type of types with equality predicates (we may or may not have Type=Type =\mathrm{Type}=\mathrm{Type}_=). Specifically:

Remark

The defined type of categories cannot itself be a member of Type\mathrm{Type}, otherwise we run into Girard's paradox. This is related to the size issues for categories.