Modal Dependent Type Theory and Dependent Right Adjoints

04/14/2018 ∙ by Ranald Clouston, et al. ∙ University of Cambridge 0

In recent years we have seen several new models of dependent type theory extended with some form of modal necessity operator, including nominal type theory, guarded and clocked type theory, and spatial and cohesive type theory. In this paper we study modal dependent type theory: dependent type theory with an operator satisfying (a dependent version of) the K-axiom of modal logic. We investigate both semantics and syntax. For the semantics, we introduce categories with families with a dependent right adjoint (CwDRA) and show that the examples above can be presented as such. Indeed, we show that any finite limit category with an adjunction of endofunctors gives rise to a CwDRA via the local universe construction. For the syntax, we introduce a dependently typed extension of Fitch-style modal lambda-calculus, show that it can be interpreted in any CwDRA, and build a term model. We extend the syntax and semantics with universes.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Dependent types are a powerful technology for both programming and formal proof. In recent years we have seen several new models of dependent type theory extended with a type-former resembling modal necessity, such as nominal type theory [PittsAM:deptta], guarded [birkedal2011first, BirkedalL:gdtt-conf, GDTTmodel, GCTT] and clocked [CloTTmodel] type theory, and spatial and cohesive type theory [shulman2017brouwer]. These examples all satisfy the K axiom of modal logic

but are not all (co)monads, the more extensively studied construction in the context of dependent type theory [Krishnaswami:Integrating, shulman2017brouwer, dePaiva:Fibrational]. Motivated in part by these examples, in this paper we study modal dependent type theory: dependent type theory with an operator satisfying (a dependent generalisation of) the K-axiom of modal logic. We investigate both semantics and syntax.

For the semantics, we introduce categories with families with a dependent right adjoint (CwDRA) and show that this dependent right adjoint models the modality in the examples mentioned above. Indeed, we show that any finite limit category with an adjunction of endofunctors111This should not be confused with models where there are adjoint functors between different categories which can be composed to define a monad or comonad. gives rise to a CwDRA via the local universe construction [LumsdainePL:locumo]. In particular, by applying the local universe construction to a locally cartesian closed category with an adjunction of endofunctors, we get a model of modal dependent type theory with - and -types.

For the syntax, we adapt the simply typed Fitch-style modal lambda-calculus introduced by Borghuis:Coming and Martini:Computational, inspired by Fitch’s proof theory for modal logic [Fitch:Symbolic]. In such a calculus is introduced by ‘shutting’ a strict subordinate proof and eliminating by ‘opening’ one. For example the axiom K is inhabited by the term


The nesting of subordinate proofs can be tracked in sequent style by a special symbol in the context which we call a lock, and write ; the open lock symbol is intended to suggest we have access to the contents of a box. Following Clouston:fitch-2018, the lock can be understood as an operation on contexts left adjoint to ; hence Fitch-style modal -calculus has a model in any cartesian closed category equipped with an adjunction of endofunctors. Here we show, in work inspired by Clocked Type Theory [bahr2017clocks], that Fitch-style -calculus lifts with a minimum of difficulty to dependent types. In particular the term (1), where is a dependent function, has type

This dependent version of the K axiom, not obviously expressible without the construct of a Fitch-style calculus, allows modalised functions to be applied to modalised data even in the dependent case. This capability is known to be essential in at least one example, namely proofs about guarded recursion [BirkedalL:gdtt-conf]222This capability was achieved by Bizjak et al. [BirkedalL:gdtt-conf] via delayed substitutions, but this construction does not straightforwardly support an operational semantics [bahr2017clocks].. We show that our calculus can be soundly interpreted in any CwDRA, and construct a term model.

We also extend the syntax and semantics of modal dependent type theory with universes. Here we restrict attention to models based on (pre)sheaves, for which Coquand has proposed a particularly simple formulation of universes [Coquand:CwU]. We show how to extend Coquand’s notion of a category with universes with dependent right adjoints, and observe that a construction encoding the modality on the universe, introduced for guarded type theory by BirkedalL:gdtt-conf, in fact arises for more general reasons.

Another motivation for the present work is that it can be understood as providing a notion of a dependent adjunction between endofunctors. An ordinary adjunction on a category is a natural bijective correspondence . With dependent types one might consider dependent functions from to , where may depend on , and similarly from to . Our notion of CwDRA then defines what it means to have an adjoint correspondence in this dependent case. Our Fitch-style modal dependent type theory can therefore also be understood as a term language for dependent adjoints.

