aa r X i v : . [ m a t h . L O ] O c t TWO-DIMENSIONAL MODELS OF TYPE THEORY
RICHARD GARNER
Abstract.
We describe a non-extensional variant of Martin-L¨of type theory which wecall two-dimensional type theory , and equip it with a sound and complete semanticsvalued in 2-categories. Introduction
This is the second in a series of papers detailing the author’s investigations into theintensional type theory of Martin-L¨of, as described in [25]. The first of these papers, [10],investigated syntactic issues relating to its dependent product types. The present paperis a contribution to its categorical semantics.In [27] it was proposed that the correct categorical models for extensional Martin-L¨oftype theory should be locally cartesian closed categories: these being categories C withfinite limits in which each of the functors f ∗ : C /X → C /Y induced by pulling back alonga morphism f : Y → X has a right adjoint. The idea is to think of each object X ofa locally cartesian closed category C as a closed type, each morphism as a term, andeach object of the slice category C /X as a type dependent upon X . Now substitution ofterms in types may be interpreted by pullback between the slices of C ; dependent sumand product types by left and right adjoints to pullback; and the equality type on X bythe diagonal morphism ∆ : X → X × X in C /X × X . It was later pointed out in [16]that this picture, whilst very appealing, is not wholly accurate, since in the syntax,the operation which to each morphism of types f : Y → X assigns the correspondingsubstitution operation Type ( X ) → Type ( Y ) is strictly functorial in f ; whilst in thesemantics, the corresponding assignation ( f : Y → X ) ( f ∗ : C /X → C /Y ) is rarelyso. Thus this notion of model is not sound for the syntax, and we are forced to refineit slightly: essentially by equipping our locally cartesian closed category with a splitfibration T → C equivalent to its codomain fibration C → C . Types over X are nowinterpreted as objects of the fibre category T ( X ); and since T → C is a split fibration,the interpretation is sound for substitution.The question of how the above should generalise from extensional to intensional Martin-L¨of type theory is a delicate one. It is possible to paraphrase the syntax of intensionaltype theory in categorical language and so arrive at a notion of model—as done in [6]or [15], for example—but then we lose sight of a key aspect of the extensional semantics,namely that dependent sums and products may be characterised universally, as left andright adjoints to substitution. To obtain a similar result for the intensional theory requiresa more refined sort of semantics. More specifically, we are thinking of a semantics valuedin higher-dimensional categories, motivated by work such as [2, 9, 17] which identifies in
Date : 11 September 2008; Revised 21 January 2009.Supported by a Research Fellowship of St John’s College, Cambridge and a Marie Curie Intra-European Fellowship, Project No. 040802. intensional type theory certain higher-dimensional features. The idea is that, in such asemantics, we should be able to characterise dependent sums and products universallyin terms of weak, higher-dimensional adjoints to substitution.Eventually we expect to be able to construct a sound and complete semantics forintensional type theory valued in weak ω -categories. At the moment the theory of weak ω -categories is insufficiently well-developed for us to describe this semantics; yet wecan at least take steps towards it, by describing semantics valued in simpler kinds ofhigher-dimensional category. In this paper, we describe such a semantics valued in 2-categories; which, as well as objects representing types, and morphisms f : X → Y representing terms, has 2-cells α : f ⇒ g representing witnesses for the propositionalequality of terms f and g . Intuitively, the 2-categorical models we consider provide anotion of two-dimensional locally cartesian closed category; though bearing in mind theabove concerns regarding the functoriality of substitution, it is in fact a “split” notionof two-dimensional model which we will describe here. Relating this to a notion of two-dimensional local cartesian closed category will require a 2-categorical coherence resultalong the lines of [16], and we defer this to a subsequent paper.Our 2-categorical semantics is sound and complete neither for intensional nor exten-sional type theory, but rather for an intermediate theory which we call two-dimensionaltype theory . Recall that extensional type theory distinguishes itself from intensional typetheory by its admission of an equality reflection rule , which states that any two terms oftype A which are propositionally equal, are also definitionally equal. The two-dimensionaltype theory that we will consider admits instances of the equality reflection rule at justthose types which are themselves identity types. The effect this has is to collapse thehigher-dimensional aspects of the intensional theory, but only above dimension two: andit is this which allows a complete semantics in 2-categories. The leading example ofmodel for our semantics is the groupoid model of [17]; indeed, it plays the same funda-mental role for two-dimensional type theory as the Set -based model does for extensionaltype theory. However, we expect there to be many more examples: on the categoricalside, prestack and stack models, which will provide two-dimensional analogues of the presheaf and sheaf models of extensional type theory; and on the type-theoretic side, an E -groupoid model [1], which extends to two dimensions the setoid model of extensionaltype theory [14]. Once again, the task of describing these models will be deferred to asubsequent paper.Our hope is that the semantics we describe in this paper will provide a useful guide insetting up more elaborate semantics for intensional type theory: both of the ω -categoricalkind outlined above, and of the homotopy-theoretic kind espoused in [2]. Indeed, mostof the problematic features of these higher-dimensional semantics are fully alive in thetwo-dimensional case—in particular, the rather subtle issues regarding stability of struc-ture under substitution—and the analysis we give of them here should prove useful inunderstanding these more general situations.The paper is set out as follows. In Section 2, we review the syntax of intensionaland extensional Martin-L¨of type theory and describe our intermediate two-dimensionaltheory, ML . In Sections 3 and 4 we describe a 2-categorical structure built from thesyntax of ML . Section 3 makes use of the non-logical rules of ML together with therules for identity types in order to construct a 2-category C of contexts; a two-dimensionalfibration T → C of types over contexts; and a comprehension 2-functor E : T → C ,sending each type-in-context Γ ⊢ A type to the corresponding dependent projection map WO-DIMENSIONAL MODELS OF TYPE THEORY 3 (Γ , x : A ) → Γ. So far we have given nothing more than a simple-minded extensionof the one-dimensional semantics; the twist is that each dependent projection in our 2-categorical model carries the structure of a normal isofibration . This can be seen as thesemantic correlate of the
Leibniz rule in dependent type theory. Section 4 considers theextra structure imposed on this basic framework by the logical rules of ML . The identitytypes are characterised as arrow objects in the slices of the 2-category of contexts; whilstthe unit type, dependent sums and dependent products admit description in terms ofa notion of weak 2-categorical adjointness which we call retract biadjunction . Where aplain adjunction concerns itself with isomorphisms of hom-sets C ( F X, Y ) ∼ = D ( X, GY ), aretract biadjunction instead requires retract equivalences of hom-categories C ( F X, Y ) ≃ D ( X, GY ). In particular, dependent sums and products are characterised as left andright retract biadjoints to weakening. These syntactic investigations lead us to definea notion of model for two-dimensional type theory, this being an arbitrary 2-fibration T → C equipped with the structure outlined above; and the results of Sections 3 and 4can be summarised as saying that to each type theory S extending ML we may assign a classifying two-dimensional model C (S). In Section 5, we provide a converse to this resultby showing that to each two-dimensional model C we can assign a two-dimensional typetheory S( C ) which represents the model faithfully. We call this type theory the internallanguage of C . Finally, we show that these two constructions—classifying model andinternal language—give rise to a functorial semantics in the sense of [24]: which is to saythat they induce an equivalence between suitably defined categories of two-dimensionaltype theories, and of two-dimensional models. Acknowledgements
The author thanks the anonymous referees for their helpfulsuggestions.2.
Intensional, extensional and two-dimensional type theory
Intensional type theory. By intensional Martin-L¨of type theory , we mean thelogical calculus set out in Part II of [25]. In this paper, we consider only the core calculusML I , with type-formers for dependent sums, dependent products, identity types and theunit type. We now summarise this calculus, partly to fix notation and partly becausethere are few peculiarities which are worth commenting on. The calculus has four basicforms of judgement: A type (“ A is a type”); a : A (“ a is an element of the type A ”); A = B type (“ A and B are definitionally equal types”); and a = b : A (“ a and b aredefinitionally equal elements of the type A ”). These judgements may be made eitherabsolutely, or relative to a context Γ of assumptions, in which case we write them asΓ ⊢ A type , Γ ⊢ a : A , Γ ⊢ A = B type and Γ ⊢ a = b : A respectively. Here, a context is a list Γ = ( x : A , x : A , . . . , x n : A n ), wherein each A i is a type relative to the context ( x : A , . . . , x i − : A i − ). There are now somerather natural requirements for well-formed judgements: in order to assert that a : A wemust first know that A type ; to assert that A = B type we must first know that A type and B type ; and so on. We specify intensional Martin-L¨of type theory as a collectionof inference rules over these forms of judgement. Firstly we have the equality rules ,which assert that the two judgement forms A = B type and a = b : A are congruenceswith respect to all the other operations of the theory; then we have the structural rules , RICHARD GARNER which deal with weakening, contraction, exchange and substitution ; and finally, the logical rules , which we list in Table 1. Note that we commit the usual abuse of notationin leaving implicit an ambient context Γ common to the premisses and conclusions ofeach rule. We also omit the rules expressing stability under substitution in this ambientcontext. We will find it convenient to use the following extended forms of the identityelimination and computation rules:(1) x, y : A, p : Id A ( x, y ) , ∆ ⊢ C ( x, y, p ) type x : A, ∆[ x, x, r( x ) /x, y, p ] ⊢ d ( x ) : C ( x, x, r( x )) x, y : A, p : Id A ( x, y ) , ∆ ⊢ J d ( x, y, p ) : C ( x, y, p ) x, y : A, p : Id A ( x, y ) , ∆ ⊢ C ( x, y, p ) type x : A, ∆[ x, x, r( x ) /x, y, p ] ⊢ d ( x ) : C ( x, x, r( x )) x : A, ∆[ x, x, r( x ) /x, y, p ] ⊢ J d ( x, x, r( x )) = d ( x ) : C ( x, x, r( x ))These rules may be derived from the elimination and computation rules in Table 1 byusing the Π-types to shift the additional contextual parameter ∆ onto the right-handside of the turnstile. Notation . We may omit from the premisses of a rule or deduction any hypothesiswhich may be inferred from later hypotheses of that rule. Where it improves claritywe may omit brackets in function applications, writing hgf x in place of h ( g ( f ( x ))), forexample. We may drop the subscript A in an identity type Id A ( a, b ) where no confusionseems likely to occur. We may write a sum type Σ x : A. B ( x ) as Σ( A, B ), a product typeΠ x : A. B ( x ) as Π( A, B ), and a λ -abstraction λx. f ( x ) as λ ( f ) (or using our applicativeconvention, simply λf ). It will occasionally be useful to perform lambda-abstraction atthe meta-theoretic level, for instance writing [ x ] f ( x ) to denote a term f of the form x : A ⊢ f ( x ) : B ( x ). We may write Γ ⊢ a ≈ b : A to indicate that the type Γ ⊢ Id A ( a, b )is inhabited, and say that a and b are propositionally equal . We will also make use of vector notation in the style of [4]. Given a context Γ = ( x : A , . . . , x n : A n ), we mayabbreviate a series of judgements: ⊢ a : A , ⊢ a : A ( a ), . . . ⊢ a n : A n ( a , . . . , a n − ),as ⊢ a : Γ, where a := ( a , . . . , a n ), and say that a is a global element of Γ. We mayalso use this notation to abbreviate sequences of hypothetical elements on the left-handside of the turnstile; so, for example, we may specify a dependent type in context Γ as x : Γ ⊢ A ( x ) type . We will also make use of [4]’s notion of telescope . Given Γ a contextas before, this allows us to abbreviate the series of judgements x : Γ ⊢ B ( x ) type , x : Γ , y : B ⊢ B ( x, y ) type , . . .x : Γ , y : B , . . . , y m − : B m − ⊢ B m ( x, y , . . . y m − ) type .as x : Γ ⊢ ∆( x ) ctxt , where ∆( x ) := ( y : B ( x ) , y : B ( x, y ) , . . . ). We say that ∆is a context in context Γ, or a context dependent upon
Γ, and refer to contexts like ∆ as Note in particular that we take substitution to be a primitive , rather than a derived operation: asdone in [20], for instance.
WO-DIMENSIONAL MODELS OF TYPE THEORY 5
Dependent sum types A type x : A ⊢ B ( x ) type Σ x : A. B ( x ) type Σ -form; a : A b : B ( a ) h a, b i : Σ x : A. B ( x ) Σ -intro; z : Σ x : A. B ( x ) ⊢ C ( z ) type x : A, y : B ( x ) ⊢ d ( x, y ) : C ( h x, y i ) z : Σ x : A. B ( x ) ⊢ E d ( z ) : C ( z ) Σ -elim; z : Σ x : A. B ( x ) ⊢ C ( z ) type x : A, y : B ( x ) ⊢ d ( x, y ) : C ( h x, y i ) x : A, y : B ( x ) ⊢ E d ( h x, y i ) = d ( x, y ) : C ( h x, y i ) Σ -comp. Unit type type -form; ⋆ : -intro; z : ⊢ C ( z ) type d : C ( ⋆ ) z : ⊢ U d ( z ) : C ( z ) -elim; z : ⊢ C ( z ) type d : C ( ⋆ )U d ( ⋆ ) = d : C ( ⋆ ) -comp. Identity types A type a, b : A Id A ( a, b ) type Id -form; A type a : A r( a ) : Id A ( a, a ) Id -intro; x, y : A, p : Id A ( x, y ) ⊢ C ( x, y, p ) type x : A ⊢ d ( x ) : C ( x, x, r( x )) x, y : A, p : Id A ( x, y ) ⊢ J d ( x, y, p ) : C ( x, y, p ) Id -elim; x, y : A, p : Id A ( x, y ) ⊢ C ( x, y, p ) type x : A ⊢ d ( x ) : C ( x, x, r( x )) x : A ⊢ J d ( x, x, r( x )) = d ( x ) : C ( x, x, r( x )) Id -comp. Dependent product types A type x : A ⊢ B ( x ) type Π x : A. B ( x ) type Π -form; x : A ⊢ f ( x ) : B ( x ) λx. f ( x ) : Π x : A. B ( x ) Π -abs; m : Π x : A. B ( x ) y : A ⊢ m · y : B ( y ) Π -app; x : A ⊢ f ( x ) : B ( x ) y : A ⊢ (cid:0) λx. f ( x ) (cid:1) · y = f ( y ) : B ( y ) Π - β . Table 1.
Logical rules of intensional Martin-L¨of type theory (ML I ) RICHARD GARNER dependent contexts , and to those like Γ as closed contexts . Given a dependent context x : Γ ⊢ ∆( x ) ctxt , we may abbreviate the series of judgements x : Γ ⊢ f ( x ) : B ( x ) . . .x : Γ ⊢ f m ( x ) : B m ( x, f ( x ) , . . . , f m − ( x )),as x : Γ ⊢ f ( x ) : ∆( x ), and say that f is a dependent element of ∆. We can similarlyassign a meaning to the judgements x : Γ ⊢ ∆( x ) = Θ( x ) ctxt and x : Γ ⊢ f ( x ) = g ( x ) :∆( x ), expressing the definitional equality of two dependent contexts, and the definitionalequality of two dependent elements of a dependent context.2.2. Extensional type theory.
We obtain extensional Martin-L¨of type theory ML E by augmenting the intensional theory with the two equality reflection rules : a, b : A α : Id ( a, b ) a = b : A a, b : A α : Id ( a, b ) α = r( a ) : Id ( a, b )together with the rule of function extensionality : m, n : Π( A, B ) x : A ⊢ m · x = n · xm = n : Π( A, B ) .The addition of these three rules yields a type theory which is intuitively simpler, andmore natural from the perspective of categorical models, but proof-theoretically unpleas-ant: we lose the decidability of definitional equality and the decidability of type-checking.Note that if one develops Martin-L¨of type theory in a framework admitting higher-orderinference rules (such as the Logical Framework of [25]) then the above three rules areequipotent with the definitional η -rule.2.3. Two-dimensional type theory.
The type theory we investigate in this paper liesbetween the intensional theory of § § , and call it two-dimensional type theory , because as we will see, it has a naturalsemantics in two-dimensional categories. It is obtained by augmenting intensional typetheory with the rules of Tables 2 and 3. These provide restricted versions of the equalityreflection rules (Table 2) and the function extensionality rules (Table 3). To motivatethe rules in Table 2, we introduce the notion of a discrete type. We say that Γ ⊢ A type is discrete if the judgementsΓ ⊢ a, b : A Γ ⊢ p : Id ( a, b )Γ ⊢ a = b : A Id -refl - A ; Γ ⊢ a, b : A Γ ⊢ p : Id ( a, b )Γ ⊢ p = r( a ) : Id ( a, b ) Id -refl - A are derivable. Thus the intensional theory says that no types need be discrete; theextensional theory says that all types are discrete; and the two-dimensional theory saysthat all identity types are discrete. Note that although two-dimensional type theorysuffers from the same proof-theoretic deficiencies of the extensional theory, it does soin a less severe manner: indeed, only those types of ML in whose construction theidentity types have been used will have undecidable definitional equality. As we ascendto higher-dimensional variants of type theory, this undecidability will be pushed further WO-DIMENSIONAL MODELS OF TYPE THEORY 7 a, b : A p, q : Id ( a, b ) α : Id ( p, q ) p = q : Id ( a, b ) Id -disc ; a, b : A p, q : Id ( a, b ) α : Id ( p, q ) α = r( p ) : Id ( p, q ) Id -disc . Table 2.
Rules for discrete identity types m, n : Π(
A, B ) x : A ⊢ p ( x ) : Id ( m · x, n · x ) ext ( m, n, p ) : Id ( m, n ) Π -ext; m : Π( A, B ) ext ( m, m, [ x ] r( m · x )) = r( m ) : Id ( m, m ) Π -ext-comp; m, n : Π( A, B ) x : A ⊢ p ( x ) : Id ( m · x, n · x ) x : A ⊢ ext ( m, n, p ) ∗ x = p ( x ) : Id ( m · x, n · x ) Π -ext-app. Table 3.
Rules for function extensionalityand further up the hierarchy of iterated identity types; but it is only in the limit—whichis intensional type theory—that we regain complete decidability.The necessity of the rules in Table 3 will become clear when we reach § § ∗ appearing in it. It is a definable constant which expresses that two propositionallyequal elements of a Π-type are pointwise propositionally equal. Explicitly, it satisfies thefollowing introduction and computation rules: m, n : Π( A, B ) p : Id ( m, n ) a : Ap ∗ a : Id ( m · a, n · a ) ∗ -intro; m : Π( A, B ) a : A r( m ) ∗ a = r( m · a ) : Id ( m · a, m · a ) ∗ -comp; and we may define it by Id -elimination, taking p ∗ a := J [ x ]r( x · a ) ( m, n, p ).3. Categorical models for ML : structural aspects The remainder of this paper will describe a notion of categorical semantics for ML .In this section and the following one, we define a syntactic category and enumerate itsstructure; whilst in Section 5, we consider an arbitrary category endowed with this samestructure, and derive from it a type theory incorporating the rules of ML . This yields RICHARD GARNER a semantics which is both complete and sound. In this section, we define the basic syn-tactic category and look at the structure induced on it by the non-logical rules of ML .In the next section, we consider the logical rules. As mentioned in the Introduction, thesyntactic category we define will in fact be a 2 -category , whose objects will be (vectorsof) types; whose morphisms will be (vectors) of terms between those types; and whose 2-cells will be (vectors of) identity proofs between these terms. The various forms of 2-cellcomposition will be obtained using the identity elimination rules; whilst the rules for dis-crete identity types given in Table 2 ensure that these compositions satisfy the 2-categoryaxioms. For basic terminology and notation relating to 2-categories we refer to [23].3.1. One-dimensional semantics of type dependency.
We begin by recalling theconstruction of a one-dimensional categorical structure from the syntax of a dependenttype theory. The presentation we have chosen follows [19] in its use of (full) compre-hension categories . There are various other, essentially equivalent, presentations thatwe could have used: see [5, 6, 7, 18, 29] for example. We use comprehension categoriesbecause they afford a straightforward passage to a two-dimensional structure.So suppose given an arbitrary dependently-typed calculus S admitting the same fourbasic judgement types and the same structural rules as the calculus ML I . We define its category of contexts C S to have as objects, contexts Γ, ∆, . . . , in S, considered modulo α -conversion and definitional equality (so we identify Γ and ∆ whenever ⊢ Γ = ∆ ctxt isderivable); and as morphisms Γ → ∆, judgements x : Γ ⊢ f ( x ) : ∆, considered modulo α -conversion and definitional equality (so we identity f, g : Γ → ∆ whenever x : Γ ⊢ f ( x ) = g ( x ) is derivable). To avoid further repetition, we introduce the conventionthat any further categorical structures we define should also be interpreted modulo α -equivalence and definitional equality. The identity map on Γ is given by x : Γ ⊢ x : Γ;whilst composition is given by substitution of terms. Note that C S has a terminal object,given by the empty context ( ).For each context Γ we now define the category T S (Γ) of types-in-context- Γ, whoseobjects A are judgements x : Γ ⊢ A ( x ) type and whose morphisms A → B are judgements x : Γ , y : A ( x ) ⊢ f ( x, y ) : B ( x ). Each morphism f : Γ → ∆ of C S induces a functor T S ( f ) : T S (∆) → T S (Γ) which sends a type A in context ∆ to the type f ∗ A in contextΓ given by x : Γ ⊢ A ( f ( x )) type . The assignation f
7→ T S ( f ) is itself functorial in f ,and so we obtain an indexed category T S (–) : C opS → Cat ; which via the Grothendieckconstruction, we may equally well view as a split fibration p : T S → C S . We refer to thisas the fibration of types over contexts .Explicitly, objects of T S are pairs (Γ , A ) of a context and a type in that context; whilstmorphisms (Γ , A ) → (∆ , B ) are pairs ( f, g ) of a context morphism f : Γ → ∆ togetherwith a judgement x : Γ , y : A ( x ) ⊢ g ( x, y ) : B ( f ( x )). The chosen cartesian lifting of amorphism f : Γ → ∆ at an object (∆ , B ) is given by ( f, ι ) : (Γ , f ∗ B ) → (∆ , B ), where ι denotes the judgement x : Γ , y : B ( f x ) ⊢ y : B ( f x ). Now, for each object (Γ , A )of T S we have the extended context (cid:0) x : Γ , y : A ( x ) (cid:1) , which we denote by Γ .A ; and wealso have the judgement x : Γ , y : A ( x ) ⊢ x : Γ, corresponding to a context mor-phism π A : Γ .A → Γ which we call the dependent projection associated to A . In fact,the assignation (Γ , A ) π A provides the action on objects of a functor E : T S → C S (where denotes the arrow category 0 → WO-DIMENSIONAL MODELS OF TYPE THEORY 9 ( f, g ) : (Γ , A ) → (∆ , B ) of T S to the morphism(2) Γ .A π A f.g ∆ .B π B Γ f ∆of C S , where f.g denotes the judgement x : Γ , y : A ⊢ ( f ( x ) , g ( x, y )) : ∆ .B .We can make two observations about this functor E . Firstly, it is fully faithful, whichsays that every morphism h : Γ .A → ∆ .B fitting into a square like (2) is of the form f.g fora unique ( f, g ) : (Γ , A ) → (∆ , B ). Secondly, for a cartesian morphism ( f, ι ) : (Γ , f ∗ B ) → (∆ , B ), the corresponding square (2) is a pullback square. Indeed, given an arbitrarycommutative square Λ h k ∆ .B π ∆ Γ f ∆,commutativity forces k to be of the form z : Λ ⊢ ( f hz, k ′ z ) : ∆ .B for some z : Λ ⊢ k ′ ( z ) : B ( f hz ); and so the required factorisation Λ → Γ .f ∗ B is given by the judgement z : Λ ⊢ ( hz, k ′ z ) : Γ .f ∗ B . We may abstract away from the above situation as follows.We define a full split comprehension category (cf. [19]) to be given by a category C with aspecified terminal object, together with a split fibration p : T → C and a full and faithfulfunctor E : T → C rendering commutative the triangle T p E C cod C ,and sending cartesian morphisms in T to pullback squares in C . The preceding discus-sion shows that to any suitable dependent type theory S we may associate a full splitcomprehension category C (S), which we will refer to as the classifying comprehensioncategory of S. Notation . We will make use of the notation developed above in arbitrary compre-hension categories ( p : T → C , E : T → C ). Thus we write chosen cartesian liftings as( f, ι ) : (Γ , f ∗ B ) → (∆ , B ), and write the image of (Γ , A ) ∈ T under E as π A : Γ .A → Γ.We will find it convenient to develop a little more notation. Given Γ ∈ C and A ∈ T (Γ),we call a map a : Γ → Γ .A satisfying π A a = id Γ a global section of A , and denote it by a ∈ Γ A . Given further a morphism f : ∆ → Γ of C , we write f ∗ a ∈ ∆ f ∗ A for the section of π f ∗ A induced by the universal property of pullback in the following diagram:(3) ∆ af id ∆ .f ∗ A f.ιπ f ∗ A Γ .A π A ∆ f Γ.3.2. A -category of types. We will now extend the classifying comprehension cate-gory C (S) defined above to a classifying comprehension 2-category. We will not need thefull strength of two-dimensional type theory, ML , for this. Rather, for the rest of thissection we fix an arbitrary dependently typed theory S which admits the structural rulesrequired in the previous subsection together with the identity type rules from Table 1and the discrete identity rules of Table 2. Our first task will be to construct a 2-categoryof closed types in S. We will do this by enriching the category T S ( ) of closed types with2-cells derived from the 2-category of strict internal groupoids in S. A strict internalgroupoid in S is given by a closed type A ; a family A ( x, y ) of types over x, y : A ; andoperations of unit, composition and inverse: x : A ⊢ id x : A ( x, x ) x, y, z : A , p : A ( x, y ) , q : A ( y, z ) ⊢ q ◦ p : A ( x, z ), x, y : A , p : A ( x, y ) ⊢ p − : A ( y, x ),which obey the usual five groupoid axioms up to definitional equality. For instance, theleft unit axiom requires that x, y : A , p : A ( x, y ) ⊢ id y ◦ p = p : A ( x, y )should hold. We will generally write that ( A , A ) is an internal groupoid in S, leavingthe remaining structure understood. Now an internal functor F : ( A , A ) → ( B , B )between internal groupoids is given by judgements x : A ⊢ F ( x ) : B x, y : A , p : A ( x, y ) ⊢ F ( p ) : B ( F x, F y ),subject to the usual two functoriality axioms (up to definitional equality again); whilstan internal natural transformation α : F ⇒ G is given by a family of components x : A ⊢ α ( x ) : B ( F x, G x ) subject to the (definitional) naturality axiom. Proposition 3.2.1.
The strict groupoids, functors and natural transformations internalto S form a -category Gpd (S) which is locally groupoidal , in the sense that every -cellis invertible.Proof. Recall that for any category E , we can define a 2-category Gpd ( E ) of groupoidsinternal to that category . In particular, we have the 2-category Gpd ( C S ) of groupoidsinternal to the category of contexts of S. Now, each strict internal groupoid A in S givesrise to such an internal groupoid A ′ in C S whose object of objects is the context ( x : A )and whose object of morphisms is the context ( x : A , y : A , p : A ( x, y )). We can check One commonly requires the category E to have pullbacks, but this is inessential. WO-DIMENSIONAL MODELS OF TYPE THEORY 11 that internal functors
A → B in S correspond bijectively with internal functors A ′ → B ′ in C S ; and that this correspondence extends to the natural transformations betweenthem. Thus we may take Gpd (S) to be the 2-category whose objects are strict internalgroupoids in S, whose hom-categories are given by
Gpd (S)( A , B ) := Gpd ( C S )( A ′ , B ′ ),and whose remaining structure is inherited from Gpd ( C S ). Note that every 2-cell of Gpd ( C S ) is invertible, so that the same obtains for Gpd (S) (cid:3)
Our method for obtaining the 2-category of closed types will be to construct a functor T S ( ) → Gpd (S), and to lift the 2-cell structure of
Gpd (S) along it.
Proposition 3.2.2.
To each closed type A in S we may assign a strict internal groupoid ( A, Id A ) ; and the assignation A ( A, Id A ) underlies a functor T S ( ) → Gpd (S) .Proof.
The proof of this result is essentially due to [17]. We repeat it because we will needthe details. We first show that ( A, Id A ) has the structure of a strict internal groupoid.For identities, we take x : A ⊢ id x := r( x ) : Id ( x, x ). For composition, we require ajudgement x, y, z : A, p : Id ( x, y ) , q : Id ( y, z ) ⊢ q ◦ p : Id ( x, z );and by Id -elimination on p —in the extended form given in equation (1)—it suffices todefine this when y = z and q = r ( y ), for which we take r ( y ) ◦ p := p . Similarly, to givethe judgement x, y : A, p : Id ( x, y ) ⊢ p − : Id ( y, x )providing inverses, it suffices to consider the case x = y and p = r( x ); for which we taker( x ) − = r( x ). We must now check the five groupoid axioms. The first unitality axiomid y ◦ p = p follows from the Id -computation rule. For the other unitality axiom, it suffices,by discrete identity types, to show that x, y : A, p : Id ( x, y ) ⊢ p ◦ r( x ) ≈ p : Id ( x, y )holds; and by Id -elimination, it suffices to do this in the case x = y and p = r( x ), forwhich we have that r( x ) ◦ r( x ) = r( x ) as required. Likewise, for the associativity axiom,it suffices to show that w, x, y, z : A, p : Id ( w, x ) , q : Id ( x, y ) , s : Id ( y, z ) ⊢ s ◦ ( q ◦ p ) ≈ ( s ◦ q ) ◦ p : Id ( w, z );and again by Id -elimination, it suffices to do this when y = z and s = r( y ), when havethat r( y ) ◦ ( q ◦ p ) = q ◦ p = (r( y ) ◦ q ) ◦ p as required. Note that again, we require theextended form of Id -elimination of equation (1), and in future we will use this withoutfurther comment. The invertibility axioms are similar. Suppose now that in addition to A we are given another type B together with a judgement x : A ⊢ f ( x ) : B betweenthem. We will extend this to an internal functor ( f, f • ) : ( A, Id A ) → ( B, Id B ). We definethe action on hom-types x, y : A, p : Id ( x, y ) ⊢ f • ( p ) : Id ( f x, f y )by Id -elimination on p : for when x = y and p = r( x ), we may take f • (r( x )) := r( f ( x )).We must now check the functoriality axioms. That ( f, f • ) preserves identities followsfrom the Id -computation rule; whilst to to show that it preserves binary composition, itsuffices by discrete identity types to show that x, y, z : A, p : Id ( x, y ) , q : Id ( y, z ) ⊢ f • ( q ◦ p ) ≈ f • ( q ) ◦ f • ( p ) : Id ( f x, f z ) holds; and this follows by Id -elimination on q , since when y = z and q = r ( y ), we havethat f • (r( y ) ◦ p ) = f • ( p ) = r( f ( y )) ◦ f • ( p ) = f • (r( y )) ◦ f • ( p ) as required. We mustnow check that the assignation f ( f, f • ) is itself functorial. To show that it preservesidentities, we must show that for any closed type A , x, y : A, p : Id ( x, y ) ⊢ (id A ) • ( p ) = p : Id ( x, y )holds. By discrete identity types, it suffices to show this up to mere propositional equality;and by Id -elimination, we need only do so in the case when x = y and p = r( x ), when wehave that (id A ) • (r( x )) = r(id A ( x )) = r( x ) as required. To show that f ( f, f • ) respectscomposition, we must show that for maps of closed types f : A → B and g : B → C , thejudgement x, y : A, p : Id ( x, y ) ⊢ ( gf ) • ( p ) = g • ( f • ( p )) : Id ( gf x, gf y )holds. Again, it suffices to do this only up to propositional equality, and this only inthe case where x = y and p = r( x ); whereupon we have that ( gf ) • (r( x )) = r( g ( f ( x ))) = g • (r( f ( x )) = g • ( f • (r( x )) as required. (cid:3) Corollary 3.2.3.
The category T S ( ) of closed types in S may be extended to a locallygroupoidal -category T S ( ) whose -cells α : f ⇒ g : A → B are judgements x : A ⊢ α ( x ) : Id B ( f x, gx ) .Proof. If we view T S ( ) as a 2-category with only identity 2-cells, then the functor of theprevious proposition may be seen as a 2-functor T S ( ) → Gpd (S). We can factorise this2-functor as a composite T S ( ) → T S ( ) → Gpd (S),whose first part is bijective on objects and 1-cells and whose second part is fully faithful on2-cells; and we now define T S ( ) to be the intermediate 2-category in this factorisation.We must check that this definition agrees with the description of T S ( ) given above.Clearly this is so for the objects and morphisms; whilst for the 2-cells, we must showthat for any f, g : A → B , each judgement x : A ⊢ α ( x ) : Id B ( f x, gx ) satisfies the axiomfor an internal natural transformation α : ( f, f • ) ⇒ ( g, g • ). By discrete identity types,this amounts to validating the judgement x, y : A, p : Id A ( x, y ) ⊢ g • ( p ) ◦ α ( x ) ≈ α ( y ) ◦ f • ( p ) : Id B ( f x, gy );and by Id -elimination on p , it suffices to do this in the case where x = y and p = r( x ):for which we have that g • (r( x )) ◦ α ( x ) = r( g ( x )) ◦ α ( x ) = α ( x ) = α ( x ) ◦ r( f ( x )) = α ( x ) ◦ f • (r( x )), as required. (cid:3) Corollary 3.2.4.
For any context Γ in S , the category T S (Γ) of types-in-context- Γ may beextended to a locally groupoidal -category T S (Γ) wherein -cells α : f ⇒ g are judgements x : Γ , y : A ⊢ α ( x, y ) : Id B ( f ( x, y ) , g ( x, y )) .Proof. We consider the slice theory S / Γ, whose closed types are the types of S in contextΓ. It is easy to see that S / Γ admits the same inference rules as S—and in particular hasdiscrete identity types—so that the result follows upon identifying T S (Γ) with T S / Γ ( ). (cid:3) WO-DIMENSIONAL MODELS OF TYPE THEORY 13 A -category of contexts. In this section, we generalise the construction of the2-category of closed types in order to construct a 2-category of contexts. The methodwill be a direct transcription of the one used in the previous section, but in order for itto make sense, we need to extend the identity type constructor to a “meta-constructor”which operates on entire contexts rather than single types.
Proposition 3.3.1.
The following inference rules are definable in S . Φ ctxt a, b : Φ Id Φ ( a, b ) ctxt Id -form’; Φ ctxt a : Φr( a ) : Id Φ ( a, a ) Id -intro’; x, y : Φ , p : Id Φ ( x, y ) , ∆ ⊢ Θ( x, y, p ) ctxt x : Φ , ∆[ x, x, r( x ) /x, y, p ] ⊢ d ( x ) : Θ( x, x, r( x )) x, y : Φ , p : Id Φ ( x, y ) , ∆ ⊢ J d ( x, y, p ) : Θ( x, y, p ) Id -elim’; x, y : Φ , p : Id Φ ( x, y ) , ∆ ⊢ Θ( x, y, p ) ctxt x : Φ , ∆[ x, x, r( x ) /x, y, p ] ⊢ d ( x ) : Θ( x, x, r( x )) x : Φ , ∆[ x, x, r( x ) /x, y, p ] ⊢ J d ( x, x, r( x )) = d ( x ) : Θ( x, x, r( x )) Id -comp’. In order to prove this result, we will make use of the following well-known consequenceof the identity type rules:
Proposition 3.3.2 (The Leibniz rule) . Given A type and x : A ⊢ B ( x ) type in S , thefollowing rules are derivable: a , a : A p : Id ( a , a ) b : B ( a ) p ∗ ( b ) : B ( a ) Id -subst; a : A b : B ( a )r( a ) ∗ ( b ) = b : B ( a ) Id -subst-comp. Proof. By Id -elimination on p , it suffices to derive the first rule in the case where a = a and p = r( a ): in which case we can take r( a ) ∗ ( b ) := b . The second rule now followsfrom the Id -computation rule. (cid:3) The key idea behind the proof of Proposition 3.3.1 can be illustrated by consideringa context Φ = ( x : A, y : B ( x )) of length 2. The corresponding identity context Id Φ willbe given by Id Φ (cid:0) ( x, y ) , ( x ′ , y ′ ) (cid:1) := (cid:0) p : Id A ( x, x ′ ) , q : Id B ( x ) ( y, p ∗ y ′ ) (cid:1) .We use substitution along the first component p to make the second component q type-check. This can be seen as a type-theoretic analogue of the Grothendieck constructionfor fibrations. Indeed, it is possible to show that there is a propositional isomorphismbetween this identity context Id Φ and the identity type Id Σ( A,B ) . Thus in principle it isunnecessary to introduce identity contexts; however, we prefer to do so in order to obtaina cleaner separation between the identity rules and the Σ-type rules. Proof of Proposition 3.3.1.
The proof has two stages. First, we define the generalised Id -inference rules in the special case where the context Φ has length 1; and then we usethese to define them in the general case. We will reduce syntactic clutter by proving ourresults only in the case where the postcontext ∆ is empty: the reader may readily supplythe annotations for the general case. For the first part of the proof, we suppose ourselvesgiven a context Φ = ( x : A ) of length 1. The inference rules Id -form’ and Id -intro’ for Φ are just the usual Id -formation and Id -introduction rules for A . However, Id -elim’ corresponds to the following generalised elimination rule:(4) x, y : A, p : Id ( x, y ) ⊢ Θ( x, y, p ) ctxt x : A ⊢ d ( x ) : Θ( x, x, r( x )) x, y : A, p : Id ( x, y ) ⊢ J d ( x, y, p ) : Θ( x, y, p )with Id -comp’ stating that J d ( a, a, r( a )) = d ( a ). We will define the elimination rule byinduction on the length n of the context Θ. When n = 0, this is trivial, and when n = 1,we use the usual identity elimination rule. So suppose now that we have defined the rulefor all contexts Θ of length n , and consider a context x, y : A, p : Id ( x, y ) ⊢ Θ( x, y, p ) ctxt of length n + 1. Thus Θ is of the formΘ( x, y, p ) = ( u : Λ( x, y, p ) , v : D ( x, y, p, u ))for some context Λ of length n and type D . It follows that to make a judgement x : A ⊢ d ( x ) : Θ( x, x, r( x )) is equally well to make a pair of judgements(5) x : A ⊢ d ( x ) : Λ( x, x, r( x )) x : A ⊢ d ( x ) : D (cid:0) x, x, r( x ) , d ( x ) (cid:1) .By the inductive hypothesis, we may apply the elimination rule (4) for the context Λwith eliminating family d to deduce the existence of a term(6) x, y : A, p : Id ( x, y ) ⊢ J d ( x, y, p ) : Λ( x, y, p ),satisfying J d ( x, x, r( x )) = d ( x ). Now we consider the dependent type(7) x, y : A, p : Id ( x, y ) ⊢ C ( x, y, p ) := D ( x, y, p, J d ( x, y, p ) (cid:1) type .We have that C ( x, x, r( x )) = D (cid:0) x, x, r( x ) , J d ( x, x, r( x )) (cid:1) = D (cid:0) x, x, r( x ) , d ( x ) (cid:1) and sofrom (5) we can derive the judgement(8) x : A ⊢ d ( x ) : C (cid:0) x, x, r( x ) (cid:1) .Now applying the standard Id -elimination rule to (7) and (8) yields a judgement(9) x, y : A, p : Id ( x, y ) ⊢ J d ( x, y, p ) : D (cid:0) x, y, p, J d ( x, y, p ) (cid:1) satisfying J d ( x, x, r( x )) = d ( x ). But to give (6) and (9) is equally well to give adependent element x, y : A, p : Id ( x, y ) ⊢ J d ( x, y, p ) : Θ( x, y, p ); and the respectivecomputation rules for J d and J d now imply the computation rule for J d . This completesthe first part of the proof.We now construct the generalised inference rules for an arbitrary context Φ. Onceagain the proof will be by induction, this time on the length of Φ. For the base case,the only context of length 0 is ( ), the empty context. For this, we take the identitycontext Id ( ) also to be the empty context. The introduction rule is vacuous, whilst theelimination rule requires us to provide, for each closed context Θ and global element d : Θ, a global element J d : Θ, satisfying the computation rule J d = d : Θ. Thus wesimply take J d := d and are done. Suppose now that we have defined identity contextsfor all contexts of length n , and consider a context Φ = (cid:0) x : Λ , x : D ( x ) (cid:1) of length n + 1. In order to define Id Φ , we first apply the inductive hypothesis to Λ in order todefine its Leibniz rule. Thus given x : Λ ⊢ Υ( x ) ctxt , we may define a judgement x, y : Λ , p : Id Λ ( x, y ) , z : Υ( y ) ⊢ p ∗ ( z ) : Υ( x ), WO-DIMENSIONAL MODELS OF TYPE THEORY 15 satisfying r( x ) ∗ ( z ) = z : Υ( x ). The proof is as in Proposition 3.3.2. Now, to give theformation rule for Id Φ is equally well to give a judgement x : Λ , y : D ( x ) , x : Λ , y : D ( x ) ⊢ Id Φ ( x , y , x , y ) ctxt ,which we do by setting Id Φ ( x , y , x , y ) := (cid:0) p : Id Λ ( x , x ) , q : Id D ( x ) ( y , p ∗ y ) (cid:1) .Next, to define the introduction rule for Id Φ is equally well to give judgements x : Λ , y : D ( x ) ⊢ r ( x, y ) : Id Λ ( x, x ) x : Λ , y : D ( x ) ⊢ r ( x, y ) : Id D ( x ) (cid:0) y, r ( x, y ) ∗ ( y ) (cid:1) which we do by setting r ( x, y ) := r( x ) and r ( x, y ) := r( y ), where for the second ofthese we make use of the fact that Id D ( x ) (cid:0) y, r( x ) ∗ ( y ) (cid:1) = Id D ( x ) ( y, y ). In order to definethe elimination rule for Id Φ , we first define a context dependent on x , x : Λ and p : Id Λ ( x , x ) by∆( x , x , p ) := (cid:0) y : D ( x ) , y : D ( x ) , q : Id D ( x ) ( y , p ∗ y ) (cid:1) .We may then write the premisses of the elimination rule for Id Φ as:(10) x , x : Λ , p : Id Λ ( x , x ) , z : ∆( x , x , p ) ⊢ Θ( x , x , p, z ) ctxt and(11) x : Λ , y : D ( x ) ⊢ d ( x, y ) : Θ( x, x, r( x ) , y, y, r( y )).We would like to apply the elimination rule for Id Λ (with postcontext ∆) to equation(10). In order to do so, we need to exhibit a generating family(12) x : Λ , z : ∆( x, x, r( x )) ⊢ d ′ ( x, z ) : Θ( x, x, r( x ) , z );which is equivalently a family x : Λ , y , y : D ( x ) , q : Id D ( x ) ( y , y ) ⊢ d ′ ( x, y , y , q ) : Θ( x, x, r( x ) , y , y , q )since we have that r( x ) ∗ ( y ) = y . But we may obtain such a family by applying thegeneralised elimination rule (4) for Id D ( x ) to the dependent context x : Λ , y , y : D ( x ) , q : Id D ( x ) ( y , y ) ⊢ Θ( x, x, r( x ) , y , y , q ) ctxt with eliminating family (11). This yields a judgement (12) as required, whilst the com-putation rule says that d ′ ( x, y, y, r( y )) = d ( x, y ). Now applying the elimination rule for Id Λ to (10) and (12) yields a judgement x , x : Λ , p : Id Λ ( x , x ) , z : ∆( x , x , p ) ⊢ J d ′ ( x , x , p, z ) : Θ( x , x , p, z ),of the correct form to provide the conclusion of the elimination rule for Id Φ . From thecomputation rule for Id Λ , this will satisfy J d ′ ( x, x, r( x ) , z ) = d ′ ( x, z ), and so in particular,we obtain that J d ′ ( x, x, r( x ) , y, y, r( y )) = d ′ ( x, y, y, r( y )) = d ( x, y )which gives us the computation rule for Id Φ . (cid:3) Using Proposition 3.3.1 we can now construct the 2-category of contexts in S bymimicking the developments of § strict groupoid context in S to begiven by a context Γ together with a dependent family x, y : Γ ⊢ Γ ( x, y ) ctxt of hom-contexts, and operations of unit, composition and inverse satisfying the groupoid axiomsas before. It is still the case that any groupoid context induces an internal groupoidobject in the category of contexts C S ; and so with the obvious definition of functor andnatural transformation, we obtain a 2-category GpdCtxt (S) of groupoid contexts inS. Following Proposition 3.2.2, we now define a functor C S → GpdCtxt (S) sending Γto (Γ , Id Γ ). A small subtlety we must check in order for this to go through is that Shas not only discrete identity types, but also discrete identity contexts ; and this followsby a straightforward induction on the length of a context. Thereafter, the argument ofProposition 3.2.3 carries over to give: Corollary 3.3.3.
The category C S of contexts in S may be extended to a locally groupoidal -category C S whose -cells α : f ⇒ g : Γ → ∆ are judgements x : Γ ⊢ α ( x ) : Id ∆ ( f x, gx ) . We end this section with a simple observation:
Proposition 3.3.4.
The -category C S has a -terminal object given by the empty context ( ) .Proof. It is clear that every context Γ admits a unique morphism ! : Γ → ( ), whichmakes ( ) a terminal object. For it to be 2-terminal, we must also show that for any2-cell α : ! ⇒ ! : Γ → ( ) we have α = id ! . But this follows because we defined Id ( ) := ( )in the proof of Proposition 3.3.1. (cid:3) A -fibration of types over contexts. The next stage in our development willbe to extend the fibration of types over contexts to a 2-fibration of types over contexts.In § T S (–) : C coopS → Gray , where
Gray is the tricategory of 2-categories, 2-functors, pseudo-natural transformations, andmodifications; see [11]) that it is that it is significantly less work to construct the asso-ciated 2-fibration directly. We begin by recalling from [13] the definition of 2-fibration.Of the several equivalent formulations given there, the most convenient for our purposesis the following:
Definition 3.4.1. (cf. [13, Theorem 2.8]) Let E and B be 2-categories. We say that a2-functor p : E → B is a cloven -fibration if the following four conditions are satisfied:(i) The underlying ordinary functor of p is a cloven fibration of categories;(ii) Each cartesian 1-cell f : y → z of E has the following two-dimensional universalproperty: that whenever we are given a 2-cell α : g ⇒ h : x → z of E together witha factorisation p ( α ) = p ( x ) kl γ p ( y ) p ( f ) p ( z ), WO-DIMENSIONAL MODELS OF TYPE THEORY 17 we may lift this to a unique factorisation α = x k ′ l ′ γ ′ y f z satisfying p ( γ ′ ) = γ .(iii) For each x, y ∈ E , the induced functor p x,y : E ( x, y ) → B ( px, py ) is a cloven fibra-tion of categories;(iv) For each x, y, z ∈ E and f : x → y , the functor (–) · f : E ( y, z ) → E ( x, z ) preservescartesian liftings of 2-cells.We say further that a cloven 2-fibration is globally split if its underlying fibration ofcategories in (i) is a split fibration.We will now show that the split fibration p : T S → C S of types over contexts extendsto a globally split 2-fibration p : T S → C S . The first step will be to construct the total2-category T S . Before doing this we prove a useful lemma. Lemma 3.4.2.
For a dependent projection π A : Γ .A → Γ of C S , its lifting to an internalfunctor ( π A , π A • ) , as defined in Proposition 3.2.2, satisfies ( x, y ) , ( x ′ , y ′ ) : Γ .A, ( p, q ) : Id Γ .A (cid:0) ( x, y ) , ( x ′ , y ′ ) (cid:1) ⊢ π A • ( p, q ) = p : Id Γ ( x, x ′ ) .Proof. By discrete identity types, it suffices to show that π A • ( p, q ) ≈ p ; and by Id -elimination on Γ .A , we need only consider the case where x = x ′ , y = y ′ , p = r( x ) and q = r ( y ). But here, by definition of π A • , we have π A • (r( x ) , r( y )) = r( π A ( x, y )) = r( x ) asrequired. (cid:3) Proposition 3.4.3.
The category T S defined in § -category T S whose -cells ( α, β ) : ( f, g ) ⇒ ( f ′ , g ′ ) : (Γ , A ) → (∆ , B ) are given by pairs ofjudgements (13) x : Γ ⊢ α ( x ) : Id ∆ ( f x, f ′ x ) x : Γ , y : A ( x ) ⊢ β ( x, y ) : Id B ( fx ) (cid:0) g ( x, y ) , α ( x ) ∗ ( g ′ ( x, y )) (cid:1) .Proof. If we view T S as a 2-category with only identity 2-cells, then the functor E : T S →C S defined in § T S → C S . We can factorise this 2-functoras a composite(14) T S → T S → C S ,whose first part is bijective on objects and 1-cells and whose second part is bijective on2-cells. We claim that the intermediate 2-category is the T S of the Proposition. Clearlyit has the correct objects and 1-cells, whilst for the 2-cells, we must show that given maps( f, g ) , ( f ′ , g ′ ) : (Λ , A ) → (∆ , B ) of T S , pairs of judgements as in (13) are in bijection with diagrams(15) Γ .A π A f.gf ′ .g ′ γ ∆ .B π B Γ ff ′ α ∆in C S satisfying π B γ = απ A . For a diagram like (15), the 2-cell γ : f.g ⇒ f ′ .g ′ corresponds—by the definition of Id ∆ .B given in Proposition 3.3.1—to a pair of judgements(16) x : Γ , y : A ( x ) ⊢ γ ( x, y ) : Id ∆ ( f x, f ′ x ) x : Γ , y : A ( x ) ⊢ γ ( x, y ) : Id B ( fx ) (cid:0) g ( x, y ) , γ ( x, y ) ∗ ( g ′ ( x, y )) (cid:1) ,whilst the equality π B γ = απ A corresponds to the validity of the judgement x : Γ , y : A ( x ) ⊢ α ( x ) = π B • ( γ ( x, y )) : Id ∆ ( f x, f ′ x ).But by Lemma 3.4.2, we have π B • ( γ ( x, y )) = γ ( x, y ), so that α ( x ) = γ ( x, y ), and wemay identify (16) with (13) upon taking β := γ . (cid:3) Corollary 3.4.4.
The fully faithful functor E : T S → C S of § -fullyfaithful (i.e., bijective on - and -cells) -functor E : T S → C S .Proof. We take E to be the second half of the factorisation in (14). (cid:3) We now define p : T S → C S to be the composite of the 2-functor E of the previousProposition with the codomain 2-functor C S → C S ; explicitly, p is the 2-functor sending(Γ , A ) to Γ, ( f, g ) to f and ( α, β ) to α . We intend to show that p is a (globally split)2-fibration; and will do so by making using of two further properties of the 2-functor E : T S → C S . The first of these generalises directly the one-dimensional situation de-scribed in § Proposition 3.4.5.
For each (∆ , B ) ∈ T S and f : Γ → ∆ in C S , the following pullbacksquare in C S is also a -pullback: (17) Γ .f ∗ B π f ∗ B f.ι ∆ .B π B Γ f ∆ .Proof. We begin by introducing a piece of local notation: for the duration of this proof,we will write applications of the Leibniz rule as a , a : A p : Id ( a , a ) b : B ( a ) subst B ( p, b ) : B ( a ) Id -subst. We do this in order to make explicit the family B in which substitution is occurring.Now, to say that (17) is not just a pullback but also a 2-pullback is to say that, whenever WO-DIMENSIONAL MODELS OF TYPE THEORY 19 we are given maps h, k : Λ → Γ .f ∗ B and 2-cells(18) Λ π f ∗ B h α π f ∗ B k ( f.ι ) hβ ( f.ι ) k ∆ .B π B Γ f ∆in C S satisfying f α = π B β , we can find a unique 2-cell γ : h ⇒ k : Λ → Γ .f ∗ B satisfying π f ∗ B ◦ γ = α and f.ι ◦ γ = β . In order to show this, we will first need to understand how f.ι lifts to an internal functor( f.ι, ( f.ι ) • ) : (Γ .f ∗ B, Id Γ .f ∗ B ) → (∆ .B, Id ∆ .B ).So suppose given elements ( x , y ) and ( x , y ) : Γ .f ∗ B ; now a typical element ( p, q ) : Id Γ .f ∗ B (cid:0) ( x , x ) , ( y , y ) (cid:1) is given by a pair of judgements(19) p : Id Γ ( x , y ) and q : Id B ( fx ) (cid:0) x , subst f ∗ B ( p, y ) (cid:1) .This is sent by ( f.ι ) • to some element ( u, v ) : Id ∆ .B (cid:0) ( f x , y ) , ( f y , y ) (cid:1) , which is equallywell a pair of judgements(20) u : Id Γ ( f x , f y ) and v : Id B ( fx ) (cid:0) x , subst B ( u, y ) (cid:1) .Since we have π B ◦ f.ι = f ◦ π f ∗ B , we have by Lemma 3.4.2 that u = π B • ( u, v ) = ( π B ◦ f.ι ) • ( p, q ) = ( f ◦ π f ∗ B ) • ( p, q ) = f • ( p );and so it remains only to describe v . We will do this by reduction to a special case.Suppose that we have x = subst f ∗ B ( p, y ) and q = r( subst f ∗ B ( p, y )). We denote thecorresponding v by(21) θ ( p, y ) : Id B ( fx ) (cid:0) subst f ∗ B ( p, y ) , subst B ( f • ( p ) , y ) (cid:1) .Note that in the case where x = y and p = r( x ), we have by Id -computation that θ (r( x ) , y ) = r( y ). We now use (21) to describe the general case. We claim that given p and q as in (19), the corresponding v as in (20) satisfies v = θ ( p, y ) ◦ q : Id B ( fx ) (cid:0) x , subst B ( f • ( p ) , y ) (cid:1) .Now, by discrete Id -types, it suffices to show this up to propositional equality; and by Id -elimination on Γ .f ∗ B , this only in the case where x = y , p = r( x ), x = y and q = r( x ). Here, by definition of ( f.ι ) • and Id -computation, we have on the one hand that v = r( x ); but on the other that θ (r( x ) , x ) ◦ r( x ) = r( x ) ◦ r( x ) = r( x ) as required.This completes the proof of the claim.We are now ready to show that (17) is a 2-pullback. So suppose given maps h, k : Λ → Γ .f ∗ B and 2-cells α, β as in (18). To give h is to give judgements x : Λ ⊢ h ( x ) : Γ and x : Λ ⊢ h ( x ) : B ( f h x )—and correspondingly for k —whilst to give α and β as in (18) satisfying f α = π B β is to give judgements x : Λ ⊢ α ( x ) : Id Γ ( h x, k x ) x : Λ ⊢ β ( x ) : Id ∆ ( f h x, f k x ) x : Λ ⊢ β ( x ) : Id B ( fh x ) ( h x, subst B ( β x, k x ))satisfying x : Λ ⊢ f • ( αx ) = π B • ( β x, β x ) : Id ∆ ( f h x, f k x ).By Lemma 3.4.2, we have that π B • ( β x, β x ) = β ( x ); and so to give (18) satisfying f α = π B β is equally well to give a pair of judgements x : Λ ⊢ α ( x ) : Id Γ ( h x, k x )and x : Λ ⊢ β ( x ) : Id B ( fh x ) ( h x, subst B ( f • αx, k x ) (cid:1) .From this we are required to find a unique 2-cell γ : h ⇒ k : Λ → Γ .f ∗ B satisfying π f ∗ B ◦ γ = α and ( f.ι ) ◦ γ = β ; which is equally well a pair of judgements x : Λ ⊢ γ ( x ) : Id Γ ( h x, k x )and x : Λ ⊢ γ ( x ) : Id B ( fh x ) ( h x, subst f ∗ B ( γ x, k x ) (cid:1) satisfying ( π f ∗ B ) • ( γ x, γ x ) = α ( x ) and ( f.ι ) • ( γ x, γ x ) = ( f • αx, β x ). Now by Lemma 3.4.2,we have ( π f ∗ B ) • ( γ x, γ x ) = γ ( x ), whence we must take γ := α ; whilst from our inves-tigations above, we have( f.ι ) • ( γ x, γ x ) = ( f.ι ) • ( αx, γ x ) = (cid:0) f • ( αx ) , θ ( αx, k x ) ◦ γ ( x ) (cid:1) which tells us that we must have γ ( x ) := θ ( αx, k x ) − ◦ β ( x ). Uniqueness of γ followseasily. (cid:3) The second property of E we consider has no one-dimensional analogue, as it involvesthe inherently 2-categorical notion of isofibration : Definition 3.4.6.
Let K be a 2-category. A morphism p : X → Y in K is said to be a cloven isofibration if for every invertible 2-cell(22) W gf α X p Y ,we are given a choice of 1-cell s α : W → X and 2-cell σ α : s α ⇒ g satisfying p ◦ s α = f and p ◦ σ α = α ; and these choices are natural in W , in the sense that given further k : W ′ → W , we have s αk = s α ◦ k and σ αk = σ α ◦ k . A cloven isofibration is said to be normal if for any g : W → X , we have s id pg = g and σ id pg = id g . Proposition 3.4.7.
Every dependent projection π B : ∆ .B → ∆ in C S may be equippedwith the structure of a normal isofibration.Proof. Suppose given an invertible 2-cell(23) Γ gf α ∆ .B π B ∆ WO-DIMENSIONAL MODELS OF TYPE THEORY 21 of C S . We must find a 1-cell s α : Γ → ∆ .B and 2-cell σ α : s α ⇒ g satisfying π B ◦ s α = f and π B ◦ σ α = α . Now, to give a 2-cell as in (23) is equally well to give judgements x : Γ ⊢ f ( x ) : ∆, x : Γ ⊢ g ( x ) : ∆, x : Γ ⊢ g ( x ) : B ( g x ), x : Γ ⊢ α ( x ) : Id ( f x, g x ).So we may take s α : Γ → ∆ .B to be given by the pair of judgements(24) x : Γ ⊢ f ( x ) : ∆ and x : Γ ⊢ ( αx ) ∗ ( g x ) : B ( f x ),and take σ α : s α ⇒ g to be given by the pair of judgements(25) x : Γ ⊢ α ( x ) : Id ( f x, g x ) x : Γ , y : A ( x ) ⊢ r (cid:0) ( αx ) ∗ ( g x ) (cid:1) : Id (cid:0) ( αx ) ∗ ( g x ) , ( αx ) ∗ ( g x ) (cid:1) .Given further k : Λ → Γ, the equalities s αk = s α ◦ k and σ αk = σ α ◦ k correspond preciselyto the stability of (24) and (25) under substitution in x . Thus π B is a cloven isofibration;and it remains to check normality. But when α is an identity 2-cell we have f ( x ) = g ( x )and α ( x ) = r( g ( x )) and so by the Leibniz computation rule, (24) reduces to g and (25)to id g as required. (cid:3) We will refer to the isofibration structure described in Proposition 3.4.7 as the canon-ical isofibration structure on a dependent projection.
Remark . Proposition 3.4.7 provides a link between the 2-categorical semantics ofthis paper and the homotopy-theoretic semantics espoused by Awodey and Warren in [2].The key idea of that paper is that a suitable environment for modelling intensional typetheory should be a category equipped with a weak factorisation system ( L , R ) (in thesense of [3]) whose right-hand class of maps R is used to model dependent projections.Now, any finitely complete 2-category carries a weak factorisation system ( L , R ) wherein R is the class of normal isofibrations; it forms one half of what [8, Section 4] calls the “dualof the natural model structure on a 2-category”. Thus our two-dimensional semanticsfits naturally into the framework outlined in [2].This result can also be seen as a special case of a result obtained in [9]. The mainresult of that paper is that the classifying category of any intensional type theory maybe equipped with a weak factorisation system whose right class of maps is generatedby the dependent projections; and it is shown (Lemma 13) that the maps in this rightclass are “type-theoretic normal isofibrations”. Our Proposition 3.4.7 can be seen as atwo-dimensional collapse of this result.Using Propositions 3.4.5 and 3.4.7, we may now show that: Proposition 3.4.9.
The -functor p : T S → C S is a globally split -fibration.Proof. We check the four clauses in Definition 3.4.1. Clause (i) is immediate, since theunderlying ordinary functor of p : T S → C S is the split fibration p : T S → C S . For clause(ii), it suffices to consider a chosen cartesian lifting ( f, ι ) : (Γ , f ∗ B ) → (∆ , B ) of T S .Taking advantage of the 2-fully faithfulness of E : T S → C S , we may express the property we are to verify as follows: that for each diagramΛ .A π A h h β ∆ .B π B Λ g g α Γ f ∆in C S with π B β = f απ A , there is a unique factorisation β = Λ .A h ′ h ′ β ′ Γ .f ∗ B f.ι ∆ .B with π f ∗ B β ′ = βπ A . But this follows without difficulty from the fact that diagram (17) isa 2-pullback. For clause (iii) in the definition of 2-fibration, we suppose given (Γ , A ) and(∆ , B ) in T S and are required to show that the functor T S (cid:0) (Γ , A ) , (∆ , B ) (cid:1) → C S (Γ , ∆)is a fibration. Using once more the 2-fully faithfulness of E , it suffices to show that foreach commutative square Γ .A π A g.h ∆ .B π B Γ g ∆in C S and 2-cell α : f ⇒ g , we can find a 1-cell k : Γ .A → ∆ .B and a 2-cell β : k ⇒ g.h satis-fying π B k = f π A and π B β = απ A . This follows using the canonical isofibration structureof π B . Finally, for clause (iv), we must show that each (–) · f : T S ( y, z ) → T S ( x, z ) pre-serves cartesian liftings of 2-cells. As every 2-cell of T S is invertible, and hence cartesian,this is automatic. (cid:3) We end this section by considering the pullback stability of the canonical isofibrationstructures of Proposition 3.4.7. To this end, consider a square like (17). Both verticalarrows π B and π f ∗ B have their canonical isofibration structures; but we also have asecond isofibration structure on π f ∗ B , obtained by pulling back the canonical structureof π B along f . A careful examination of the proof of Proposition 3.4.7 reveals that thesetwo structures on π f ∗ B need not coincide . In other words, the canonical isofibrationstructures of Proposition 3.4.7 are not necessarily stable by pullbacks. At first glance, thismay appear surprising, since stability by pullbacks tends to be an automatic consequenceof stability under substitution. However, a more careful analysis shows that in this case,stability under substitution corresponds to a more restricted form of pullback stability,which we now describe. WO-DIMENSIONAL MODELS OF TYPE THEORY 23
Suppose we are given ∆ ∈ C S , A ∈ T S (∆) and B ∈ T S (∆ .A ). We can view thedependent projection π B : ∆ .A.B → ∆ .A not only as a map of C S , but also as a map(26) ∆ .A.B π A π B π B ∆ .A π A ∆of C S / ∆. It is easy to see that the forgetful 2-functor C S / ∆ → C S creates normalisofibrations, so that (26) is canonically a normal isofibration in C S / ∆. Suppose we arenow given a morphism f : Γ → ∆ of C S . By pulling back (26) along f , we obtain themap(27) Γ .f ∗ A.f ∗ B π f ∗ A π f ∗ B π f ∗ B Γ .f ∗ A π f ∗ A Γof C S / Γ (note that we are abusing notation slightly: we should really write the left-handvertex as Γ .f ∗ A. ( f.ι ) ∗ B ), and this now has two isofibration structures on it: the oneinduced by the canonical isofibration structure on π f ∗ B , and the one obtained by pullingback the isofibration structure of (26). The following Proposition now tells us that thesetwo isofibration structures on (27) do coincide. Proposition 3.4.10.
Suppose given ∆ ∈ C S , A ∈ T S (∆) and B ∈ T S (∆ .A ) and f : Γ → ∆ as above. With reference to the -pullback square (28) Γ .f ∗ A.f ∗ B π f ∗ B f.ι.ι ∆ .A.B π B Γ .f ∗ A f.ι ∆ .A ,the canonical isofibration structure on π f ∗ B qua map of C S / Γ agrees with the pullbackalong f of the canonical isofibration structure on π B qua map of C S / ∆ .Proof. As in the proof of Proposition 3.4.5, we will use subst notation in applications ofthe Leibniz rule, in order to make clear the dependent family in which substitution istaking place. Now, to prove the Proposition, it suffices to show the following. Supposegive an invertible 2-cell(29) Λ kh α Γ .f ∗ A.f ∗ B π f ∗ B Γ .f ∗ A of C S / Γ (i.e., one satisfying π f ∗ A α = id π f ∗ A h ). Let us write α ′ := f.ι ◦ α and k ′ := f.ι.ι ◦ k .Then we must show that(30) s α ′ = f.ι.ι ◦ s α : Λ → ∆ .A.B and σ α ′ = f.ι.ι ◦ σ α : s α ′ ⇒ k ′ , where we obtain ( s α , σ α ) from the canonical isofibration structure on π f ∗ B , and ( s α ′ , σ α ′ )from that on π B . So suppose given a 2-cell as in (29), with h , k and α given as follows: x : Λ ⊢ h ( x ) := ( h x, h x ) : Γ .f ∗ Ax : Λ ⊢ k ( x ) := ( h x, k x, k x ) : Γ .f ∗ A.f ∗ B and x : Λ ⊢ α ( x ) := (r h x, α x ) : Id Γ .f ∗ A (cid:0) ( h x, h x ) , ( h x, k x ) (cid:1) .We first compute the pair ( s α , σ α ). The map s α : Λ → Γ .f ∗ A.f ∗ B is given by x : Λ ⊢ (cid:0) h x, h x, subst [ u,v ] B ( fu,v ) ((r h x, α x ) , k x ) (cid:1) : Γ .f ∗ A.f ∗ B ;which, by unfolding the inductive description of the Id -elimination rule given in the proofof Proposition 3.3.1, is equal to(31) x : Λ ⊢ (cid:0) h x, h x, subst [ v ] B ( fh x,v ) ( α x, k x ) (cid:1) : Γ .f ∗ A.f ∗ B .The corresponding 2-cell σ α : s α ⇒ k is now given by(32) x : Λ ⊢ (cid:0) r h x, α x, r( subst [ v ] B ( fh x,v ) ( α x, k x )) (cid:1) : Id ( s α x, kx ).Next we compute the pair ( s α ′ , σ α ′ ). By the proof of Proposition 3.4.5 we have α ′ ( x ) := ( f.ι ) • (r h x, α x )= ( f • r h x, θ (r h x, k x ) ◦ α x )= (r f h x, r( k x ) ◦ α x ) = (r f h x, α x ).Thus the morphism s α ′ : Γ → ∆ .A.B is given by x : Λ ⊢ (cid:0) f h x, h x, subst [ u,v ] B ( u,v ) ((r f h x, α x ) , k x ) (cid:1) : ∆ .A.B ;which, by unfolding the description of Id -elimination, is definitionally equal to(33) x : Λ ⊢ (cid:0) f h x, h x, subst [ v ] B ( fh x,v ) ( α x, k x ) (cid:1) : ∆ .A.B .The corresponding 2-cell σ α ′ : s α ′ ⇒ k ′ is now given by(34) x : Λ ⊢ (cid:0) r f h x, α x, r( subst [ v ] B ( fh x,v ) ( α x, k x )) (cid:1) : Id ( s α ′ x, k ′ x ).It remains to verify the equalities in (30). The first equality follows immediately frominspection of (31) and (33). For the second, we will need a calculation. Supposegiven ( x, y, s ) and ( x, z, t ) : Λ .f ∗ A.f ∗ B together with identity proofs p : Id ( y, z ) and q : Id ( s, subst [ v ] B ( fx,v ) ( p, t )). We claim that:(35) ( f.ι.ι ) • (r( x ) , p, q ) = (r( f x ) , p, q ) : Id ∆ .A.B (cid:0) ( f x, y, s ) , ( f x, z, t ) (cid:1) .By discrete identity types, it suffices to prove this up to propositional equality; and byapplying Id -elimination twice, first on p and then on q , it suffices for this to show that,given ( x, y, s ) : Γ .f ∗ A.f ∗ B , we have( f.ι.ι ) • (r x, r y, r k ) ≈ (r f x, r y, r k ) : Id ∆ .A.B (cid:0) ( f x, y, s ) , ( f x, y, s ) (cid:1) .But this follows by the Id -computation rule and the definition of ( f.ι.ι ) • . Thus wehave (35) as claimed. We now use this to affirm the second equality in (30). Given x : Λ,we have that:( f.ι.ι ◦ σ α )( x ) = ( f.ι.ι ) • (cid:0) r h x, α x, r( subst [ v ] B ( fh x,v ) ( α x, k x )) (cid:1) = (cid:0) r f h x, α x, r( subst [ v ] B ( fh x,v ) ( α x, k x )) (cid:1) = σ f.ι ◦ α ( x ) = σ α ′ ( x ). WO-DIMENSIONAL MODELS OF TYPE THEORY 25 (cid:3)
Remark . Although it may seem somewhat technical, the result we have just provenis absolutely crucial for obtaining a sound notion of two-dimensional model. Withoutit, our models would not necessarily be sound for the rules expressing stability of theelimination rules under change of ambient context. It is not just the identity type ruleswould be afflicted either: we will see in § § all the type-theoretic elimination rules.One of the key issues in giving higher-dimensional and homotopy-theoretic semantics forintensional type theory will be finding an appropriate counterpart of this Proposition.3.5. Comprehension -categories. We may abstract away from the syntactic inves-tigations of the preceding sections as follows. We define a full split comprehension -category C to be given by the following data: a locally groupoidal 2-category C witha specified 2-terminal object; a globally split 2-fibration p : T → C , with T also locallygroupoidal; and a 2-fully faithful 2-functor E : T → C rendering commutative the trian-gle T p E C cod C .Moreover, the 2-functor E should send cartesian morphisms in T to 2-pullback squaresin C ; should send each object of T to a normal isofibration in C ; and should satisfythe stability conditions of Proposition 3.4.10. The preceding developments show thatwe may associate a full split comprehension 2-category to each dependent type theory Ssatisfying the rules for identity types in Table 1 and the discreteness rules of Table 2. Wedenote this comprehension 2-category by C (S), and call it the classifying comprehension -category of S.4. Categorical models for ML : logical aspects Identity types.
In this section, we will examine the structure induced on thesyntactic comprehension 2-category of the previous section by the logical rules of two-dimensional type theory. Once again we consider a fixed dependently typed calculusS which we now suppose to admit all of the rules in Tables 1, 2 and 3. We begin byinvestigating the identity types. Given how deeply intertwined these have been with theconstruction of the syntactic comprehension 2-category, it is perhaps unsurprising thattheir characterisation is rather intrinsic. It will be given in terms of the 2-categoricalnotion of arrow object. Given a 2-category K , an arrow object for X ∈ K is given by anobject Y ∈ K such that 1-cells into Y correspond naturally to 2-cells into X . That is,we have an isomorphism of categories(36) K ( A, Y ) ∼ = K ( A, X ) ,2-natural in A . In particular, under the bijection (36), the identity map id Y : Y → Y corresponds to a 2-cell Y st κ X ; and 2-naturality of (36) says that any other such 2-cell into X factors uniquely through κ . In the language of enriched category theory [21], an arrow object is a certain kindof (weighted) limit, namely a power (or sometimes cotensor ) with the category . For afull treatment of 2-categorical limits, we refer the reader to [22].We now introduce a small abuse of notation. Given Γ ∈ C S and A ∈ T S (Γ), we writeΓ .A.A for the context (cid:0) x : Γ , y : A ( x ) , z : A ( x ) (cid:1) —this rather than the more correctΓ .A.π ∗ A A —and write π and π for the context morphisms Γ .A.A → Γ .A projecting ontothe first or second copy of A . Proposition 4.1.1.
For every context Γ and type Γ ⊢ A type in S , the context Γ .A.A. Id A ,together with the projections π π Id A , π π Id A : Γ .A.A. Id A → Γ .A , can be made into anarrow object for Γ .A in the slice -category C S / Γ .Proof. Let us write s := π π Id A and t := π π Id A . We are to find a 2-cell(37) Γ .A.A. Id Aπ st κ Γ .A π A Γin C S which is over Γ in the sense that π A s = π A t = π and π A κ = id π , and such that anyother 2-cell(38) Λ h fg α Γ .A π A Γover Γ factors through κ via a unique morphism ¯ α : Λ → Γ .A.A. Id A . The universalproperty of κ also has a two-dimensional aspect. Suppose we are given a commutativediagram(39) f βα f ′ α ′ g γ g ′ of 1- and 2-cells Λ → Γ .A over Γ. Then we should be able to find a unique 2-cell δ : ¯ α ⇒ ¯ α ′ : Λ → Γ .A.A. Id A with β = sδ and γ = tδ . We begin by defining κ as in (37).For this we are required to give a judgement x : Γ , y, z : A ( x ) , p : Id ( y, z ) ⊢ κ ( x, y, z, p ) : Id ( y, z );which we do by taking κ ( x, y, z, p ) := p . We now verify the universal property of κ .Suppose given an α as in (38): then the commutativity conditions π A f = π A g = h meanthat f and g correspond to judgements x : Λ ⊢ f ( x ) : A ( hx ) and x : Λ ⊢ g ( x ) : A ( hx ), WO-DIMENSIONAL MODELS OF TYPE THEORY 27 whereupon—by Lemma 3.4.2—the condition π A α = id h allows us to view α as a judge-ment x : Λ ⊢ α ( x ) : Id ( f x, gx ). We now define a morphism ¯ α : Λ → Γ .A.A. Id A by x : Λ ⊢ ( hx, f x, gx, αx ) : Γ .A.A. Id A . It is immediate from the definition of κ that κ ¯ α = α , and moreover that if κm = α for some m : Λ → Γ .A.A. Id A then we have ¯ α = m .It still remains to verify the two-dimensional universal property of κ . So suppose given1- and 2-cells as in (39). We are required to define a 2-cell δ : ¯ α ⇒ ¯ α ′ : Λ → Γ .A.A. Id A satisfying sδ = β and tδ = γ . In order to satisfy these last two requirements, δ , if itexists, must be given by a judgement x : Λ ⊢ (r hx, βx, γx, δ x ) : Id Γ .A.A. Id A (cid:0) ( hx, f x, gx, αx ) , ( hx, f ′ x, g ′ x, α ′ x ) (cid:1) for some x : Λ ⊢ δ ( x ) : Id Id ( fx,gx ) (cid:0) αx, ( βx, γx ) ∗ ( α ′ x ) (cid:1) . By discrete identity types, thisis only possible if in fact α ( x ) = ( βx, γx ) ∗ ( α ′ x ), whereupon we can take δ ( x ) = r( αx ).We claim that in fact ( βx, γx ) ∗ ( α ′ x ) = ( γx ) − ◦ ( α ′ x ◦ βx ), so that we will be done if wecan show that α ( x ) = ( γx ) − ◦ ( α ′ x ◦ βx ): and this follows from the equation γα = α ′ β using the groupoid laws for Id A . It remains only to prove the claim, which follows fromthe more general result that x : Γ , y, z, y ′ , z ′ : A ( x ) , p : Id ( y, y ′ ) , q : Id ( z, z ′ ) , s : Id ( y ′ , z ′ ) ⊢ ( p, q ) ∗ ( s ) = q − ◦ ( s ◦ p ) : Id ( y, z ).By discrete identity types, it suffices to prove this up to propositional equality; and by Id -elimination on p and q , it suffices to consider the case where y = y ′ , z = z ′ , p = r( y )and q = r( z ), where we have that (r( y ) , r( z )) ∗ ( s ) = s = r( z ) − ◦ ( s ◦ r( y )) as required. (cid:3) Proposition 4.1.2 (Stability for identity types) . Let Γ , ∆ be contexts in S , let f : Γ → ∆ be a context morphism, and let x : ∆ ⊢ B ( x ) type . Then the comparison morphism Γ .f ∗ B.f ∗ B. ( f.ι.ι ) ∗ ( Id B ) → Γ .f ∗ B.f ∗ B. Id f ∗ B induced by the universal property of Id f ∗ B is an identity.Proof. Immediate from the stability of identity types under substitution. (cid:3)
Digression on -categorical adjoints. Our characterisation of the remainingtype constructors of ML will be given in terms of weak 2-categorical adjoints. We there-fore break off at this point in order to give a brief summary of the 2-categorical notionsnecessary for this characterisation. Let K be a 2-category. By a retract equivalence in K ,we mean a pair of objects x, y ∈ K , a pair of morphisms i : x → y and p : y → x satisfying pi = id x , and an invertible 2-cell θ : id y ⇒ ip satisfying θi = id i and pθ = id p . In thesecircumstances, we may call i an injective equivalence —with the understanding that theextra data ( p, θ ) is provided as part of this assertion—or call p a surjective equivalence (with the same understanding). Given now a 2-functor U : K → L and an object x ∈ L ,we define a retract bireflection of x along U to be an object F x ∈ K and morphism η x : x → U F x such that for each y ∈ K , the functor K ( F x, y ) U F x,y −−−→ L ( U F x, U y ) (–) ◦ η x −−−−→ L ( x, U y )is a surjective equivalence of categories. By a left retract biadjoint F for U , we meana choice for every x ∈ L of a retract bireflection F x of x along U . Note that if F isa left retract biadjoint for U , then the assignation x F x will not in general extendto a 2-functor F : L → K ; rather, it gives a pseudo-functor , which preserves identities and composition only up to invertible 2-cells. Likewise, the maps η x : x → U F x do notprovide components of a 2-natural transformation η : id L ⇒ U F but merely of a pseudo-natural transformation, whose naturality squares commute only up to invertible 2-cells.We could give a definition of left retract biadjoint in terms of a pseudo-functor K → L and unit and counit transformations η and ǫ satisfying weakened versions of the trianglelaws (see [28, Section 1] for the details); but the above description is both simpler and,as we will see, closer to the type theory. In fact, the above definitions admit a furthersimplification, using the observation that the surjective equivalences of categories areprecisely those functors F : C → D which are fully faithful and whose object functionob F : ob C → ob D is a split epimorphism: Proposition 4.2.1.
To give a retract bireflection of x ∈ L along U : K → L is to givean object F x ∈ K and map η x : x → U F x , together with, for each f : x → U y in L , achoice of map ¯ f : F x → y in K satisfying U ¯ f ◦ η x = f ; all subject to the requirement that,for every h, k : F x → y in K and every α : U h ◦ η x ⇒ U k ◦ η x in L , there is a unique ¯ α : h ⇒ k with U ¯ α ◦ η x = α . Given a 2-functor U : K → L and x ∈ L as before, we have the dual notion of retractbicoreflection of x along U : this being given by an object Gx ∈ K , together with amorphism ǫ x : U Gx → x such that for each y ∈ K , the functor K ( y, Gx ) U y,Gx −−−→ L ( U y, U Gx ) ǫ x ◦ (–) −−−−→ L ( U y, x )is a surjective (not injective!) equivalence of categories. Now a right retract biadjoint for U is of course given by a choice for every x ∈ L of a retract bicoreflection along U . Asbefore, we have an elementary characterisation of retract bicoreflections: Proposition 4.2.2.
To give a retract bicoreflection of x ∈ L along U : K → L is to givean object Gx ∈ K and map ǫ x : U Gx → x , together with, for each f : U y → x in L , achoice of map ¯ f : y → Gx in K satisfying ǫ x ◦ U ¯ f = f ; all subject to the requirement that,for every h, k : y → Gx in K and every α : ǫ x ◦ U h ⇒ ǫ x ◦ U k in L , there is a unique ¯ α : h ⇒ k with ǫ x ◦ U ¯ α = α . Unit types.
Our first application of the 2-categorical adjoint notions developedabove will be to the unit types of S—which we recall is an arbitrary dependent typetheory admitting all the rules listed in Tables 1, 2 and 3. In the following result, wedenote by E (Γ) : T S (Γ) → C S / Γ the 2-functor obtained by restricting E : T S → C S to thefibre over Γ ∈ C S . Proposition 4.3.1.
For each context Γ of S , the object Γ ∈ T S (Γ) given by Γ ⊢ type provides a retract bireflection of id Γ : Γ → Γ along the -functor E (Γ) : T S (Γ) → C S / Γ .Proof. The unit of the bireflection η Γ : Γ → Γ . Γ (over Γ) is given by the judgement x : Γ ⊢ ⋆ : . Given now a morphism f : Γ → Γ .A over Γ—which is equally well ajudgement x : Γ ⊢ f ( x ) : A ( x )—we obtain a factorisation ¯ f : Γ . Γ → Γ .A over Γ by -elimination, taking ¯ f to be the term x : Γ , z : ⊢ U f ( x ) ( z ) : A ( x ). That this satisies¯ f η Γ = f is now precisely the computation rule x : Γ ⊢ U f ( x ) ( ⋆ ) = f ( x ). It remains tocheck that for maps h, k : Γ . → Γ .A over Γ, every 2-cell α : hη Γ ⇒ kη Γ over Γ is of the WO-DIMENSIONAL MODELS OF TYPE THEORY 29 form ¯ αη Γ for a unique ¯ α : h ⇒ k . Now, to give h , k and α is to give judgements x : Γ , z : ⊢ h ( x, z ) : A ( x ) x : Γ , z : ⊢ k ( x, z ) : A ( x ) x : Γ ⊢ α ( x ) : Id (cid:0) h ( x, ⋆ ) , k ( x, ⋆ ) (cid:1) ;from which we must determine x : Γ , z : ⊢ ¯ α ( x, z ) : Id (cid:0) h ( x, z ) , k ( x, z ) (cid:1) . We do thisby -elimination, taking ¯ α ( x, z ) := U α ( x ) ( z ). The equality ¯ αη Γ = α now follows fromthe -computation rule. It remains to check uniqueness of ¯ α . So suppose we are given x : Γ , z : ⊢ β ( x, z ) : Id (cid:0) h ( x, z ) , k ( x, z ) (cid:1) satisfying β ( x, ⋆ ) = α ( x ). We must show that β ( x, z ) = ¯ α ( x, z ). By discrete identity types, it suffices to show this up to propositionalequality; and by -elimination, this only in the case where z = ⋆ , for which we have that β ( x, ⋆ ) = α ( x ) = ¯ α ( x, ⋆ ) as required. (cid:3) Proposition 4.3.2 (Stability for unit types) . For each k : Γ → ∆ in C , we have k ∗ ( ∆ ) = Γ ; we have η Γ = k ∗ ( η ∆ ) : Γ → Γ . Γ ; and for each f : ∆ → ∆ .B over ∆ , have k ∗ ( ¯ f ) = k ∗ ( f ) : Γ . Γ → Γ .k ∗ B .Proof. By the stability of unit types under substitution. (cid:3)
Remark . Note carefully what the previous result does not say: it does not saythat for a context morphism k : Γ → ∆, the comparison map Γ → k ∗ ∆ of T S (Γ) isan identity; indeed, this map will in general only be isomorphic to the identity, since itcorresponds to the judgement x : Γ , z : ⊢ U ⋆ ( z ) : .4.4. Dependent sum types.
We next consider the dependent sum types.
Proposition 4.4.1.
For each context Γ and type Γ ⊢ A type of S , the -functor ∆ A := T S ( π A ) : T S (Γ) → T S (Γ .A ) has a left retract biadjoint Σ A .Proof. We must provide, for each B ∈ T S (Γ .A ) a retract bireflection Σ A ( B ) of B along∆ A . So we take Σ A ( B ) ∈ T S (Γ) to be given by the judgement Γ ⊢ Σ( A, B ) type (wherefor readability we suppress explicit mention of dependencies on the variables in Γ); andthe unit map η : B → ∆ A Σ A ( B ) of T S (Γ .A ) to be given by the judgement Γ , y : A, z : B ( y ) ⊢ h y, z i : Σ( A, B ). Now given a type C ∈ T S (Γ) and a map f : B → ∆ A C of T S (Γ .A ), we must provide a morphism ¯ f : Σ A ( B ) → C of T S ( C ) satisfying ∆ A ( ¯ f ) ◦ η = f .But to give f is to give a judgement Γ , y : A, z : B ( y ) ⊢ f ( y, z ) : C , whilst to give ¯ f is to give a judgement Γ , s : Σ( A, B ) ⊢ ¯ f ( s ) : C . Thus by using Σ-elimination we maydefine ¯ f ( s ) := E f ( s ). The equality ∆ A ( ¯ f ) ◦ η = f follows by the Σ-computation rule.It remains to show, given two morphisms h, k : Σ A ( B ) → D in T S (Γ), that each 2-cell α : ∆ A ( h ) ◦ η ⇒ ∆ A ( k ) ◦ η is of the form ∆ A ( ¯ α ) ◦ η for a unique ¯ α : h ⇒ k . This followsby an argument analogous to that given in the proof of Proposition 4.3.1. (cid:3) Whilst Proposition 4.4.1 is very natural from a categorical perspective, it fails tocapture the full strength of the elimination rule for dependent sums (even though itrequires the full strength of that elimination rule in its proof). In order to do this, weneed the following result:
Proposition 4.4.2.
Suppose given a context Γ in S and types Γ ⊢ A type and Γ , x : A ⊢ B ( x ) type in S , and consider the morphism (40) Γ .A.B iπ B Γ . Σ A ( B ) π Σ A ( B ) Γ .A π A Γ in C S corresponding to the unit morphism η : B → ∆ A Σ A ( B ) in T S (Γ .A ) . The map i appearing in this diagram is an injective equivalence in C S / Γ .Proof. We construct a pseudoinverse retraction for i over Γ as follows. The map p : Γ . Σ A ( B ) → Γ .A.B over Γ is given by the projections out of the sum:Γ , s : Σ( A, B ) ⊢ s. A Γ , s : Σ( A, B ) ⊢ s. B ( s. s , the first being given by s. [ y,z ] y ( s ) and the second by s. [ y,z ] z ( s ). The equality pi = id Γ .A.B follows from the Σ-computation rule. We must nowgive a 2-cell θ : id Γ . Σ A ( B ) ⇒ ip ; which is equally well a judgement Γ , s : Σ( A, B ) ⊢ θ ( s ) : Id ( s, h s. , s. i ). By Σ-elimination on s , it suffices to define θ when s = h y, z i ; whereuponwe have h s. , s. i = hh y, z i . , h y, z i . i = h y, z i so that we can take θ ( h y, z i ) = r( h y, z i ).The equality θi = id i now follows by the Σ-computation rule; and it remains only toverify that pθ = id p . Now, pθ corresponds to the judgementΓ , s : Σ( A, B ) ⊢ p • ( θ ( s )) : Id Γ .A.B (cid:0) ( s. , s. , ( s. , s. (cid:1) ;and we must show that in fact p • ( θ ( s )) = r( p ( s )). By discrete identity types, it suffices toshow this up to propositional equality; and by Σ-elimination, this only when s = h y, z i .But we calculate that p • ( θ ( h y, z i )) = p • (r( h y, z i )) = r( p ( h y, z i )) as required. (cid:3) Proposition 4.4.3 (Stability for dependent sums) . Given k : Γ → Λ in C S , A ∈ T (Λ) and B ∈ T (Λ .A ) , we have that k ∗ (Σ A ( B )) = Σ k ∗ A ( k ∗ B ) ; that k ∗ ( η A,B ) = η k ∗ A,k ∗ B ;and for each f : B → ∆ A C in T S (Λ .A ) , that k ∗ ¯ f = k ∗ f : Σ k ∗ A ( k ∗ B ) → k ∗ C . More-over, reindexing along k sends the injective equivalence structure on i A,B to the injectiveequivalence structure on i k ∗ A,k ∗ B .Proof. By the stability of dependent sum types under substitution. (cid:3)
Dependent product types.
Finally, we turn to the categorical characterisationof dependent product types in S.
Proposition 4.5.1.
For each context Γ and type Γ ⊢ A type of S , the weakening -functor ∆ A : T S (Γ) → T S (Γ .A ) has a right retract biadjoint Π A .Proof. Once again, we suppress explicit mention of dependencies on the variables in Γ.We must provide, for each B ∈ T S (Γ .A ) a retract bicoreflection Π A ( B ) of B along ∆ A .For this we take Π A ( B ) ∈ T S (Γ) to be given by the judgement Γ ⊢ Π( A, B ) type ; andthe counit map ǫ : ∆ A Π A ( B ) → B of T S (Γ .A ) to be given by the judgement Γ , m :Π( A, B ) , y : A ⊢ m · y : B ( y ). Now given a type C ∈ T S (Γ) and a map f : ∆ A C → B of T S (Γ .A ), we are required to provide a morphism ¯ f : C → Π A ( B ) of T S ( C ) satisfying WO-DIMENSIONAL MODELS OF TYPE THEORY 31 ǫ ◦ ∆ A ( ¯ f ) = f . So if f is the judgement Γ , y : C, z : A ⊢ f ( y, z ) : B ( y ), we take ¯ f tobe the judgement Γ , y : C ⊢ λz. f ( y, z ) : Π( A, B ). The equality ǫ ◦ ∆ A ( ¯ f ) = f followsby the β -rule.It remains to show, given two morphisms h, k : D → Π A ( B ) in T S (Γ), that each2-cell α : ǫ ◦ ∆ A ( h ) ⇒ ǫ ◦ ∆ A ( k ) can be written in the form ǫ ◦ ∆ A ( ¯ α ) for a unique¯ α : h ⇒ k . It is here that we will make crucial use of function extensionality. So,to give h , k and α is to give judgements Γ , C ⊢ h : Π( A, B ); Γ , C ⊢ k : Π( A, B ); andΓ , C, z : A ⊢ α ( z ) : Id ( h · z, k · z ) (where we now suppress explicit mention of the depen-dency on C ) and so we may define the 2-cell ¯ α : h ⇒ k by applying the rule Π -ext ofTable 3 to obtain the judgement Γ , C ⊢ ext ( h, k, α ) : Id ( h, k ). We must now check that ǫ ◦ ∆ A ( ¯ α ) = α . Recall from § m, n : Π( A, B ) p : Id ( m, n ) a : Ap ∗ a : Id ( m · a, n · a )given by p ∗ a := J [ x ]r( x · a ) ( m, n, p ). It is easy to see that ∗ is just the lifting of ǫ to identitytypes; so that ǫ ◦ ∆ A ( ¯ α ) corresponds to the judgementΓ , C, z : A ⊢ ext ( h, k, α ) ∗ z : Id ( h · z, k · z ).But by the rule Π -ext-app of Table 3, we have that ext ( h, k, α ) ∗ z = α ( z ) as required.It remains to check uniqueness of ¯ α . So suppose that we are given Γ , C ⊢ β : Id ( h, k )satisfying β ∗ z = α ( z ): we must show that β = ¯ α . Now, because β ∗ z = α ( z ) = ¯ α ∗ z ,we have thatΓ , C, z : A ⊢ ext (cid:0) h, k, [ z ] β ∗ z (cid:1) = ext (cid:0) h, k, [ z ] ¯ α ∗ z (cid:1) : Id ( h, k ).Thus we will be done if we can show thatΓ , C, m, n : Π( A, B ) , k : Id ( m, n ) ⊢ ext ( m, n, [ z ] k ∗ z ) = k : Id ( m, n )holds. By discrete identity types, it suffices to do this up to propositional equality; andby Id -elimination, this only in the case where m = n and k = r( m ), so that we will bedone if we can show thatΓ , C, m : Π( A, B ) ⊢ ext ( m, m, [ z ] r( m · z )) ≈ r( m ) : Id ( m, m )holds. But this follows immediately from the rule Π -ext-comp . (cid:3) Proposition 4.5.2 (Stability for dependent products) . Given k : Γ → Λ in C S , A ∈ T (Λ) and B ∈ T (Λ .A ) , we have that k ∗ (Π A ( B )) = Π k ∗ A ( k ∗ B ) ; that k ∗ ( ǫ A,B ) = ǫ k ∗ A,k ∗ B ; andfor each f : ∆ A C → B in T S (Λ .A ) , that k ∗ ¯ f = k ∗ f : k ∗ C → Π k ∗ A ( k ∗ B ) .Proof. By the stability of dependent product types under substitution. (cid:3)
Models of two-dimensional type theory.
We now abstract away from the pre-ceding results as follows.
Definition 4.6.1.
Let there be given a full split comprehension 2-category C = ( p : T → C , E : C → T ), in the sense of § • We say that C has equality if, for every Γ ∈ C and A ∈ T (Γ), there is an object Id A ∈ T (Γ .A.A ) such that Γ .A.A. Id A , together with its two projections onto Γ .A ,underlies an arrow object for Γ .A in C / Γ; and these arrow objects satisfy thestability properties of Proposition 4.1.2. • We say that C has units if, for every Γ ∈ C , the map id Γ : Γ → Γ admits aretract bireflection Γ along E (Γ) : T (Γ) → C S / Γ; and these bireflections satisfythe stability properties of Proposition 4.3.2. • We say that C has sums if, for every Γ ∈ C and A ∈ T (Γ), the 2-functor∆ A := T ( π A ) : T (Γ) → T (Γ .A ) admits a retract left biadjoint Σ A ; and thesebiadjoints satisfy the conditions of Proposition 4.4.2 and the stability propertiesof Proposition 4.4.3. • We say that C has products if, for every Γ ∈ C and A ∈ T (Γ), the 2-functor∆ A : T (Γ) → T (Γ .A ) admits a retract right biadjoint Π A ; and these biadjointssatisfy the stability properties of Proposition 4.5.2. • We say that C is a model of two-dimensional type theory if it has equality, units,sums and products.Thus, the results of this section can be summarised by saying that, for any dependenttype theory S satisfying the rules of Tables 1, 2 and 3, the classifying comprehension2-category C (S) is a model of two-dimensional type theory. With an eye on futureapplications, we end this Section by gathering together in one place a list of the structurerequired for a two-dimensional model of type theory. Definition 4.6.2.
A two-dimensional model of type theory C is given by: • A locally groupoidal 2-category C of contexts , with a specified 2-terminal object; • A locally groupoidal 2-category T of types-in-context ; • A globally split 2-fibration p : T → C in the sense of Definition 3.4.1. Spellingthis out, this means that p is a 2-functor such that:(i) The underlying ordinary functor of p is a split fibration of categories;(ii) For every cartesian 1-cell f : y → z of C and every 2-cell α : g ⇒ h : x → z of T , any factorisation of p ( α ) through p ( f ) may be lifted uniquely to afactorisation of α through f .(iii) For each x, y ∈ T , the induced functor p x,y : T ( x, y ) → C ( px, py ) is a fibrationof groupoids.(Note that condition (iv) of Definition 3.4.1 is automatically satisfied since everyfibre category is a groupoid). • A comprehension E : T → C , equipped with:(i) For each object A ∈ T , a normal isofibration structure on E ( A ) in the senseof Definition 3.4.6.and satisfying the following properties:(i) cod ◦ E = p ;(ii) E is 2-fully faithful (i.e., an isomorphism on hom-groupoids);(iii) E sends cartesian morphisms of T to 2-pullback squares in C ;(iv) The normal isofibration structures picked out by E have the stability prop-erties of Proposition 3.4.10.In describing the remaining, logical, structure, we use freely the conventions of Nota-tion 3.1.1. • For every Γ ∈ C and A ∈ T (Γ), there is given an object Id A ∈ T (Γ .A.A ) anda 2-cell κ : π ⇒ π : Γ .A.A. Id A → Γ .A over Γ which together provide an arrowobject (in the sense of § .A in C / Γ. • For every Γ ∈ C , there is given a retract bireflection (in the sense of Proposi-tion 4.2.1) A of the object id Γ : Γ → Γ along E (Γ) : T (Γ) → C S / Γ. WO-DIMENSIONAL MODELS OF TYPE THEORY 33 • For every Γ ∈ C and A ∈ T (Γ), there are given both left and right retractbiadjoints (in the sense of § A and Π A for T ( π A ) : T (Γ) → T (Γ .A ). • For every Γ ∈ C , A ∈ T (Γ) and B ∈ T (Γ .A ), there is given a choice of injectiveequivalence structure on the canonical morphism i : Γ .A.B → Γ . Σ A B defined asin (40). • The above structures satisfy the stability properties listed in Propositions 4.1.2,4.3.2, 4.4.3 and 4.5.2.5.
The internal language of a two-dimensional model -categorical lifting properties.
In this Section, we prove a converse to the re-sults of the previous two Sections. Given a model C of two-dimensional type theory,we will construct from it a dependent type theory S( C ) admitting the rules of Ta-bles 1, 2 and 3. We call this type theory the internal language of C . The key todoing this will be to give semantic analogues in C of each of the logical rules of ML .In giving analogues of the elimination rules, we will make use of the 2-categorical liftingproperty described in Proposition 5.1.1 below. This is again very much in the spirit of [2],since this is fundamentally a result about the weak factorisation system (injective equiv-alences, normal isofibrations) described in Remark 3.4.8: or rather, about an algebraicpresentation of this weak factorisation system in the style of [12]. Proposition 5.1.1.
Suppose given a -category K and a square (41) A fi C p B g D where i carries the structure of an injective equivalence (cf. § p that of a normalisofibration (cf. Definition 3.4.6). From this data we can determine a canonical diagonalfiller j : B → C satisfying pj = g and ji = f .Proof. The injective equivalence structure on i is given by a morphism k : B → A satisfy-ing ki = id A and an invertible 2-cell θ : id B ⇒ ik satisfying θi = id i and kθ = id k . Thuswe have an invertible 2-cell B fkg gθ C p D ,and so from the isofibration structure on p we obtain a map j := s gθ : B → C satisfying pj = g . It remains to show that ji = f . By the definition of isofibration, we have ji = s gθ ◦ i = s gθi ; and since s gθi = s g (id i ) = s id gi = s id pf , we deduce by normality that ji = s id pf = f as required. (cid:3) We now show that the liftings of the previous Proposition are stable under pullback in asuitable sense. Note that in order for this to make sense, it is crucial that Proposition 5.1.1gives us a choice of filler for each diagram like (41).
Proposition 5.1.2.
Suppose given a morphism h : X → Y in a -category K , togetherwith a diagram like (41) in the slice K /Y . Suppose that we are able to form the -pullbackof this diagram along h , yielding a diagram (42) h ∗ A h ∗ fh ∗ i h ∗ C h ∗ p h ∗ B h ∗ g h ∗ D in K /X . Then the pullback of the canonical filler for (41) along h is equal to the canon-ical filler for (42) , where the injective equivalence structure on h ∗ i and the isofibrationstructure on h ∗ p are those induced by pullback.Proof. Let us first make clear what the induced structures on h ∗ i and h ∗ p look like. Theinjective equivalence data for h ∗ i is simply given by applying h ∗ to the correspondingdata for i . The normal isofibration structure on h ∗ p is given as follows. Let us write h ! : K /X → K /Y for the 2-functor given by postcomposition with h . For any V ∈ K /Y whose 2-pullback h ∗ V along h exists, we have 2-natural bijections of categories(43) K /Y ( h ! U, V ) ∼ = K /X ( U, h ∗ V ).In particular, we have bijections between diagrams of the following two forms:(44) W gf α h ∗ C h ∗ p h ∗ D ↔ h ! W ¯ g ¯ f ¯ α C p D .So given an α as on the left of (44), we obtain a lifting for it by first transposing toobtain a 2-cell ¯ α as on the right of (44). We then apply the isofibration structure of p toobtain s ¯ α : h ! W → C and σ ¯ α : s ¯ α ⇒ ¯ g ; and finally, we transpose back using (43) to obtain s α : W → h ∗ C and σ α : s α ⇒ g . Now, consider the case where α in (44) is itself of theform h ∗ β for some β : u ⇒ pv : W → D in K /Y . When this is so, the corresponding ¯ α is,by naturality, equal to β ◦ ǫ W , where ǫ W : h ! h ∗ W → W is the transpose of id h ∗ W underthe bijection (43). It follows from the definition of isofibration that s ¯ α = s β ◦ ǫ W = s β ◦ ǫ W and likewise σ ¯ α = σ β ◦ ǫ W ; whereupon transposing under (43) and using naturality,we have s h ∗ β = h ∗ ( s β ) and σ h ∗ β = h ∗ ( σ β ). Now, according to Proposition 5.1.1, thecanonical filler for (42) is given by s ( h ∗ g )( h ∗ θ ) = s h ∗ ( gθ ) ; and by the above argument thisis equal to h ∗ ( s gθ ), which is precisely the pullback along h of the canonical filler for (41),as required. (cid:3) Identity types.
For the rest of the section, we fix a model of two-dimensional typetheory C . We are going to give semantic analogues of each of the logical constructors ofML in C . We start with the identity types.5.2.1. Formation rule.
Given Γ ∈ C and A ∈ T (Γ), we define the semantic identity type on A to be the object Id A ∈ T (Γ .A.A ) whose existence is assured by Definition 4.6.1. WO-DIMENSIONAL MODELS OF TYPE THEORY 35
Introduction rule.
We recall that the object Γ .A.A. Id A ∈ C , together with the maps s := π π Id A and t := π π Id A : Γ .A.A. Id A → Γ .A , is an arrow object for Γ .A in C / Γ. Asin Proposition 4.1.1, we write κ : s ⇒ t for the corresponding universal 2-cell. Applyinguniversality of κ to the 2-cell Γ .A π A ididid Γ .A π A Γin C / Γ, we obtain a morphism r A : Γ .A → Γ .A.A. Id A which factorises the diagonal: wehave π Id A r A = δ A : Γ .A → Γ .A.A . We call this r A the semantic introduction rule for Id A .5.2.3. Elimination and computation rules.
With reference to Table 1, we require semanticanalogues of the premisses C and d of the rule Id -elim . These are given by an object C ∈ T (Γ .A.A. Id A ) and a map d : Γ .A → Γ .A.A. Id A .C of C making the following diagramcommute:(45) Γ .A dr A Γ .A.A. Id A .C π C Γ .A.A. Id A id Γ .A.A. Id A .To give a semantic analogue of the conclusion J d , satisfying the analogue of the com-putation rule, amounts to giving a filler J d : Γ .A.A. Id A → Γ .A.A. Id A .C making bothsides of (45) commute. Now, by Proposition 3.4.7, π C is a normal isofibration in C / Γ;so that if we can show that r A is an injective equivalence in C / Γ, then we may ob-tain the required filler J d by an application of Proposition 5.1.1. To show that r A isan injective equivalence in C / Γ, we must first give a retraction of r A over Γ. We takethis to be t : Γ .A.A. Id A → Γ .A (though we could equally well have chosen s ); and wehave that tr A = id Γ .A as required. Next we need a 2-cell θ : id ⇒ r A t over Γ satisfying θr A = id r A and tθ = id t . For this, we consider the following diagram of 1- and 2-cellsΓ .A.A. Id A → Γ .A : s κκ sr A t id t t id t tr A t .Because tr A = sr A = id Γ .A , this diagram is commutative: and so by the two-dimensionalaspect of the universal property of Γ .A.A. Id A , is induced by a 2-cell θ : id ⇒ r A t over Γsatisfying sθ = κ and tθ = id t . It remains to verify that θr A = id r A . By the uniquenesspart of the universal property of Γ .A.A. Id A , it suffices to show that κ ◦ θr A = κ ◦ id r A .But here we have κθ = κ ( r A t ) ◦ sθ = id t ◦ κ = κ and so κ ◦ θr A = κr A = κ ◦ id r A asrequired.5.2.4. Stability rules.
We now verify that the semantic identity rules given above arestable under semantic substitution. So suppose given f : ∆ → Γ in C together with A ∈ T (Γ). We must verify three things. First we must show that reindexing Γ .A.A. Id A along f yields ∆ .f ∗ A.f ∗ A. Id f ∗ A . This follows immediately from the stability requirements of Proposition 4.1.2. Next, we must show that the semantic introduction rule r f ∗ A is thereindexing along f of r A . This follows from the fact that arrow object structure on Id f ∗ A is the reindexing of that on Id A along f . Finally, we must show that applications ofthe semantic elimination rule are stable under substitution. So suppose given a diagramlike (45). If we view this as a diagram in C / Γ, then we can reindex it along f to yield adiagram(46) ∆ .f ∗ A f ∗ dr f ∗ A ∆ .f ∗ A.f ∗ A. Id f ∗ A .Cf π Cf ∆ .f ∗ A.f ∗ A. Id f ∗ A id ∆ .f ∗ A.f ∗ A. Id f ∗ A in C / ∆. We must show that pulling back the assigned filler for (45) along f yields theassigned filler for (46). Now, by the stability properties of Proposition 3.4.10, we knowthat the isofibration structure on π Cf qua map of C / ∆ is the one induced by pullingback along f the isofibration structure of π C qua map of C / Γ. Moreover, by the stabilityof the arrow object structure of Id A , the injective equivalence structure on r f ∗ A is theone induced by pulling back that of r A along f . The result now follows by applyingProposition 5.1.2.5.2.5. Remark.
Because Γ .A.A. Id A is an arrow object in C / Γ .A , we will in what followspass back and forward without comment between morphisms h : Λ → Γ .A.A. Id A and2-cells γ : sh ⇒ th : Λ → Γ .A over Γ.5.2.6. Discrete identity rules.
We now show that the semantic identity rules given abovesatisfy the semantic equivalents of the rules in Table 2. So suppose given Γ ∈ C and A ∈ T (Γ) as before. The semantic analogues of the premisses of the rules in Table 2 area pair of morphisms a, b : Γ → Γ .A of C over Γ, together with a 2-cellΓ pq α Γ .A.A. Id A satisfying sp = sq = a , sα = id a , tp = tq = b and tα = id b . We must show that underthese circumstances we have p = q and α = id p . So consider the following diagram of 1-and 2-cells Γ → Γ .A : sp sακp sq κq tp tα tq .It is commutative, with both sides equal to κα : sp ⇒ tq ; but since sα = id a and tα = id b ,we deduce that κα = κp = κq : a ⇒ b . By the uniqueness part of the universal propertyof κ , this entails that p = q : Γ → Γ .A.A. Id A . Moreover, we have κα = κp = κ id p , and soagain by the uniqueness part of the universal property of κ , we deduce that α = id p asrequired.5.3. Unit types.
WO-DIMENSIONAL MODELS OF TYPE THEORY 37
Formation rule.
Given Γ ∈ C , we define the semantic unit type at Γ to be theobject Γ ∈ T (Γ) whose existence is assured by Definition 4.6.1.5.3.2. Introduction rule.
Recall that Γ is a retract bireflection of id Γ : Γ → Γ along the2-functor E (Γ) : T (Γ) → C / Γ; so in particular, we have a unit map u Γ : Γ → Γ . Γ over Γ,and we call this the semantic introduction rule for Γ .5.3.3. Elimination and computation rules.
Suppose given C ∈ T (Γ . Γ ) and a map d : Γ → Γ . Γ .C of C fitting into a commutative diagramΓ du Γ . Γ .C π C Γ . Γ id Γ . Γ .The semantic elimination rule will assign to this data a filler U : Γ . Γ → Γ . Γ .C makingboth triangles commute. Because π C is an isofibration in C / Γ, it suffices to show that u Γ isa injective equivalence in C / Γ, since then we obtain the desired filler by Proposition 5.1.1.First we must give a retraction for u Γ over Γ. We take this to be k := π Γ : Γ . Γ → Γ,which satisfies ku Γ = id Γ as required. We now give a 2-cell θ : id Γ . Γ ⇒ u Γ k satisfying θu Γ = id u Γ and kθ = id k . By the two-dimensional aspect of the universal propertyof Γ , every 2-cell α : id Γ . Γ ◦ u Γ ⇒ u Γ k ◦ u Γ is of the form ¯ α ◦ u Γ for a unique 2-cell¯ α : id Γ . Γ ⇒ u Γ k . But because id Γ . Γ ◦ u Γ = id u Γ = u Γ ◦ id Γ = u Γ ku Γ , we have inparticular the 2-cell θ := id u Γ : id Γ . Γ ⇒ u Γ k ; which by definition satisfies θu Γ = id u Γ .That it also satisfies kθ = id k follows from the fact that θ is a 2-cell of C / Γ.5.3.4.
Stability rules.
We must show that the semantic unit rules are stable under se-mantic substitution. This follows by an argument entirely analogous to that of § Sum types.
Formation rule.
Given Γ ∈ C , A ∈ T (Γ) and B ∈ T (Γ .A ), we define the semanticsum type of A and B to be the object Σ A ( B ) ∈ T (Γ) whose existence is assured byDefinition 4.6.1.5.4.2. Introduction rule. Σ A ( B ) is a retract bireflection of B ∈ T (Γ .A ) along the 2-functor T ( π A ) : T (Γ) → T (Γ .A ); and so, as in Proposition 4.4.2, we obtain from the unitof this bireflection a map i : Γ .A.B → Γ . Σ A ( B ) of C / Γ. We declare this map to be the semantic introduction rule for Σ A ( B ).5.4.3. Elimination and computation rules.
We consider C ∈ T (Γ . Σ A ( B )) and a map d : Γ .A.B → Γ . Σ A ( B ) .C of C fitting into a commutative diagramΓ .A.B di Γ . Σ A ( B ) .C π C Γ . Σ A ( B ) id Γ . Σ A ( B ).To give the semantic elimination rule satisfying the semantic computation rule is nowto give a filler E : Γ . Σ A ( B ) → Γ . Σ A ( B ) .C making both triangles commute. We know that π C is an isofibration in C / Γ, whilst Definition 4.6.1 assures us that i is an injectiveequivalence in C / Γ: thus we obtain the desired filler by applying Proposition 5.1.1.5.4.4.
Stability rules.
We must show that the semantic rules for dependent sums arestable under semantic substitution. Again, this follows by an argument analogous tothat of § Product types.
Finally, we give semantic analogues in C of the rules for the prod-uct types. As in the one-dimensional case, there is a slight mismatch here between thesyntax and the semantics. This means that, in addition to the right biadjoints to weak-ening, we will also need to make use of the semantic unit types of § § Formation rule.
For Γ ∈ C , A ∈ T (Γ) and B ∈ T (Γ .A ), we define the semanticproduct type of A and B to be the object Π A ( B ) ∈ T (Γ) whose existence is assured byDefinition 4.6.1.5.5.2. Application rule. Π A ( B ) is a retract bicoreflection of B ∈ T (Γ .A ) along ∆ A := T ( π A ) : T (Γ) → T (Γ .A ). The counit of this bicoreflection is a morphism ǫ : ∆ A Π A ( B ) → B of T (Γ .A ). We define the semantic application rule for Π A ( B ) to be the correspondingmorphism ǫ : Γ .A. Π A ( B ) → Γ .A.B of C / Γ .A .5.5.3. Abstraction and β -rules. For this, we suppose given, as in the premiss of theabstraction rule, a morphism f : Γ .A → Γ .A.B over Γ .A . We are required to producefrom this a map λ ( f ) : Γ → Γ . Π A ( B ) over Γ; which, in order for the β -rule to hold,should satisfy ǫ ◦ ∆ A ( λ ( f )) = f . So consider the unit type Γ .A ∈ T (Γ .A ). Applyingits universal property to f : Γ .A → Γ .A.B yields a morphism f : Γ .A. Γ .A → Γ .A.B overΓ .A satisfying f ◦ u Γ .A = f . We can view f as a morphism Γ .A → B of T (Γ .A ); which bythe stability of unit types under substitution is equally well a morphism f : ∆ A Γ → B of T (Γ .A ). Applying the universal property of Π A ( B ) to this, we obtain a morphism f : Γ → Π A ( B ) of T (Γ) satisfying ǫ ◦ ∆ A ( f ) = f . This is equally well a morphismΓ . Γ → Γ . Π A ( B ) over Γ, so we can now define the map λ ( f ) : Γ → Γ . Π A ( B ) over Γ to be λ ( f ) := f ◦ u Γ . It remains to show that we have ǫ ◦ ∆ A ( λ ( f )) = f ; for which we calculatethat ǫ ◦ ∆ A ( λ ( f )) = ǫ ◦ (cid:0) ∆ A ( f ) ◦ ∆ A ( u Γ ) (cid:1) = f ◦ u Γ .A = f as required. Here we have used the fact that, by stability of unit types under substitution,we have ∆ A ( u Γ ) = u Γ .A .5.5.4. Function extensionality rules.
We now give semantic analogues of the rules ofTable 3. For the first rule Π- ext , we suppose given morphisms m, n : Γ → Γ . Π A ( B ) overΓ, together with a 2-cell p : ǫ ◦ ∆ A ( m ) ⇒ ǫ ◦ ∆ A ( n ) : Γ .A → Γ .A.B over Γ .A . We must produce from this a 2-cell ext ( p ) : m ⇒ n . First we apply the universalproperty of the unit type Γ to m and n to obtain morphisms m, n : Γ . Γ → Γ . Π A ( B )over Γ. These satisfy m = m ◦ u Γ and n = n ◦ u Γ , and so we can view p as a 2-cell p : ǫ ◦ ∆ A ( m ) ◦ u Γ .A ⇒ ǫ ◦ ∆ A ( n ) ◦ u Γ .A : Γ .A → Γ .A.B , WO-DIMENSIONAL MODELS OF TYPE THEORY 39 where again we use stability of unit types under pullback to derive that ∆ A ( u Γ ) = u Γ .A .By the two-dimensional aspect of the universal property of Γ .A , we have p = p ◦ u Γ .A for a unique 2-cell p : ǫ ◦ ∆ A ( m ) ⇒ ǫ ◦ ∆ A ( n ) : Γ .A. Γ .A → Γ .A.B .Now, by the two-dimensional aspect of the universal property of Π A ( B ), we have that p = ǫ ◦ ∆ A ( p ) for a unique p : m ⇒ n . We now define the 2-cell ext ( p ) to be given by p ◦ u Γ : m ⇒ n .In order for ext to satisfy the analogue of the rule Π -ext-comp , we must show thatwhen m = n and p = id ǫ ◦ ∆ A ( m ) , we have ext ( p ) = id m . It suffices for this to showthat (with the above notation) p = id m : m ⇒ m ; which, by applying successively theuniversal properties of Π A ( B ) and Γ .A , follows from the fact that ǫ ◦ ∆ A ( p ) ◦ u Γ .A = p is an identity 2-cell. Finally, we must verify that ext satisfies the analogue of the ruleΠ -ext-app . Recall from § ∗ appearing in Π -ext-app is simplythe lifting of ǫ : Γ .A. Π A ( B ) → Γ .A.B to identity types. From this it follows that we mustverify that ǫ ◦ ∆ A ( ext ( p )) = p : ǫ ◦ ∆ A ( m ) ⇒ ǫ ◦ ∆ A ( n ). We calculate that ǫ ◦ ∆ A ( ext ( p )) = ǫ ◦ (cid:0) ∆ A ( p ) ◦ ∆ A ( u Γ ) (cid:1) = p ◦ u Γ .A = p as required.5.5.5. Stability rules.
We must now show that the semantic rules for dependent prod-ucts are stable under semantic substitution. This follows by an argument analogous tothat of § The internal language.
We now define the type theory S( C ) associated to ourtwo-dimensional model C . It is obtained by recursively extending ML with additionalinference rules. These inference rules are “axiom” rules with no premisses, and so maybe specified by giving only their conclusion. First we have rules introducing new types: • For each A ∈ T (1) we add a judgement ⊢ A type . • For each A ∈ T (1), B ∈ T (1 .A ) we add a judgement x : A ⊢ B ( x ) type . • And so on.Then we have rules introducing new terms: • For each A ∈ T (1), a ∈ A , we add a judgement ⊢ a : A . • For each A ∈ T (1), B ∈ T (1 .A ), b ∈ .A B , we add a judgement x : A ⊢ b ( x ) : B ( x ). • And so on.Here, we use the convention for global sections developed in Notation 3.1.1. Next wehave rules identifying the syntactic notions of substitution, weakening, contraction andexchange with their semantic counterparts in C . We give the case of substitution as arepresentative sample. First we deal with substitution in types: • For each A ∈ T (1), B ∈ T (1 .A ), a ∈ .A , we add a judgement ⊢ B ( a ) = a ∗ B type . • For each A ∈ T (1), B ∈ T (1 .A ), C ∈ T (1 .A.B ), b ∈ .A B , we add a judgement x : A ⊢ C ( x, b ( x )) = b ∗ C type . • For each A ∈ T (1), B ∈ T (1 .A ), C ∈ T (1 .A.B ) and a ∈ A , we add a judgement y : B ( a ) ⊢ C ( a, y ) = ( a.ι ) ∗ C type . • And so on.And now substitution in terms: • For each A ∈ T (1), B ∈ T (1 .A ), a ∈ A , b ∈ .A B , we add ⊢ b ( a ) = a ∗ b : B ( a ). • For each A ∈ T (1), B ∈ T (1 .A ), C ∈ T (1 .A.B ), b ∈ .A B , c ∈ .A.B C , we add x : A ⊢ c ( x, b ( x )) = b ∗ c : C ( x, c ( x )). • For each A ∈ T (1), B ∈ T (1 .A ), C ∈ T (1 .A.B ), a ∈ A , c ∈ .A.B C , we add y : B ( a ) ⊢ c ( a, y ) = ( a.ι ) ∗ c : C ( a, y ). • And so on.Finally, we have rules identifying each of the logical rules of ML with its semanticcounterpart in C . We give only the case of the identity types; the remainder follow thesame pattern. First we have the formation rules. • For each A ∈ T (1), we add x, y : A ⊢ Id A ( x, y ) = Id A ( x, y ) type . • For each A ∈ T (1), B ∈ T (1 .A ), we add x : A, y, z : B ( x ) ⊢ Id B ( x ) ( y, z ) = Id B ( x, y, z ) type . • And so on.Next we have the introduction rule. We observe that for A ∈ T (Γ), the semantic intro-duction rule r A : Γ → Γ .A.A. Id A over Γ can be viewed as a global section r A ∈ Γ δ ∗ A ( Id A ),where δ A : Γ .A → Γ .A.A is the diagonal morphism. Thus we may add the following rules: • For each A ∈ T (1), we add x : A ⊢ r( x ) = r A ( x ) : Id A ( x, x ). • For each A ∈ T (1), B ∈ T (1 .A ), we add x : A, y : B ( x ) ⊢ r( y ) = r B ( x, y ) : Id B ( x ) ( y, y ). • And so on.Finally we come to the identity elimination rule. • For each A ∈ T (1), C ∈ T (1 .A.A. Id A ) and d : 1 .A → .A.A. Id A .C as in (45)(which is equally well a global section d ∈ .A r ∗ A C ), we add x, y : A, p : Id A ( x, y ) ⊢ J d ( x, y, p ) = J d ( x, y, p ) : C ( x, y, p ). • And so on.Now, in order for the internal language we have set up to be of any use, we require itstypes and terms to denote unique elements of the model C . The next Proposition tellsus that this is the case. Proposition 5.6.1 (Soundness) . For any
B, C ∈ T (1 .A .A . . . A n ) , if the judgement x : A .A . . . A n ⊢ B ( x ) = C ( x ) type is derivable, then B = C . Likewise, for global sections b, c ∈ .A ...A n B , if the judgement x : A .A . . . A n ⊢ b ( x ) = c ( x ) : B ( x ) is derivable, then b = c .Proof. By induction on the derivation of the judgement in question, it suffices to showthat the semantic counterpart of each syntactic equality rules is satisfied. For the non-logical equality rules, this is standard (though delicate), and we refer the reader to [15]or [26] for the details (note that we make essential use of the fact that the underlying1-fibration of T → C is split). The other cases we must consider are the computationrules of Tables 1, 2 or 3, and the rules expressing stability of the logical operations undersubstitution; and each of these has been dealt with in the preceding sections. (cid:3) WO-DIMENSIONAL MODELS OF TYPE THEORY 41
Remark . Observe that the internal language S( C ) does not give us access to allof the model C : it only allows us to talk about objects of the base 2-category C whichhave the form 1 .A . . . A n (where 1 is the given 2-terminal object). There are two waysaround this. We can modify the syntax of our type theory so that contexts and contextmorphisms are primitive, rather than derived, notions. Then each object or morphismof C corresponds directly to a context or context morphism of S( C ). Alternatively, wecan keep our type theory the same, and instead work with relative internal languages.Given Γ ∈ C , the relative internal language S Γ ( C ) is the type theory whose closed typesare objects of T (Γ), with dependent types being objects of T (Γ .A ), T (Γ .A.B ) and so on.Moreover, because each morphism Γ → ∆ of C induces an interpretation (in the senseof § ∆ ( C ) → S Γ ( C ), we obtain what is in an obvious sense a “ C -indexed typetheory” .5.7. Functorial aspects.
In Sections 3 and 4, we constructed from each type theory Sincorporating ML a two-dimensional model C (S); whilst in the preceding parts of thepresent Section, we have constructed from each two-dimensional model C a type theoryS( C ) incorporating ML . It is natural to ask whether these assignations give rise to a functorial semantics in the spirit of [24]. That is, can we define a syntactic category oftype theories and a semantic category of models for which the above assignations underliean equivalence of categories? We finish the paper by sketching a positive answer to thisquestion.We first define a syntactic category Th . Its objects are the generalised algebraictheories [5] over ML . These are defined inductively by the following three clauses. Eachobject of Th is a sequent calculus; ML ∈ Th ; and if S ∈ Th , then so is any extension ofS. Here, an extension of S is given by adjoining a set of inference rules each of which hasno premisses and a conclusion J which obeys the following requirements. If J is of theform Γ ⊢ A type then A must be fresh for S and Γ must be a well-formed context of S; if J is of the form Γ ⊢ a : A then a must be fresh for S and Γ ⊢ A type must be derivable inS; if J is of the form Γ ⊢ A = B type then Γ ⊢ A type and Γ ⊢ B type must be derivablein S; and finally if J is of the form Γ ⊢ a = b : A then Γ ⊢ a : A and Γ ⊢ b : A must bederivable in S. Note that the assignation C S( C ) sends each two-dimensional modelto a GAT over ML .The morphisms of Th are equivalence classes of interpretations. Given S , T ∈ Th , an interpretation F : S → T is a function F taking derivable judgements of S to derivablejudgements of T, subject to the following requirements. Each F ( A type ) should havethe form F A type ; each F ( a : A ) should have the form F a : F A ; each F ( A = B type )should have the form F A = F B type ; and each F ( a = b : A ) should have the form F a = F b : F A . Moreover, if we suppose F (Γ ⊢ A type ) has the form F Γ ⊢ F A type ,then each F (Γ , x : A ⊢ B ( x ) type ) should have the form F Γ , x : F A ⊢ F B ( x ) type ;each F (Γ , x : A ⊢ b ( x ) : B ( x )) should have the form F Γ , x : F A ⊢ F b ( x ) : F B ( x );and similarly for the two equality judgement forms. Finally we require that F shouldcommute with all the inference rules of ML . We give the case of the rule of Id -formationfor illustration. Suppose given a derivable judgement Γ ⊢ A type in S. We write itsimage under F as F Γ ⊢ F A type , and the image of Γ , x, y : A ⊢ Id A ( x, y ) type as A finer analysis shows that this is really a two-dimensional indexing. That is, we have a trihomomor-phism C coop → Th , where Th is a suitably-defined tricategory of two-dimensional theories. F Γ , x, y : F A ⊢ F Id A ( x, y ) type . Now the following judgement should be derivable in T: F Γ , x, y : F A ⊢ Id F A ( x, y ) = F Id A ( x, y ) type .The equivalence relation we impose on interpretations identifies F, G : S → T if theydiffer only up to definitional equality in the obvious sense. It is now straightforward toshow that GATs and equivalence classes of interpretations form a category Th . Remark . Using the above notion of interpretation, we can now say what it meansto give an interpretation of a GAT T in a two-dimensional model C : namely, to give aninterpretation (in the above sense) T → S( C ). It is easy to check that this accords withthe intuitive syntactic notion we would give.We now define a semantic category Mod . Its objects are models of two-dimensionaltype theory as in Definition 4.6.1. A morphism F : C → C ′ is given by a pair of 2-functors F : C → C ′ and F : T → T ′ rendering commutative the squares T F p T ′ p ′ C F C ′ and T F E T ′ E ′ C F ( C ′ ) and preserving all the additional structure on the nose. Proposition 5.7.2.
The assignations S C (S) and C S( C ) underlie functors C ( – ) : Th → Mod and S( – ) : Mod → Th .Proof. Given an interpretation F : S → T, we define functors G : C (S) → C (T) and G : T (S) → T (T) by an obvious structural induction over the objects and morphisms ofthe domain categories. In order to extend these functors to 2-functors, we first show byinduction that every object Γ ∈ C (S) has an accompanying arrow object given by theidentity context Id Γ . But now, since F preserves the identity type structure, the corre-sponding G will preserve these arrow objects; hence we may extend G to a 2-functor byregarding each 2-cell of C (S) as a 1-cell into an arrow object, mapping this 1-cell over andthen turning the resulting 1-cell back into a 2-cell of C (T). Because the comprehension 2-functors of C (S) and C (T) are 2-fully faithful, this in turn determines the extension of G to a 2-functor. Finally, the fact that F strictly preserves the remaining structure impliesthat the same is true of ( G , G ), and so we obtain a morphism of models C (S) → C (T)as required.Conversely, given a morphism of models F : C → C ′ , we may define an interpretationS( C ) → S( C ′ ) as follows. By structural induction, every closed type A of S( C ) is def-initionally equal to one of the form X for some X ∈ T (1); and by Proposition 5.6.1,this X is unique. Thus we may define the image of A under the interpretation to bethe type G ( X ) of S( C ′ ). Similarly, every closed term a : A of S( C ) is definitionallyequal to one of the form x : X for a unique map x : 1 → .X of C , and so we maydefine F ( a ) to be the term G ( x ) : G ( X ). This definition extends to types and termsin non-empty contexts in an obvious way. Finally, the fact that our morphism of modelspreserves all the remaining structure on the nose implies the same for the interpretationjust described. (cid:3) WO-DIMENSIONAL MODELS OF TYPE THEORY 43
However, the functors defined in this Proposition do not give rise to an equivalence ofcategories. There are two reasons for this. The first is the issue raised in Remark 5.6.2.Observe that any two-dimensional model in the image of C (–) has the property that eachobject Γ ∈ C is of the form 1 .A . . . A n for a unique (possibly empty) sequence of objects A ∈ T (1) , . . . , A n ∈ T (1 .A . . . A n − ). This is the “tree condition” of [5]. Clearly notevery two-dimensional model has this property, so that if we are to obtain an equivalence,we must first cut down to the full sub-2-category Mod tr ⊂ Mod on those which do. Thesecond reason we do not obtain an equivalence is more subtle. In order for Th ≃ Mod tr to hold, we must certainly have for each S ∈ Th that S( C (S)) ∼ = S. However, this turnsout not to be the case: we run into problems with the terms witnessing the eliminationrules. As an illustration, we will show that ML ≇ S( C (ML )). Because the object ML is initial in Th , there is a unique morphism F : ML → S( C (ML )): and so it sufficesto show that F is not surjective. First observe that by -elimination we can derive ajudgement(47) z : ⊢ U ⋆ ( z ) : in ML . Next note that the judgements of S( C (ML )) are simply equivalence classesof judgements of ML with respect to definitional equality; and so by passing to thequotient, we obtain from (47) a judgement(48) z : [ ] ⊢ [U ⋆ ]( z ) : [ ]of S( C (ML )). The crucial point is that (48) does not coincide with the value of F atthe judgement (47). This latter can be described as follows. First we derive a term z : ⊢ φ ( z ) : Id ( z, ⋆ ) in ML by -elimination, taking φ ( z ) := U r( ⋆ ) ( z ). Now by thedescription of the semantic unit types given in § F to (47) yields(up to definitional equality) the following judgement in S( C (ML )):(49) z : [ ] ⊢ [ φ ( z ) ∗ ( ⋆ )] : [ ].Now, if (49) were definitionally equal to (48), then we would also have that z : ⊢ U ⋆ ( z ) = φ ( z ) ∗ ( ⋆ ) : in ML , and this is not the case. Hence F applied to (47) does notyield (48), from which it follows by induction over derivable judgements of ML that (48)cannot lie in the image of F : ML → S( C (ML )).There are several ways in which we can resolve this issue. The first is for us to changeour notion of model so that it accords more closely with the type theory. This is unsatis-factory, as we have then reverted to a categorical paraphrasing of type theoretic syntax.A second alternative is to change our notion of type theory so that it accords more closelywith the categorical model. This involves removing the elimination rules altogether, andinstead taking the Leibniz rule, together with the injective equivalence structures onthe introduction terms, as primitives. This is unsatisfactory for a more subtle reason.Whilst it may be reasonably straightforward to give this alternative presentation fortwo-dimensional type theory, we would find as we moved towards full intensional typetheory that it would require a more and more intricate set of rules expressing appropriatecoherence properties of our new primitives. The elegant simplicity of intensional typetheory would be lost completely.A third solution, and our preferred one, is to equip our categories of theories andof models with more generous notions of morphism, ones which preserve some of thestructure only up to propositional, rather than definitional equality. There is a great deal of scope in how far we go with this. In the present paper, we make only the mini-mal modifications necessary to obtain the desired equivalence. A fuller treatment wouldtake account of the fact that our models and theories are themselves two-dimensionalstructures, so that their respective totalities should give rise not merely to equivalent cat-egories, but also to triequivalent Gray -categories (=semi-strict 3-categories) in the senseof [11]. Adopting this more comprehensive approach would be necessary if, for instance,we wished to study the 2-category of interpretations of some generalised algebraic theoryinside a particular two-dimensional model. However, for our present purposes, we do notneed to go this far; and so, in the interests of brevity, we do not.The minimal modification that we will consider is given as follows. On the syntacticside, we define a category Th ψ with as objects GATs over ML and as maps F : S → T pseudo-interpretations , whose definition generalises that of an interpretation by droppingthe requirement that F should preserve each of the following rules up to definitionalequality: -elim , Id -elim , Σ -elim , and Π -abs . One may now think that, in order tojustify the name pseudo-interpretation, we should ask for F to preserve these rules atleast up to propositional equality; but it turns out that this is unnecessary, because thisweaker form of preservation is a consequence of the type-theoretic elimination rules.On the semantic side we define a category Mod ψ whose objects are two-dimensionalmodels, and whose maps F : C → C ′ are pseudo-morphisms . These are obtained by relax-ing in the definition of morphism of models the requirement that the following structureshould be preserved: the normal isofibration structures on dependent projections π A ; theinjective equivalence structures on the maps i : Γ .A.B → Γ . Σ A ( B ) associated to depen-dent sums; and the assignations f f on 1-cells associated to the unit types, dependentsums, and dependent products. Once again, we do not need to add conditions requiringthese pieces of structure to be preserved up to isomorphism, since this will be an auto-matic consequence of the remaining structure. As before, we write ( Mod ψ ) tr for the fullsubcategory of Mod ψ on those models satisfying the tree condition. Proposition 5.7.3.
The functors C ( – ) and S( – ) extend to functors Th ψ → ( Mod ψ ) tr and ( Mod ψ ) tr → Th ψ respectively.Proof. The argument of Proposition 5.7.2 carries over almost entirely unmodified. Theonly subtlety arises in defining the pseudo-morphism of models C (S) → C (T) correspond-ing to a pseudo-interpretation F : S → T. As before, we define functors G and G byinduction on the objects and morphisms of C (S); but when it comes to extending theseto 2-functors, we encounter the problem that the interpretation F , since it no longerpreserves the rule Id -elim , may not send identity contexts to identity contexts. However,using the fact that Id -elim is preserved at least up to propositional equality, we mayshow by induction that F will send an identity context to something isomorphic to anidentity context. From this, it follows that G will still preserve arrow objects, so thatwe may continue the argument as before. (cid:3) But now we have that:
Proposition 5.7.4.
The functors C ( – ) and S( – ) induce an equivalence of categories ( Mod ψ ) tr ≃ Th ψ .Proof. First observe that if C is a model satisfying the tree condition, then the contextsand context morphisms of S( C ) are, up to definitional equality, just the objects and mor-phisms of C , whilst the types-in-context of S( C ) are just the objects of T . From this it WO-DIMENSIONAL MODELS OF TYPE THEORY 45 follows that S(–) is fully faithful. Indeed, given a pseudo-interpretation F : S( C ) → S( C ′ ),our observation allows us to define functors G : C → C ′ and G : T → T ′ . As in thelast proof, the pseudo-interpretation F must send an identity context to something iso-morphic to an identity context; from which it follows that G preserves arrow objects,allowing us to extend G and G to 2-functors as before. It is now easy to verify that theresultant pair ( G , G ) is a pseudo-morphism; and by examining the proof of Proposi-tion 5.7.2, we see that it is sent by S(–) to F and that it is the unique pseudo-morphismwith this property.It remains to show that for each S ∈ Th ψ we have an isomorphism S ∼ = S( C (S)) in Th ψ , and that these are natural in S. Now, up to definitional equality, the judgementsof S( C (S)) are the same as those of S; and so we obtain mutually inverse assignationsbetween the judgements of the former and those of the latter. Moreover, by followingthrough the constructions of C (–) and S(–), we see that all of the logical structure ofS( C (S)) is given as in S, with the possible exception of the rules -elim , Id -elim , Σ -elim ,and Π -abs (as seen in the discussion following Proposition 5.7.2). But this says preciselythat these mutually inverse assignations are pseudo-interpretations, and so give rise to anatural isomorphism S ∼ = S( C (S)) in Th ψ as required. (cid:3) References [1]
Aczel, P.
Notes towards a formalisation of constructive Galois theory, 1994. Manuscript, Universityof Manchester. 2[2]
Awodey, S., and Warren, M.
Homotopy theoretic models of identity types.
Mathematical Pro-ceedings of the Cambridge Philosophical Society 146 , 1 (2009), 45–55. 1, 2, 21, 33[3]
Bousfield, A.
Constructions of factorization systems in categories.
Journal of Pure and AppliedAlgebra 9 , 2-3 (1977), 207–220. 21[4]
Bruijn, N. d.
Telescopic mappings in typed lambda calculus.
Information and Computation 91 , 2(1991), 189–204. 4[5]
Cartmell, J.
Generalised algebraic theories and contextual categories.
Annals of Pure and AppliedLogic 32 (1986), 209–243. 8, 41, 43[6]
Dybjer, P.
Internal type theory. In
Types for proofs and programs (Torino, 1995) , vol. 1158 of
Lecture Notes in Computer Science . Springer, 1996, pp. 120–134. 1, 8[7]
Ehrhard, T.
Une s´emantique cat´egorique des type d´ependents. Application au Calcul des Construc-tions . PhD thesis, Universit´e Paris VII, 1988. 8[8]
Gambino, N.
Homotopy limits for 2-categories.
Mathematical Proceedings of the Cambridge Philo-sophical Society 145 , 1 (2008), 43–63. 21[9]
Gambino, N., and Garner, R.
The identity type weak factorisation system.
Theoretical ComputerScience 409 (2008), 94–109. 1, 21[10]
Garner, R.
On the strength of dependent products in the type theory of Martin-L¨of.
Annals ofPure and Applied Logic 160 (2009), 1–12. 1[11]
Gordon, R., Power, J., and Street, R.
Coherence for tricategories.
Memoirs of the AmericanMathematical Society 117 , 558 (1995). 16, 44[12]
Grandis, M., and Tholen, W.
Natural weak factorization systems.
Archivum Mathematicum 42 ,4 (2006), 397–408. 33[13]
Hermida, C.
Some properties of
Fib as a fibred 2-category.
Journal of Pure and Applied Algebra134 , 1 (1999), 83–109. 16[14]
Hofmann, M.
Elimination of extensionality in martin-l¨of type theory. In
Types for proofs andprograms (Nijmegen, 1993) , vol. 806 of
Lecture Notes in Computer Science . Springer, 1994, pp. 166–190. 2[15]
Hofmann, M.
Extensional concepts in intensional type theory . PhD thesis, University of Edinburgh,1995. 1, 40 [16]
Hofmann, M.
On the interpretation of type theory in locally cartesian closed categories. In
Com-puter science logic (Kazimierz, 1994) , vol. 933 of
Lecture Notes in Computer Science . Springer, 1995,pp. 427–441. 1, 2[17]
Hofmann, M., and Streicher, T.
The groupoid interpretation of type theory. In
Twenty-fiveyears of constructive type theory (Venice, 1995) , vol. 36 of
Oxford Logic Guides . Oxford UniversityPress, 1998, pp. 83–111. 1, 2, 11[18]
Hyland, J. M., and Pitts, A.
The theory of constructions: categorical semantics and topos-theoretic models. In
Categories in computer science and logic (Boulder, CO, 1987) , vol. 92 of
Con-temporary Mathematics . American Mathematical Society, 1989, pp. 137–199. 8[19]
Jacobs, B.
Comprehension categories and the semantics of type dependency.
Theoretical ComputerScience 107 , 2 (1993), 169–207. 8, 9, 38[20]
Jacobs, B.
Categorical logic and type theory , vol. 141 of
Studies in Logic and the Foundations ofMathematics . North-Holland Publishing Company, 1999. 4[21]
Kelly, G. M.
Basic concepts of enriched category theory , vol. 64 of
London Mathematical SocietyLecture Note Series . Cambridge University Press, 1982. 26[22]
Kelly, G. M.
Elementary observations on 2-categorical limits.
Bulletin of the Australian Mathe-matical Society 39 , 2 (1989), 301–317. 26[23]
Kelly, G. M., and Street, R.
Review of the elements of 2-categories. In
Category Seminar (Proc.Sem., Sydney, 1972/1973) , vol. 420 of
Lecture Notes in Mathematics . Springer, 1974, pp. 75–103. 8[24]
Lawvere, F. W.
Some algebraic problems in the context of functorial semantics of algebraic theories.In
Reports of the Midwest Category Seminar II , vol. 61 of
Lecture Notes in Mathematics . Springer,1968, pp. 41–61. 3, 41[25]
Nordstr¨om, B., Petersson, K., and Smith, J.
Programming in Martin-L¨of ’s Type Theory , vol. 7of
International Series of Monographs on Computer Science . Oxford University Press, 1990. 1, 3, 6[26]
Pitts, A. M.
Categorical logic. In
Handbook of Logic in Computer Science, Volume 5. Algebraicand Logical Structures , S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, Eds. Oxford UniversityPress, 2000, pp. 39–128. 40[27]
Seely, R.
Locally cartesian closed categories and type theory.
Mathematical Proceedings of theCambridge Philosophical Society 95 , 1 (1984), 33–48. 1[28]
Street, R.
Fibrations and Yoneda’s lemma in a 2-category. In
Category Seminar (Proc. Sem.,Sydney, 1972/1973) , vol. 420 of
Lecture Notes in Mathematics . Springer, 1974, pp. 104–133. 28[29]
Taylor, P.
Practical foundations of mathematics , vol. 59 of
Cambridge Studies in Advanced Math-ematics . Cambridge University Press, 1999. 8
Department of Pure Mathematics and Mathematical Statistics, Wilberforce Road, Cam-bridge CB3 0WB, UK
E-mail address ::