|logic||category theory||type theory|
|true||terminal object/(-2)-truncated object||h-level 0-type/unit type|
|false||initial object||empty type|
|proposition||(-1)-truncated object||h-level 1-type/h-prop|
|cut elimination for implication||counit for hom-tensor adjunction||beta reduction|
|introduction rule for implication||unit for hom-tensor adjunction||eta conversion|
|disjunction||coproduct ((-1)-truncation of)||sum type (bracket type of)|
|implication||internal hom||function type|
|negation||internal hom into initial object||function type into empty type|
|universal quantification||dependent product||dependent product type|
|existential quantification||dependent sum ((-1)-truncation of)||dependent sum type (bracket type of)|
|equivalence||path space object||identity type|
|equivalence class||quotient||quotient type|
|induction||colimit||inductive type, W-type, M-type|
|higher induction||higher colimit||higher inductive type|
|completely presented set||discrete object/0-truncated object||h-level 2-type/preset/h-set|
|set||internal 0-groupoid||Bishop set/setoid|
|universe||object classifier||type of types|
|modality||closure operator monad||modal type theory, monad (in computer science)|
|linear logic||(symmetric, closed) monoidal category||linear type theory/quantum computation|
|proof net||string diagram||quantum circuit|
|(absence of) contraction rule||(absence of) diagonal||no-cloning theorem|
In the relation between type theory and category theory, dependent types are said to correspond to morphisms regarded as indexed families. That is, if a type corresponds to an object in some category, then a dependent type
corresponds to a morphism in that category. We think of this morphism as a bundle or fibration, whose fiber over is the type . We can then say that type forming operations such as dependent sum type and dependent product type correspond to category-theoretic operations of dependent sum and dependent product.
However, this correspondence is not quite precise; in the case of dependent types there are extra coherence issues. Substitution in type theory should correspond to pullback in category theory; that is, given a term
corresponding to a morphism , the substituted dependent type
should correspond to the pullback of along . However, substitution in type theory is strictly associative. That is, given also , the dependent type
is syntactically the same regardless of whether we obtain it by substituting into , or into . In category theory, however, pullback is not generally strictly associative, so there is a mismatch. Similarly, every type-forming operation must also be strictly preserved by substitition/pullback.
The way this is generally dealt with is to introduce a category-theoretic structure which does have a “substitution” operation which is strictly associative, hence does correspond directly to type theory, and then show that any category can be “strictified” into such a stricter structure. Unfortunately, there are many different such structures which have been used, differing only slightly. On this page we define and compare them all.
So far, we do not assume anything about as a category. Usually, one at least wants to have a terminal object, representing the empty context, although this is not always included in the definitions. The additional structures we impose on below will imply in particular that certain pullbacks exist in .
Sometimes, we want to consider as a strict category, that is, we consider its objects up to equality rather than isomorphism. However, for most of the definitions below (until we get to contextual categories), it is still sensible to treat in an ordinary category-theoretic way, with the strictness living in the additional structure.
where is the arrow category of , and such that
We do not ask that be a fibration (that would require to have all pullbacks), only that the particular morphisms in the image of are cartesian.
A comprehension category is called
In the latter case, we must consider at least to be a strict category (that is, we consider its objects up to equality rather than isomorphism) for the notion to make sense.
The interpretation of this definition is as follows.
In a comprehension category, we may regard the objects of as contexts, and the fiber of over an object as the category of dependent types in context . If the comprehension category is split, then such dependent types have strictly associative substitution.
The functor assigns to each “type in context ” a new context which we think of as extended by a fresh variable of type , and write as . This new context comes with a projection (which forgets the fresh variable), and all substitutions in are realized as pullbacks in .
If is a display map category, then by defining to be the full subcategory of whose objects are display maps, we obtain a full comprehension category. Thus, we have:
Working up to equivalence of categories, as is usual in category theory, it is natural to consider display map categories to also be equivalent to full comprehension categories, def. 2, (those where is merely fully faithful).
However, this breaks down when we are interested in split comprehension categories, def. 2, for modeling substitution with strict associativity, since then at least must be regarded as a strict category and considered up to isomorphism rather than equivalence. Thus, display map categories may be said to be equivalent to non-split full comprehension categories, but “split display map categories” are not equivalent to split full comprehension categories. (In fact, split display map categories are not very useful; usually in order to make pullbacks strictly associative we have to introduce extra “names” for the same objects.)
That is, in a category with attributes we demand only that each context comes with a set of dependent types in that context, rather than a category of such. The intent is that the morphisms between two types in context should be determined by the morphisms in between the extended contexts over .
Another way to convey this same intent with a comprehension category would be to ask that it be full, def. 2, i.e. that the functor be fully faithful.
In fact, any category with attributes gives rise to a full comprehension category by factoring the functor into a bijective on objects functor followed by a fully faithful one. In this way, we obtain:
A category with attributes specifies only for each “context”, a set of “types” in that context. A comprehension category, by contrast, specifies a whole category of “types” in each context. If , then we can think of a morphism in as a term
in type theory.
A category with families specifies instead, for each context and each type in that context, a set of “terms belonging to that type”. These should be thought of as terms
in type theory.
The additional insight in the following definition is that if we expect all of these terms to be determined by the morphisms in , as in a category with attributes or a full comprehension category, then instead of specifying the functor and then asking either that it be fully faithful or that be discrete (removing the information about extra morphisms in ), if we specify the terms of the form (2), then the functor is determined by a universal property.
Let denote the category of families of sets. Its morphisms are set-indexed families , and its morphisms consist of a function and functions . We can equivalently, of course, regard this as the arrow category of Set, where corresponds to the arrow .
A category with families is a category together with
A functor , written .
For each and , a representing object for the functor
We can then prove:
If we forget the terms in a category with families and let be the Grothendieck construction of the functor , it is easy to show that we obtain a category with attributes. Conversely, given a category with attributes, let be the functor corresponding to the discrete fibration , and for let be the set of sections of the morphism in that is the image of in . These constructions are inverses up to isomorphism.
The following alternative characterization was observed by Steve Awodey.
If we modify Def. 5 by requiring only that the functors be representable (rather than equipped with representing objects), then it is equivalent to giving
Recall that if is a comprehension category, is a “context” and is a “type” in context , we denote by the “extended context” in .
A contextual category is a category with attributes , def. 4, together with a length function such that
The idea which distinguishes a contextual category is that “every context must be built out of types” in a unique way.
This makes for the closest match with type theory; in fact we have
Choose a terminal object (the resulting contextual category does not depend on this choice, up to isomorphism).
such that and for all .
The morphisms in are the morphisms in .
All the rest of the structure on is induced in an evident way from .
Comprehension categories and display map categories are easy to come by “in nature”, but it is more difficult to find examples of the “split” versions of the above structure (which are what is needed for modeling type theory). Here we summarize some basic known constructions.
However, first we should mention the examples that come from type theory itself.
The syntactic category of any dependent type theory has all of the above structures. Its objects are contexts in the theory, and the types in context form the set or category . The strict associativity of substitution in type theory makes this fibration automatically split.
Given any comprehension category, def. 1,
Of course, comprehension categories are easy to come by; perhaps they arise most commonly as display map categories. For instance, if has all pullbacks, then we can take all maps to be display maps. If is a category of fibrant objects, we can take the fibrations to be the display maps.
So, for the record, we have in particular:
For a locally cartesian closed category , it becomes a model for dependent type theory by regarding its codomain fibration as a comprehension category, def. 1, and then strictifying that as in example 2.
It turns out that for modeling additional type-forming operations, however, not all splitting constructions are created equal.
Given , one classical construction (due to John Power) defines , where an object of over consists of a morphism in along with an object of over . Type-theoretically, we can regard as a type with a “delayed substitution” . This produces a split fibration (the chosen cartesian arrows are given by composition of morphisms in ), but it seems impossible to define dependent sums and products on it in a strict way.
A better choice is a construction due to Benabou, which defines the objects of over to be functors over which map every morphism of to a cartesian arrow. Type-theoretically, we can think of such an object as a type together with specified compatible substitutions along any possible morphism. That type-formers can be extended in this case was proven by Martin Hofmann for dependent sums and dependent products and extensional identity types, and by Michael Warren in the case of intensional identity types (but not for the eliminator).
Suppose given a particular morphism in . We can then define a category with attributes, def. 4, as follows: the discrete fibration corresponds to the representable presheaf , and the functor is defined by pullback of . We are thus treating as a “universe” of types. We can then of course pass to a contextual category, as described above.
Type-forming operations can be extended strictly in this case by performing them once in the “universal” case, then acting by composition. This construction is due to Voevodsky. It also meshes quite well with type theories that contain internal universes – a type of types– , and in particular for modeling the univalence axiom.
Particular important universes include:
In the category Gpd, the groupoid of small groupoids. The resulting display maps are the split opfibrations with small fibers. Similarly, we can consider the groupoid of small sets, whose display maps are the discrete opfibrations with small fibers.
Let be any category with finite products, and define to be the discrete fibration corresponding to the presheaf which is constant at . Thus, the objects of are pairs of objects of , with the only morphisms being of the form induced by a morphism in .
Define the functor to take to the projection . It is straightforward to check that this defines a category with attributes. The corresponding (split) full comprehension category is called the simple fibration of .
The dependent type theory which results from this structure “has no nontrivial dependency”. That is, whenever we have a dependent type , it is already the case that is a type in the empty context (that is, we have ), and so it cannot depend nontrivially on . In effect, it is not really a dependent type theory, but a simple (non-dependent) type theory — hence the name “simple fibration”.
A general overview can be found in
Comprehension categories are defined in
Display maps are discussed in
Categories with attributes are discussed in
John Cartmell, Generalised algebraic theories and contextual categories, Ph.D. thesis, Oxford, 1978
Eugenio Moggi, A category-theoretic account of program modules, Math. Structures Comput. Sci. 1 (1991), no. 1, 103–139
Andrew M. Pitts, Categorical logic, Handbook of logic in computer science, Vol. 5, Handb. Log. Comput. Sci., vol. 5, Oxford Univ. Press, New York, 2000, pp. 39–128
Categories with families are defined in
and shown to be equivalent to categories with attributes in
Contextual categories are defined in
John Cartmell, Generalised algebraic theories and contextual categories, Ann. Pure Appl. Logic 32 (1986), no. 3, 209–243
Thomas Streicher, Semantics of type theory, Progress in Theoretical Computer Science, Birkhäuser Boston Inc., Boston, MA, 1991, Correctness, completeness and independence results.
Strictification is discussed in
Martin Hofmann, On the interpretation of type theory in locally cartesian closed categories