Outline We introduce CwDRAs in Section 2, and present the syntax of modal dependent type theory in Section 3. In Section 4 we show how to construct a CwDRA from an adjunction on a category with finite limits. In Section 5 we show how various models in the literature can be presented as CwDRAs. The extension with universes is defined in Section 6. We end with a discussion of related and future work in Section 7.

2 Categorical Semantics of Modal Dependent Type Theory

The notion of category with families (CwF) [Dybjer1996, hofmann1997syntax] provides a semantics for the development of dependent type theory which elides some difficult aspects of syntax, such as variable binding, as well as the coherence problems of simpler notions of model. It can be connected to syntax by a soundness argument and term model construction, and to more intuitive models via ‘strictification’ constructions. In this section we extend this notion to introduce categories with a dependent right adjoint (CwDRA). We first recall the standard definition:

[category with families] A CwF is specified by:

  1. A category with a terminal object . Given objects , write for the set of morphisms from to in . The identity morphism on is just written with implicit. The composition of with is written .

  2. For each object , a set of families over .

  3. For each object and family , a set of elements of the family over .

  4. For each morphism , re-indexing functions and , satisfying , , and .

  5. For each object and family , a comprehension object equipped with a projection morphism , a generic element and a pairing operation satisfying , , and .

A dependent right adjoint then extends the definition of CwF with a functor on contexts and an operation on families , intuitively understood to be left and right adjoints:

[category with a dependent right adjoint] A CwDRA is a CwF equipped with the following extra structure:

  1. An endofunctor on the underlying category of the CwF.

  2. For each object and family , a family , stable under re-indexing in the sense that for all we have

  3. For each object and family a bijection


    We write the effect of this bijection on as and write the effect of its inverse on also as . Thus


    The bijection is required to be stable under re-indexing in the sense that for all we have


    from which it follows that we also have


    (since using (4)–(6), we have ).

3 Syntax of Modal Dependent Type Theory

In this section we extend Fitch-style modal -calculus [Borghuis:Coming] to dependent types, and connect this to the notion of CwDRA via a soundness proof and term model construction. We define our dependent types broadly in the style of ECC [Luo:ECC], as this is close to the implementation of some proof assistants [norell:thesis].

We define the raw syntax of contexts, types, and terms as follows:

We omit the leftmost ‘’ where the context is non-empty. -types are included in the grammar as an exemplar to show that standard constructions can be given standard definitions, without reference to the locks in the context. One could similarly add an empty type, unit type, booleans, -types, W-types, universes (of which more in Section 6), and so forth.

Judgements have forms

Context formation rules: * ⋄⊢ *[right=] Γ⊢
Γ⊢A Γ,x:A⊢ * Γ⊢ Γ,⊢ *[right= not free in ] Γ,x:A,y:B,Γ’⊢ Γ,y:B,x:A,Γ’⊢

Type formation rules: * Γ⊢A
Γ,x:A⊢B Γ⊢Πx:A. B * Γ,⊢A Γ⊢□A

Type equality rules are just equivalence and congruence.

Term formation rules: * Γ⊢t:A
Γ⊢A=B Γ⊢t:B *[right=] Γ,x:A,Γ’⊢ Γ,x:A,Γ’⊢x:A * Γ,x:A⊢t:B Γ⊢λx.t:Πx:A. B * Γ⊢t:Πx:A. B
Γ⊢u:A Γ⊢t u:B[u/x]
* Γ,⊢t:A Γ⊢ t:□A *[right=] Γ⊢t:□A
Γ,,Γ’⊢ Γ,,Γ’⊢ t:A

Term equality rules, omitting equivalence and congruence: * Γ⊢(λx.t)u:A Γ⊢(λx.t)u=t[u/x]:A * Γ⊢ t:A Γ⊢ t=t:A *[right=] Γ⊢t:Πx:A. B Γ⊢t=λx.t x:Πx:A. B * Γ⊢t:□A Γ⊢t= t:□A

Figure 1: Typing rules for a dependent Fitch-style modal -calculus.

Figure 1 presents the typing rules of the calculus. The syntactic results below follow easily by induction on these rules. We remark only that exchange of variables with locks, and weakening of locks, are not admissible, and that the (lock-free) weakening in the rule is essential to proving variable weakening.

Let range over the possible strings to the right of a turnstile in a judgement.

  1. If and is not free in , then ;

  2. If , and , and is a fresh variable, then ;

  3. If and , then ;

  4. If then ;

  5. If then and .

3.1 Sound interpretation in CwDRAs

In this section we show that the calculus of Figure 1 can be soundly interpreted in any CwDRA. We wish to give meaning to contexts, types, and terms, but (via the type conversion rule) these can have multiple derivations, so it is not possible to work by induction on the formation rules. Instead, following e.g. hofmann1997syntax, we define a partial map from raw syntax to semantics by induction on the grammar, then prove this map is defined for well-formed syntax. By ‘raw syntax’ we mean contexts, types accompanied by a context, and terms accompanied by context and type, defined via the grammar. The size of a type or term is the number of connectives and variables used to define it, and the size of a context is the sum of the sizes of its types.

Well-defined contexts will be interpreted as objects in , types in context as families in , and typed terms in context as elements in . Where there is no confusion we write as and as or .

The partial interpretation of raw syntax is as follows, following the convention that ill-formed expressions (for example, where a subexpression is undefined) are undefined. We omit the details for -types and other standard constructions, which are as usual.

  • ;

  • ;

  • ;

  • ;

  • ;

  • ;

  • .

In Figure 2 we define expressions , , and that, where defined, define -morphisms corresponding respectively to weakening, exchange, and substitution in contexts.

Figure 2: -morphisms corresponding to weakening, exchange, and substitution.

Suppose and are defined. Then the following properties hold:

  1. , where is Kleene equality, and is a type or typed term;

  2. is a well-defined morphism from to ;


The proof proceeds by mutual induction on the size of (for statement 2) and the size of plus the size of (for statement 1). We present only the cases particular to .

We start with statement 1. We use the mutual induction with statement 2 at the smaller size of alone to ensure that is well-formed with the correct domain and codomain.

The case follows because by induction, which is by (2), which is then .

The case follows immediately from (6) and induction. For , the case where the deleted variable is to the right of the lock follows by Definition 2 part 5. Suppose instead it is to the left. Then by Definition 2 part 5, which is by (7), which is by induction as required.

For statement 2, the lock case holds immediately by application of the functor . ∎

Suppose and are defined. Then the following properties hold:

  1. , where is a type or typed term;

  2. is a well-defined morphism from to ;


The base case of statement 1 uses Lemma 3.1; the proof otherwise follows just as with Lemma 3.1. ∎

Suppose and are defined. Then the following properties hold:

  1. , where is a type or typed term;

  2. is a well-defined morphism from to ;


As with Lemma 3.1. ∎

[Soundness] Where a context, type, or term is well-formed, its denotation is well-defined, and all types and terms identified by equations have the same denotation.


Most cases follow as usual, using Lemmas 3.1, 3.1, and 3.1 as needed. The well-definedness of the formation rules for are straightforward, so we present only the equations for :

Starting with we have and wish to prove its denotation is equal to that of (with the weakening ). Then , which is the weakening of by Lemma 3.1.

The equality of and is straightforward. ∎

3.2 Term model

We now develop as our first example of a CwDRA, a term model built from the syntax of our calculus. The objects of this category are contexts modulo equality, which is defined pointwise via type equality. We define an arrow as a sequence of substitutions of an equivalence class of terms for each variable in :

  • the empty sequence is an arrow ;

  • Given , type and term , then modulo equality on is an arrow ;

  • Given and a well-formed context with no locks in , then is also an arrow .

We usually refer to the equivalence classes in arrows via representatives. Note that substitution respect these equivalence classes because of the congruence rules.

We next prove that this defines a category. Identity arrows are easily constructed:

If then .


By induction on the construction on . The base case is trivial.

Given and , by induction we have and by variable weakening we have as required.

Supposing we have yielding , we could similarly get . ∎

The identity on simply replaces all variables by themselves.

The identity on each is well defined as an arrow.


By induction on . The identity on is the empty sequence of substitutions. Given , we have by Lemma 3.2, and as required. immediately yields . ∎

The composition case is slightly more interesting:

Given and , we have .


By induction on the construction on . The base case requires that implies ; this left weakening property is easily proved by induction on the typing rules.

Given , and , by induction . Then by Lemma 3 part 3 we have as required. The lock case is trivial. ∎

The composition of and involves replacing each in with .

The composition of two arrows and is a well-defined arrow.


By induction on the definition of . The base case is trivial, and extension by a new substitution follows via Lemma 3.2.

Now suppose we have yielding . Now if we have this must have arisen via some generating , where . By induction we have well-defined . Hence . But because the variables of do not appear in . ∎

Checking the category axioms is straightforward. The category definitions then extend to a CwF in the usual way: the terminal object is , the families over are the types modulo equivalence well-defined in context , the elements of any such type are the terms modulo equivalence, re-indexing is substitution, comprehension corresponds to extending a context with a new variable, the projection morphism is the replacement of variables by themselves, and the generic element is given by the variable rule.

Moving to the definition of a CwDRA, the endofunctor acts by mapping , and does not change arrows. The family is the type , which is stable under re-indexing by Lemma 3 part 3. The bijections between families are supplied by the and rules, with all equations following from the definitional equalities.

We do not attempt to prove that the term model is the initial CwDRA; such a result for dependent type theories appears to require syntax be written in a more verbose style than is appropriate for a paper introducing a new type theory [Castellan:Dependent]. Nonetheless our type theory and notion of model are close enough that we conjecture that such a development is possible.

4 A general construction of CwDRAs

In this section we show how to construct a CwDRA from an adjunction of endofunctors on a category with finite limits. We will refer to categories with finite limits more briefly as cartesian categories. We will use this construction in Section 5 to prove that the examples mentioned in the introduction can indeed be presented as CwDRAs. Our construction is an extension of the local universe construction [LumsdainePL:locumo], which maps cartesian categories to categories with families, and locally cartesian closed categories to categories with families with - and -types. The local universe construction is one of the known solutions to the problem of constructing a strict model of type theory out of a locally cartesian closed category (see [hofmann1994interpretation, LumsdainePL:locumo, LumsdainePL:simmuf, hofmann1997syntax] for discussions of alternative approaches to ’strictification’).

We first recall the local universe construction. Since it can be traced back to Giraud’s work on fibred categories [Giraud:Cohomologie], we refer to it as the Giraud CwF associated to a cartesian category.

Let be a cartesian category. The Giraud CwF of () is the CwF whose underlying category is , and where a family is a pair of morphisms


and an element of , for , is a map such that . Reindexing of and along are given by


The comprehension , for , is given by the pullback of diagram (8), and the pairing operation is obtained from the universal property of pullbacks.

Note that the local universe construction does indeed yield a category with families; in particular, reindexing in is strict as required, simply because reindexing is given by composition.

The name ’local universe’ derives from the similarity to Voevodsky’s use of a (global) universe to construct strict models of type theory [Voevodsky:csys, LumsdainePL:simmuf] in which types in a context are modelled as morphisms . In the local universe construction, the universe varies from type to type.

In fact, the local universe construction is functorial; a precise statement requires a novel notion of CwF-morphism:

A weak CwF morphism between CwFs consists of a functor between the underlying categories preserving the terminal object, an operation on families mapping to a family , an operation on elements mapping to an element , and an isomorphism , inverse to . These are required to commute with reindexing, in the sense that and .

Note that a weak CwF morphism preserves comprehension and the terminal object only up to isomorphism instead of on the nose, as required by the stricter notion of morphism of Dybjer [Dybjer1996, Definition 2]. Weak CwF morphisms sit between strict CwF-morphisms and pseudo-CwF morphisms [DBLP:journals/lmcs/CastellanCD17].

is a (fully faithful) functor from the category of cartesian categories and finite limit preserving functors, to the category of CwFs with weak morphisms.


Let be a finite limit preserving functor. For each and , we simply let . Likewise, for an element , we let be the action of on the morphism . Finally, since comprehension is defined by pullback and preserves pullbacks up to isomorphism, we obtain the required . ∎

We now embark on showing that if we apply the local universe construction to a cartesian category with a pair of adjoint endofunctors, then the resulting CwF is in fact a CwDRA (Theorem 4). To this end, we introduce the intermediate notion of a category with families with an adjunction:

A CwF+A consists of a CwF with an adjunction on the category of contexts, such that extends to a weak CwF endomorphism.

Note that the conditions for a CwF+A are stronger than those for a CwDRA; for instance, a CwDRA does not require to be defined on the context category. We return to the relation between these constructions in Section 4.1

If is a cartesian category and are adjoint endofunctors on , then with the adjunction is a CwF+A.


We are already given an adjunction on the underlying category of . Theorem 4 constructs the weak CwF morphism. ∎

If with the adjunction is a CwF+A, then there is a CwDRA structure on with as the required functor on .


We write for the unit of the adjunction. For a family , we define to be . For an element , we define its transpose to be . For the opposite direction, suppose . Since , we have that and thus we can define to be the element . ∎

If is a cartesian category and are adjoint endofunctors on , then has the structure of a CwDRA.


By Lemmas 4 and 4. ∎

The above Theorem 4 thus provides a general construction of CwDRAs. In Section 5 we use it to present examples from the literature. As mentioned earlier, the local universe construction interacts well with other type formers: If we start with a locally cartesian closed category (with W-types, Id-types and a universe), then also models dependent products and sums (and W-types, Id-types and a universe); see LumsdainePL:locumo. In Section 6 we consider universes.

4.1 CwF+A from a CwDRA

In this subsection we show how to produce a CwF+A from a CwDRA under the assumption that the CwF is democratic. Intuitively, a democratic CwF is one where every context comes from a type, and hence it is not surprising that for a democratic CwDRA one can use the action of the dependent right adjoint on families to define a right adjoint on contexts.

A CwF is democratic [Clairambault2011] if for every context there is a family and an isomorphism .

Let be a democratic CwDRA. The endofunctor , part of the CwDRA structure, has a right adjoint .


For , we define by .


We have a bijection, natural in

The last of the above bijections follows by composition with .

Let we have then an action given by

Define . Then the correspondence is natural in , proving that is a right adjoint to . ∎

Consider a democratic CwDRA, with as the underlying category, and the adjunction obtained from the above theorem. We then extend to a weak CwF morphism by defining, for a family and an element ,

where is the counit of the adjunction. as defined above is a weak CwF morphism. In particular, for we have an isomorphism , inverse to .


We will show a bijection natural in . We have

We have a bijection . But

Hence we have a bijection . So

By the Yoneda lemma, this implies , and it is easy to check that the direction is given by . ∎

A democratic CwDRA has the structure of CwF+A

For a category with a terminal object, the CwF is democratic with given by the diagram:

For ordinary dependent type theory, the term model is a democratic CwF [DBLP:journals/lmcs/CastellanCD17, Section 4]. However, the term model for our modal dependent type theory is not democratic, since there is, for example, no type corresponding to the context consisting of just one lock.

5 Examples

We now present concrete examples of CWDRAs generated from cartesian categories with an adjunction of endofunctors, including those mentioned in the introduction.

type with closed domain Consider a CwF where the underlying category of contexts is cartesian closed, and let be a closed type. We have then an adjunction of endofunctors on , and suppose that the right adjoint extends to a weak CwF endomorphism, giving the structure of a CwF+A. As we saw above, this happens e.g. when the CwF is of the form . In this case behaves as a type of the form since .

Thus, the notion of dependent right adjoint generalises types with closed domain. This generalises to the setting where carries the structure of a monoidal closed category, in which case the adjunction extends to give a dependent notion of linear function space with closed domain. The next example is an instance of this.

Dependent name abstraction The notion of dependent name abstraction for families of nominal sets was introduced by Pitts et al. [PittsAM:deptta, Section 3.6] to give a semantics for an extension of Martin-Löf Type Theory with names and constructs for freshness and name-abstraction. It provides an example of a CwDRA that can be presented via Theorem 4. In this case is the category of nominal sets and equivariant functions [PittsAM:nomsns]. Its objects are sets equipped with an action of finite permutations of a fixed infinite set of atomic names , with respect to which the elements of are finitely supported, and its morphisms are functions that preserve the action of name permutations. is a topos (it is equivalent to the Schanuel topos [PittsAM:nomsns, Section 6.3]) and hence in particular is cartesian. We take the functor to be separated product [PittsAM:nomsns, Section 3.4] with the nominal set of atomic names. This has a right adjoint that sends each to the nominal set of name abstractions  [PittsAM:nomsns, Section 4.2] whose elements are a generic form of -equivalence class in the case that is a nominal set of syntax trees for some language.

Applying Theorem 4, we get a CwDRA structure on . In fact the CwF has an equivalent, more concrete description in this case, in terms of families of nominal sets [PittsAM:deptta, Section 3.1]. Under this equivalence, the value of the dependent right adjoint at corresponds to the family of dependent name abstractions defined by [Section 3.6]PittsAM:deptta. The bijection (3) is given in one direction by the name abstraction operation [PittsAM:deptta, (40)] and in the other by concretion at a fresh name [PittsAM:deptta, (42)].

Guarded and Clocked Type Theory Guarded recursion [Nakano:Modality] is an extension of type theory with a modal later operator, denoted , on types, an operation and a guarded fixed point operator mapping to a fixed point for . The standard model of guarded recursion is the topos of trees [birkedal2011first], i.e., the category of presheaves on , with , . The later operator has a left adjoint , called earlier, given by , so yields a dependent right adjoint on the induced CwDRA.

Birkedal et al. [birkedal2011first, Section 6.1] show that in a dependently typed setting does not commute with reindexing. However it does have a left adjoint, namely the ‘stutter’ functor with and , so does give rise to a well-behaved modality in the setting of this paper. This apparent contradiction is resolved by the use of locks in the context: does not give rise to a well-behaved , but does. This is an intriguing example of the Fitch-style approach increasing expressivity.

Guarded recursion can be used to encode coinduction given a constant modality [clouston2015programming], denoted , on the topos of trees, defined as . The functor is the right adjoint of the essential geometric morphism on induced by , the constant map to , and hence it also yields a dependent right adjoint. In clouston2015programming, was used in a simple type theory, employing ‘explicit substitutions’ following Bierman:Intuitionistic. As we will discuss in Section 7 this approach proved difficult to extend to dependent types, and we wish to use the modal dependent type theory of the present paper to study in dependent type theory.

An alternative to the constant modality are the clock quantifiers of atkey13icfp, which unlike the constant modality have already been combined succesfully with dependent types [Mogelberg:Type, BirkedalL:gdtt-conf]. They are also slightly more general than the constant modality, as multiple clocks allow coinductive data structures that unroll in multiple dimensions, such as infinitely-wide infinitely-deep trees. The denotational semantics [GDTTmodel], however, are more complicated, consisting of presheaves over a category of ‘time objects’, restricted to those fulfilling an ‘orthogonality’ condition. Nevertheless the adjunction of the topos of trees lifts to this category, and so once again we may construct a CwDRA.

Clocked Type Theory (CloTT[bahr2017clocks] is a recent type theory for guarded recursion that has strongly normalising reduction semantics, and has been shown to have semantics in the category discussed above [CloTTmodel]. The operator is refined to a form of dependent function type over ticks on clock . Ticks can appear in contexts as ; these are similar to the locks of Fitch-style contexts, except that ticks have names, and can be weakened. The names of ticks play a crucial role in controlling fixed point unfoldings.

Finally, the modal operator on the topos of trees can be generalized to the presheaf topos for any category , simply by using the identity on to extend the underlying functor (which generates the essential geometric morphism) on to . In GCTT this topos, with the cube category, is used to model guarded cubical type theory; an extension of cubical type theory [CoquandT:cubttc]. In more detail, one uses a CwF where families are certain fibrations, and since preserves fibrations, it does indeed extend to a CwDRA.

Cohesive Toposes Cohesive toposes have also recently been considered as models of a form of modal type theory [shulman2017brouwer, 2017arXiv170607526R]. Cohesive toposes carry a triple adjunction and hence induce two dependent right adjoints. Examples of cohesive toposes include simplicial sets and cubical sets ; since these are presheaf toposes they also model universes. For example, for simplicial sets, the triple of adjoints are given by the essential geometric morphism induced by the constant functor . In the category of cubical sets has a further right adjoint, used by Nuyts:Parametric to reason about parametricity.

Tiny objects licata2018internal use a tiny object to construct the fibrant universe in the cubical model of homotopy type theory. An object is tiny if exponentation by it has a right-adjoint. The corresponding dependent right adjoint plays an important part in the construction of the fibrant universe. Like above, this right-adjoint is not available in the internal logic of a topos, but our present framework is still applicable.

6 Universes

In this section, we extend our modal dependent type theory with universes. For the semantics, we start from Coquand’s notion of a category with universes [Coquand:CwU], which covers all presheaf models of dependent type theory with universes. The notion of category with universes rests on the observation that in presheaf models one can interpret an inverse to the usual function from codes to types, and hence obtain a simpler notion of universe than usual [section 2.1.6]hofmann1997syntaxsuch as in.

[category with universes] A CwU is specified by:

  1. A category with a terminal object .

  2. For each object and natural number , a set of families at universe level over .

  3. For each object , natural number , and family , a set of elements (at some level) of the family over .

  4. For each morphism , re-indexing functions and , satisfying equations for associativity and identity as in a CwF.

  5. For each object , number and family , a comprehension object equipped with projections and generic elements satisfying equations as in a CwF.

  6. For each number , a family , the universe at level .

  7. For each object and number , a code function , and an element function , satisfying , , and .

We will of course want the universes to be closed under various type-forming operations, but in this formalisation of universes these definitions are just as for CwFs, without having to explicitly reflect them into the universes.

The element function is stable under re-indexing: .