scieee AI-readable full text Open interactive document viewer

The identity type weak factorisation system

Gambino, Nicola; Garner, Richard

Abstract

We show that the classifying category C(T)of a dependent type theory T with axioms for identity types admits a nontrivial weak factorisation system. After characterising this weak factorisation system explicitly, we relate it to the homotopy theory of groupoids.

Full text

THE IDENTITY TYPE WEAK FACTORISATION SYSTEM NICOLA GAMBINO AND RICHARD GARNER Abstract. We show that the classifying category C(T) of a dependent type theory Twith axioms for identity types admits a nontrivial weak factorisation system. After characterising this weak factorisation system explicitly, we relate it to the homotopy theory of groupoids. 1. Introduction From the point of view of mathematical logic and theoretical computer science, Martin-L¨of’s axioms for identity types [24] admit a conceptually clear explanation in terms of the propositions-as-types paradigm [14, 21, 27]. The fundamental idea behind this explanation is that, for any two elements a, b of a type A, we have a new type IdA(a, b), whose elements are to be thought of as proofs that aand bare equal. Yet, identity types determine a highly complex structure on each type, which is far from being fully understood. A glimpse of this structure reveals itself as soon as we start applying the construction of identity types iteratively: not only do we have proofs of equality between two elements of a type, but also of proofs of equality between such proofs, and so on. The difficulty of isolating the structure determined by identity types is closely related to the problem of describing a satisfactory category-theoretic semantics for them. For example, the semantics arising from locally cartesian closed categories [9, 29] validates not only the axioms for identity types, but also additional axioms, known as the reflection rules, which make identity types essentially trivial. One approach to obtain a semantics of identity types that does not validate the reflection rules is to consider categories equipped with a weak factorisation system [2]. Our aim here is to advance our understanding of the categorical structure implicit in the axioms for identity types. We do so by providing further evidence of a close connection with the notion of a weak factorisation system. Our main result states that if Tis a dependent type theory Date: April 14, 2008. 1 2 N. GAMBINO AND R. GARNER with the axioms for identity types, then its classifying category C(T) admits a non-trivial weak factorisation system, which we shall refer to as the identity type weak factorisation system. This result should be regarded as analogous to the fundamental result exhibiting the structure of a cartesian closed category on the classifying category of the simply-typed lambda calculus [19, 28]. As such, it provides also a contribution to the development of a functorial semantics [20] for dependent type theories with identity types [2, 5, 7, 10, 15]. A remarkable feature of the identity type weak factorisation system is that its definition does not involve the notion of identity types, but only a canonical class of maps in C(T), to which we shall refer as dependent projections. Indeed, the axioms for identity types are used only to verify that the appropriate axioms hold. After having established the existence of the identity type weak factorisation system, we will provide an explicit characterisation of its classes of maps. This will lead us to two applications. The first establishes an unusual stability property of the identity type weak factorisation system; the second provides further insight into the relationship between dependent type theories with identity types and the category of groupoids, which we denote Gpd. The idea of relating identity types and groupoids dates back to the discovery of the groupoid model of type theory [12]. Indeed, Hofmann and Streicher noticed that the axioms for identity types allow us to equip each type with the structure of a groupoid. We develop this idea in three directions. First, we generalise it by exhibiting a groupoid structrure on each context, which we think of as a family of types, rather than on a single type. Secondly, we extend this construction to a functor F:C(T)→Gpd. Finally, we use the functor Fto relate the identity type weak factorisation system to the natural Quillen model structure on the category of groupoids [1, 17], by showing how the identity type weak factorisation system is mapped into the weak factorisation system determined by injective equivalences and Grothendieck fibrations in Gpd. 2. Identity types 2.1. The syntax of dependent type theories. The dependent type theories that we consider allow us to make judgements of four forms: (1) A∈Type , a ∈A , A =B∈Type , a =b∈A . They assert, respectively, that Ais a type, that ais an element of A, that A and Bare definitionally equal types, and that aand bare definitionally equal elements of A. We speak of definitional equality, rather than just equality, since the axioms for identity types will provide us with a second notion of THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 3 equality, which we will refer to as propositional equality. The distinction between definitional and propositional equality plays a fundamental role for our purposes. As usual, the judgements in (1) may also be made relative to contexts, which consist of lists of variable declarations of the form (2) Φ = x0∈A0, x1∈A1(x0), . . . , xn∈An(x0, . . . , xn−1). For the context in (2) to be well-formed, it is necessary that the variables x0, . . . , xnare distinct, and that the following sequence of judgements is derivable A0∈Type , (x0∈A0)A1(x0)∈Type , . . . (x0∈A0, . . . , xn−1∈An−1(x0, . . . , xn−2)) An(x0, . . . , xn−1)∈Type . From now on, whenever we mention contexts, we implicitly assume that they are well-formed. We write (Φ) Jto express that a judgement Jholds under the assumptions in Φ. The axioms for a dependent type theory will be stated here as deduction rules of the form (Φ1)J1· · · (Φn)Jn (Φ) J. The dependent type theories that we discuss here are always be assumed to include the basic axioms stated in Appendix A. For more information on dependent type theories, see [21, 23]. 2.2. The classifying category. We briefly recall the definition of the classifying category C(T) of a dependent type theory T. For a context Φ as in (2) and a context Ψ = (y0∈B0, . . . , ym∈Bm(y0, . . . , ym−1)), a context morphism f: Φ →Ψ consists of a sequence f= (b0, . . . , bm) such that the following judgements are derivable (Φ) b0∈B0, (Φ) b1∈B1(b0), . . . (Φ) bm∈Bm(b0, . . . , bm−1). We can define an equivalence relation on contexts by considering two contexts to be equivalent if they coincide up to renaming of their free variables and up to componentwise definitional equality. Similarly, we can define an equivalence relation on context morphisms by considering two context morphisms from Φ to Ψ to be equivalent if they concide up to renaming of the free variables in Φ and up to pointwise definitional equality. The classifying 4 N. GAMBINO AND R. GARNER category C(T) can then be defined as having equivalence classes of contexts as objects, and equivalence classes of context morphisms as maps. Composition is defined via substitution; and identity maps are defined in the evident way [25]. When working with C(T), we implicitly identify contexts and context morphisms up to the equivalence relations defined above, without introducing additional notation. The empty context, written ( ) here, is a terminal object in C(T). 2.3. Dependent contexts and dependent elements. To work with the category C(T) and its slices, it will be convenient to have some abbreviations for manipulating contexts, as developed in [6]. Let us consider a fixed context Γ. For a sequence of variable declarations as in (2), we write (Γ) Φ ∈ Cxt to abbreviate the following sequence of judgements (Γ) A0∈Type , (Γ, x0∈A0)A1(x0)∈Type , . . . (Γ, x0∈A0, . . . , xn−1∈An−1(x0, . . . , xn−1)) An(x0, . . . , xn−1)∈Type . When these are derivable, we say that Φ is a dependent context relative to Γ. Dependent contexts relative to the empty context are simply contexts. If we have a dependent context Φ relative to Γ, we obtain a new context (Γ,Φ) by concatenation, and an evident map (Γ,Φ) →Γ, projecting away the variables that are in Φ. Maps of this form will be referred to as dependent projections. The class of dependent projections may be understood as the closure under composition of the class of display maps [15, 32]. As we will see in Section 4, dependent projections play a crucial role in the definition of the identity type weak factorisation system. For a context Φ relative to Γ, as above, and a sequence a= (a0, a1, . . . , an), we write (Γ) a∈Φ to abbreviate the following sequence of judgements (Γ) a0∈A0, (Γ) a1∈A1(a0), . . . (Γ) an∈An(a0, . . . , an−1). When these can be derived, we say that ais a dependent element of Φ relative to Γ, and obtain a map a: Γ →(Γ,Φ) over Γ. The expressions (Γ) Φ ∈Cxt and (Γ) a∈Φ should be understood as counterparts of the first and second judgement in (1). It is also possible to introduce expressions (Γ) Φ = Ψ ∈Cxt and (Γ) a=b∈Φ that correspond to the third and fourth judgement in (1), respectively, so that the evident counterparts of the rules THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 5 in Appendix A hold. The details are essentially straightforward, and hence omitted. Remark 2.3.1.Let Φ be a context, or a dependent context, as in (2). We also write (x∈Φ) to denote Φ itself. We then write (x∈Φ, y ∈Φ) for the result of duplicating Φ and renaming the variables in the second copy to avoid clashes, so as to obtain the context x0∈A0, x1∈A1(x0), . . . , xn∈An(x0, . . . , xn−1), y0∈A0, y1∈A1(y0), . . . , yn∈An(y0, . . . , yn−1). 2.4. The axioms for identity types. The axioms for identity types are stated in Table 1. The axiom in (3) is referred to as the formation rule for identity types. It asserts that if Ais a type and a, b are elements of A, then IdA(a, b) is a type. We omit the subscript in expressions of the form IdA(a, b) when no confusion arises. If there exists an element p∈Id(a, b), then we say that aand bare propositionally equal. The axiom in (4) is referred to as the introduction rule for identity types. Elements of the form r(a)∈Id(a, a) are referred to as reflexivity elements. The axioms in (5) and (6) are referred to as the elimination rule and the computation rule, respectively. For brevity, we have omitted from their premisses the judgement x∈A, y ∈A, u ∈Id(x, y),Θ(x, y, u)C(x, y, u)∈Type . Here we are assuming that Θ(x, y, u) is a dependent context relative to the context (x∈A, y ∈A, u ∈Id(x, y)). We have highlighted the variables x, y, u in Θ(x, y, u) in order to describe their role in the deduction rules without using substitution. All the axioms in Table 1 should be understood as being relative to a context Γ that is common to both the premisses and the conclusion of the rules, which we leave implicit for brevity. Hence, all the constructions that we perform in C(T) may equally well take place in one of its slices. The presence of the implicit context Γ plays a role only when stating further axioms, which we assume but do not spell out, expressing commutation laws between the syntax of identity types and the substitution operation. For example, the first of these axioms allows us to derive a rule of the form (x∈A0)A1(x)∈Type (x∈A0)a1(x)∈A1(x) (x∈A)b1(x)∈A1(x)a0∈A0 IdA1(x)(a1(x), b1(x))[a0/x] = IdA1(a0)(a1(a0), b1(a0)) ∈Type . Since these axioms are essentially straightforward, we prefer to omit them. However, let us point out that the assumption of these axioms ensures that all the constructions that we perform, when regarded as taking place in one of the slices of C(T), are stable under pullbacks. 6 N. GAMBINO AND R. GARNER (3) A∈Type a∈A b ∈A IdA(a, b)∈Type (4) a∈A r(a)∈IdA(a, a) (5) p∈IdA(a, b) (x∈A, Θ(x, x, r(x))´d(x)∈C(x, x, r(x)) (Θ(a, b, p)) J(a, b, p, d)∈C(a, b, p) (6) a∈A(x∈A, Θ(x, x, r(x))) d(x)∈C(x, x, r(x)) (Θ(a, a, r(a)) J(a, a, r(a), d) = d(a)∈C(a, a, r(a)) Table 1. Deduction rules for identity types. Remark 2.4.1.The elimination and computation rules, as stated in Table 1, generalise the standard elimination and computation rules for identity types [24]. The latter can be obtained from the former by restricting the context Θ(x, y, u) to be empty. The reason for adopting the generalised rules instead of the standard ones is related to our preference for working without assuming the axioms for Π-types. Without Π-types, the standard rules are quite weak, since they do not seem to imply the Leibniz rule for propositional equality [24], whereas our generalised rules suffice, as shown in Lemma 2.5.1. Furthermore, the generalised rules become derivable from the standard ones in the presence of Π-types, so that our development applies also to dependent type theories with standard axioms for identity types and Π-types. Remark 2.4.2.We do not assume the rules in (7), to which we refer as the reflection rules. (7) p∈Id(a, b) a=b∈A p∈Id(a, b) r(a) = p∈Id(a, b) The first reflection rule was shown to be independent from the axioms for identity types in [12]. Note that the judgement r(a)∈Id(a, b), that is presupposed by the conclusion of the second reflection rule, is derivable by the first reflection rule and the standard rules concerning substitution, as given in Appendix A. The reflection rules are generally avoided, since they imply THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 7 that propositional equality and definitional equality collapse into equivalent notions, which has the effect of destroying the decidability of type-checking, one of the fundamental properties of dependent type theories [11]. As shown in [15, Proposition 10.1.3] extending [31, Theorem 1.1], the reflection rules are equivalent to the following rule p∈Id(a, b) (x∈A, y ∈A, u ∈Id(x, y),Θ(x, y, u)) e(x, y, u)∈C(x, y, u) (Θ(a, b, p)) J(a, b, p, [x]e(x, x, r(x))) = e(a, b, p)∈C(a, b, p) Here and in the following, expressions of the form [x]fdenote λ-abstractions in the metatheory. If the computation rule for identity types in (5) is understood as a version of the β-rule, then this rule can be understood as a version of the η-rule. 2.5. Identity contexts. One fundamental fact for our development is that, as shown in [8], the axioms for identity types can be used to construct what we will refer to as identity contexts. More precisely, there are explicit definitions such that all the rules in Table 2 are derivable. Because of their similarity with the axioms for identity types, we refer to (8) as the formation rule, to (9) as the introduction rule, to (10) as the elimination rule, and to (11) as the computation rule for identity contexts. When stating these rules, we leave again implicit a context Γ, to which all the notions are assumed to be relative. For example, in the introduction rule Φ may be assumed to be a context relative to Γ. When stating the elimination and computation rules, we are assuming that Φ has the form in (2) and using the notational conventions set in Remark 2.3.1. For a context Φ and a, b ∈Φ, we refer to a context of the form IdΦ(a, b) as an identity context. As before, we have omitted the judgement x∈Φ, y ∈Φ, u ∈IdΦ(x, y),Θ(x, y, u)Ω(x, y, u)∈Cxt from the premisses of the elimination and computation rules. From now on, we omit the subscript from expressions of the form IdΦ(a, b) if no confusion arises. It will be convenient to fix some terminology. When we use the elimination rule as in Table 2, we will say that we are applying the elimination rule on p∈Id(a, b). We then refer to the relative context Ω(x, y, u) as the eliminating context, and to das the eliminating family. Lemma 2.5.1 states a very useful property, to which we refer as the Leibniz rule for contexts, which is going to be used repeatedly in what follows. To prove it, we make use of the general formulation of the elimination and computation rules that we adopt here. 8 N. GAMBINO AND R. GARNER (8) a∈Φb∈Φ IdΦ(a, b)∈Cxt (9) a∈Φ r(a)∈IdΦ(a, a) (10) p∈IdΦ(a, b) (x∈Φ,Θ(x, x, r(x)) d(x)∈Ω(x, x, r(x)) (Θ(a, b, p)) J(a, b, p, d)∈Ω(a, b, p) (11) a∈Φ (x∈Φ,Θ(x, x, r(x))) d(x)∈Ω(x, x, r(x)) (Θ(a, a, r(a))) J(a, a, r(a), d) = d(a)∈Ω(a, a, r(a)) Table 2. Deduction rules for identity contexts. Lemma 2.5.1. We can derive a rule of the form p∈Id(a, b) (x∈Φ) Ω(x)∈Cxt e∈Ω(a) p!(e)∈Ω(b) such that a∈Φe∈Ω(a) (r(a))!(e) = e∈Ω(a) holds. Proof. We use elimination over p∈Id(a, b) with x∈Φ, y ∈Φ, u ∈Id(x, y), z ∈Ω(x)Ω(y)∈Cxt as the eliminating context. Since we have (x∈Φ, z ∈Ω(x)) z∈Ω(x) the elimination rule allows us to derive (z∈Ω(a)) J(a, b, p, [x]z)∈Ω(b). The required term p!(e) is defined as the result of substituting e∈Ω(a) for z∈Ω(a) in the expression J(a, b, p, [x]z), so that p!(e) = J(a, b, p, [x]e)∈Ω(b) The second rule is an immediate consequence of this definition and the computation rule.  THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 9 The Leibniz rule allows us to give a description of the identity contexts by induction on their length. For a context of length n= 1, the definition is straightforward: if Φ = (x∈A), then elements of Φ are the same as elements of the type A, and the identity context corresponding to a, b ∈Φ is given by IdΦ(a, b) = (u∈IdA(a, b)) . Assuming we know how to define the identity contexts associated to contexts of length n, we can describe the identity contexts associated to a context of length n+ 1 as follows. Let us assume to have a context Φ of length nas in (2), and consider a context Φ0of length n+ 1 of the form (12) Φ0= (x∈Φ, xn+1 ∈An+1(x)) . By definition, elements a0, b0∈Φ0have the form a0= (a, an+1) and b0= (b, bn+1), where a, b ∈Φ, an+1 ∈An+1(a), and bn+1 ∈An+1(b). Their associated identity context has the form Id(a0, b0) = u∈IdΦ(a, b), un+1 ∈IdAn+1(b)(u!(an+1), bn+1) where we have u!(an+1)∈An+1(b) by the following application of the Leibniz rule u∈IdΦ(a, b) (x∈Φ) An+1(x)∈Type an+1 ∈An+1(a) u!(an+1)∈An+1(b). In the following, we will need only this description of the identity contexts and the rules in Table 2. Hence, we do not describe the other syntactic constructs involved in them, and refer the reader to [8] for details. 3. The fundamental groupoid of a context 3.1. Contexts as spaces. The axioms for identity types allow us to think of a context Φ as a space, as we explain below. To emphasize this perspective, we refer to elements of Φ as points. Given two points a, b ∈Φ, we refer to elements of Id(a, b) as paths from ato b. Following this idea, the context Id(a, b) can be thought of as the space of all paths from ato b. Now that we have points and paths, we may want to speak of homotopies between paths. For this, it suffices to apply the formation rule as follows: p0∈Id(a, b)p1∈Id(a, b) Id(p0, p1)∈Cxt . Elements θ∈Id(p0, p1) will be referred to as homotopies from p0to p1, and two paths p0∈Id(a, b) and p1∈Id(a, b) will be said to be homotopic if there exists an homotopy between them. Our aim is to pursue this analogy and to define a groupoid having the points of Φ as objects and homotopy 16 N. GAMBINO AND R. GARNER By the elimination rule applied to v∈Id(y0, y1), we obtain (Γ, y0∈Ψ, y1∈Ψ, v ∈Id(y0, y1),Θ(y0, y1, v)) m(y0, y1, v, u, z)∈Ω(x, y1, v ◦u) where m(y0, y1, v, u, z) = def J(y0, y1, v, [ ]z). We then obtain (x∈Φ, y ∈Ψ, u ∈Id(fx, y), z ∈Ω(x, fx, 1fx) n(x, y, u, z)∈Ω(x, y, u ◦1fx) where n(x, y, u, z) = def m(fx, y, u, 1fx, z). We can now substitute d(x) for z and obtain (x∈Φ, y ∈Ψ, u ∈Id(fx, y)) n(x, y, u, d(x)) ∈Ω(x, y, u ◦1fx) Let us now recall that by Lemma 3.2.3 we have ψu∈Id(u◦1fx, u). Hence, we can apply Lemma 2.5.1 and obtain (x∈Φ, y ∈Ψ, u ∈Id(fx, y)) (ψu)!(n(x, y, u, d(x))) ∈Ω(x, y, u) We claim that j= def (x, y, u, (ψu)!(n(x, y, u, d(x)))) provides the required filler, fitting in the diagram Φ//  (Id(f),Ω)  Id(f) j 99 s s s s s s s s sId(f) The commutativity of the bottom triangle is evident. The commutativity of the top triangle follows by the chain of definitional equalities (ψ1fx )!(n(x, fx, 1fx, d(x))) = n(x, fx, 1fx, d(x)) =m(fx, fx, 1fx,1fx, d(x)) = J(fx, fx, 1fx,[ ]d(x)) =d(x). Here, we used Lemma 3.2.1, the definitions of nand m, and the elimination rule for identity types. The commutativity of the bottom triangle is immediate.  Proof of Theorem 4.2.1. The Factorisation Axiom follows from Lemma 4.2.2, since J ⊆ B. The very definition of Bimplies that A=tB. For the Weak Orthogonality Axiom, we reason as follows. To show that At=B, observe that J ⊆ B. Hence, we have tB ⊆ tJ, and so tB ⊆ A. Thus, we only need to prove that A ⊆ tB. For this, observe that every map in B is a retract of a dependent projection by Lemma 4.2.2. This follows from THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 17 Lemma 4.2.2 via the Retract Argument [13, Lemma 1.1.9]. Hence, if a map has the left lifting property with respect to all dependent projections, then it has the left lifting property with respect to all maps in B. The required inclusion A ⊆ tBfollows.  Let us illustrate what happens when we apply the factorisation of Lemma 4.2.2 to the identity map 1Φ: Φ →Φ. The factorisation in (17) becomes Φi//Id(Φ) p//Φ. where Id(Φ) is defined as the context (y∈Φ, x ∈Φ, u ∈Id(x, y)), and the maps iand pare defined by letting i=def (x, x, 1x) and p=def (y), respectively. Let us consider a diagram of the form Φ// i  (Id(Φ),Ω)  Id(Φ) Id(Φ) Here, Ω is a context relative to Id(Φ). By the commutativity of the diagram, the top horizontal map gives us a dependent element d(x)∈Ω(x, x, r(x)) relative to (x∈Φ). By the elimination rule, we can deduce that J(x, y, u, d)∈ Ω(x, y, u). We can therefore define a filler j Φ// i  (Id(Φ),Ω)  Id(Φ) j 66 m m m m m m m m m m m m m mId(Φ) by letting j=def (x, y, u, J(x, y, u, d)). The commutativity of the top triangle follows from the computation rule, while the commutativity of the bottom triangle is immediate. This is the key idea underpinning the semantics of identity types in weak factorisation systems introduced in [2]. 5. Characterisation and applications 5.1. Characterisation of the weak factorisation system. We provide an explicit characterisation of the maps in the classes Aand Bof the identity type weak factorisation system established in Theorem 4.2.1. For this, we introduce some terminology, which is inspired by concepts of 2-dimensional category theory [3, 18, 30]. We define a context morphism f: Φ →Ψ to be atype-theoretic injective equivalence if we can derive a jugdement (y∈Ψ) s(y)∈Φ 18 N. GAMBINO AND R. GARNER such that we can derive also judgements of the form (x∈Φ) x=s(f(x)) ∈Φ,(18) (y∈Ψ) εy∈IdΨ(f(s(y)), y),(19) (x∈Φ) εf(x)= 1f(x)∈IdΨ(f(x), f(x)) .(20) We say that f: Φ →Ψ is a type-theoretic normal isofibration if we can derive a judgement x∈Φ, y ∈Ψ, u ∈Id(f(x), y)j(x, y, u)∈Φ such that we can also derive judgements of the following form x∈Φ, y ∈Ψ, u ∈Id(f(x), y)fj(x, y, u) = y∈Ψ,(21) (x∈Φ) j(x, fx, 1fx) = x∈Φ.(22) Although the identity type weak factorisation system does not seem to be functorial, we can follow the argument used to characterise the maps of a functorial weak factorisation system in [26, §2.4] to establish Lemma 5.1.1. Lemma 5.1.1. Let f: Φ →Ψbe a context morphism. (i) It holds that f∈ A if and only if fis a type-theoretic injective equivalence. (ii) It holds that f∈ B if and only if fis a type-theoretic normal isofibration. Proof. Recall that by Lemma 4.2.2 every map f: Φ →Ψ admits a factorisation Φif//Id(f)pf//Ψ, where if∈ A and pf∈ B. Let us prove (i). Define A0to be the class of maps f: Φ →Ψ such that the commutative diagram (23) Φif// f  Id(f) pf  Ψ Ψ has a diagonal filler. We claim that A=A0. To show A ⊆ A0, let f: Φ →Ψ be in A. The diagram in (23) has a diagonal filler since f∈ A and pf∈ B. To show A0⊆ A, let f: Φ →Ψ be in A0, and assume to have a diagonal filler j: Ψ →Id(f) for the diagram in (23). We can then exhibit fas a THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 19 retract of ifby the diagram Φ f  Φ if  Φ f  Ψj //Id(f)pf //Ψ We have that if∈ A. Since the class A, being defined by a weak orthogonality condition, is closed under retracts, we have f∈ A. To conclude the proof, it is sufficient to observe that fis an injective equivalence if and only if f∈ A0. This involves unfolding the definition of the context Id(f). For the proof of (ii), let B0be the class of maps f: Φ →Ψ such that the commutative diagram Φ if  Φ f  Id(f)pf //Ψ has a diagonal filler. The rest of argument follows along the lines of the one used to establish (i) and hence we omit it.  5.2. Pullback stability of injective equivalences. The first application concerns a closure property of the identity type weak factorisation system which does not seem to be shared by many other examples of weak factorisation systems. Recall that, even if C(T) is not complete, it does admit pullbacks along dependent projections [25, §6]. Proposition 5.2.1. Pullbacks of maps in Aalong maps in Jare in A. Proof. By Lemma 5.1.1, the claim follows once we show that, for a pullback diagram of form (x∈Φ, z ∈Ω(f(x)) // g  (x∈Φ) f  (y∈Ψ, z ∈Ω(y)) //(y∈Ψ) where g= (f(x), z), if fis an injective equivalence, then so is g. Since fis an injective equivalence, we may assume to have (y∈Ψ) s(y)∈Φ and the judgements in (18), (19), (20). Our first step in showing that gis an injective equivalence will be to construct a judgement (y∈Ψ, z ∈Ω(y)) t(y, z)∈(x∈Φ, z ∈Ω(f(x)) 20 N. GAMBINO AND R. GARNER satisfying (x∈Φ, z ∈Ω(fx)) tg(x, z) = (x, z)∈(x∈Φ, z ∈Ω(x)). Now, to give tis equivalently to give judgements (y∈Ψ, z ∈Ω(y)) t1(y, z)∈Φ, (y∈Ψ, z ∈Ω(y)) t2(y, z)∈Ω(f(t1(y, z))). So we define t1(y, z) =def s(y). Now must give an element t2(y, z)∈Ω(fsy). We obtain this by substituting z∈Ω(y) along ε−1 y∈Id(y, fsy) using the Leibniz rule: (y∈Ψ, z ∈Ω(y)) t2(y, z) =def (ε−1 y)!(z)∈Ω(f(t1(y, z))) . Observe that we have tg(x, z) = t(fx, z) = (t1(fx, z), t2(fx, z)) = (sfx, (ε−1 fx )!(z)) = (x, (1fx)!(z)) = (x, z) as required. We now come to the second step in the proof, which is to construct a judgement (y∈Ψ, z ∈Ω(y)) δ(y,z)∈Id(gt(y, z),(y, z)) satisfying (x∈Φ, z ∈Ω(fx)) δ(fx,z)= 1(fx,z)∈Id((fx, z),(fx, z)). Now, to give δis the same as to give a judgement (y∈Ψ, z ∈Ω(y)) δ(y, z)∈Id(fsy, (ε−1 y)!(z)),(y, z). By the description of identity context in Section 2.5, to give this is equally well to give a pair of judgements (y∈Ψ, z ∈Ω(y)) δ1(y, z)∈Id(fsy, y) (y∈Ψ, z ∈Ω(y)) δ2(y, z)∈Idδ1(y, z)!(ε−1 y)!(z), z So we define δ1(y, z) =def ε(y). We must now give an element δ2(y, z)∈Id((εy)!(ε−1 y)!(z), z). For this, let us show that we can derive a rule of the form p∈Id(a, b) (x∈Φ) Ω(x)∈Cxt e∈Ω(b) γp(e)∈Id((p)!(p−1)!(e), e) such that THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 21 a∈Φe∈Ω(a) γ1a(e)=1e∈Id(e, e) By elimination on p∈Id(a, b), we define γp(e) =def J(a, b, p, [x]1e)∈Id((p)!(p−1)!(e), e) Indeed, Lemma 3.2.1 implies that for x∈Φ and z∈Ω(x), we have (1x)!(1−1 x)!(z) = (1−1 x)!(z) = (1x)!(z) =z . We can then define δ2(y, z) =def γεy(z). This specifies δ, and we now calculate δ(fx, z)=(δ1(fx, z), δ2(fx, z)) = (εfx, γεfx (z)) = (1fx, γ1fx (z)) = (1fx,1z) = 1(fx,z) as required.  5.3. Relationship with the homotopy theory of groupoids. Let us recall that the category Gpd of groupoids and functors admits a Quillen model structure (W,C,F), in which the class of weak equivalences Wconsists of the categorical equivalences, the class of fibrations Fconsists of the Grothendieck fibrations, and the class of cofibrations Cconsists of the functors that are injective on objects [1, 17]. As a consequence of this, the category Gpd admits a first weak factorisation system given by (W ∩C,F), and a second weak factorisation system given by (C,W ∩ F). We shall be interested in relating the weak factorisation system (W ∩ C,F) on Gpd with the identity type weak factorisation system on C(T). Let us recall that a functor f:A→Bbetween groupoids is a Grothendieck fibration if and only if for every β:f(a)→bin Bthere exists α:a→a0in Asuch that f(a0) = band f(α) = β. The required factorisation of a functor f:A→B as an equivalence injective on objects followed by a Grothendieck fibration can be obtained using the familiar mapping space construction, Aif//Path(f)pf//B , 22 N. GAMBINO AND R. GARNER where Path(f) is the groupoid whose objects consist of triples (a, b, β), where a∈A,b∈B, and β:f(a)→bin B. Theorem 5.3.1. Let f: Φ →Ψbe a context morphism. (i) If f∈ A, then F(Φ) → F(Ψ) is an equivalence injective on objects. (ii) If f∈ B, then F(Φ) → F(Ψ) is a Grothendieck fibration. Proof. For part (i), let f: Φ →Ψ be in A. By Lemma 5.1.1 fis a typetheoretic injective equivalence, so let us assume (y∈Ψ) s(y)∈Φ and the judgements in (18), (19), (20). We show that F(s): F(Ψ) → F(Φ) provides a quasi-inverse to F(f): F(Φ) → F(Ψ). First of all, we have a natural isomorphism F(s)◦ F(f)⇒1F(Ψ) with components given by the maps [εb]: f(s(b)) →b. To establish naturality, we need to show that for every q∈Id(b0, b1), there is a homotopy between q◦εb0and εb1◦fs(q), which can be proved by elimination on q∈Id(b0, b1). Secondly, we have F(s)◦ F(f) = F(s◦f) = F(1Φ) = 1F(Φ) . which also shows that F(f) is injective on objects, as required. For part (ii), let f: Φ →Ψ be a type-theoretic normal isofibration, and assume to have (x∈Φ, y ∈Ψ, u ∈Id(f(x), y)) j(x, y, u)∈Φ and judgements as in (21) and (22). By (21), the map j: Id(f)→Φ makes the following diagram commute (24) Id(f)j// pf !! D D D D D D D DΦ f  Ψ To show that F(f): F(Φ) → F(Ψ) is Grothendieck fibration, let us consider a map β:f(a)→bin F(Ψ). Let p∈Id(f(a), b) such that β= [p]. Note that such a pexists, but it is neither unique nor determined canonically. We then define a0=def j(a, b, p). Next, we need to define α:a→a0in F(Φ). By the description of identity contexts in Section 2.5, we can find an element of the form (1a, p, φ)∈Id(f)(a, fa, 1fa),(a, b, p) We define a map θ: (a, fa, 1fa)→(a, b, p) in F(Id(f)) by letting θ= [(1a, p, φ)]. The required map α:a→a0can then be defined as the result of an application of the functor F(j) to θ. This has the required domain and THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 23 codomain, since a=j(a, f(a),1f(a))∈Φ by (22), and a0=j(a, b, p)∈Φ by the definition set earlier. Furthermore, the commutativity of the diagram in (24) implies that the result of applying F(f) to αis β, as required.  We can now compare the factorisations in C(T) and in Gpd. Proposition 5.3.2. For every context morphism f: Φ →Ψ, we can define an equivalence surjective on objects σf:F(Id(f)) →Path(F(f)) making the following diagram commute F(Φ) iF(f)// F(if)  Path(F(f)) pF(f)  F(Id(f)) 55 k k k k k k k k k k k k k k F(pf) //F(Ψ) Proof. The objects of F(Id(f)) are triples (a, b, p), where p∈Id(f(a), b). The objects of Path(F(f)) are triples a, b, α, where αis an arrow α:f(a)→ bin F(Φ). Thus, σfcan be defined as mapping (a, b, p) to (a, b, [p]). Direct calculations show the required properties.  Let us write Jfor the groupoid with two objects and an isomorphism between them. As a special case of Proposition 5.3.2, we obtain that for every context Φ, there is a surjective equivalence between σ:F(x∈Φ, y ∈Φ, u ∈Id(x, y)) → F(x∈Φ)J, where F(x∈Φ)Jcan be seen as the groupoid of isomorphisms in F(x∈Φ). Acknowledgements The research described here was started during a visit of the first-named author to the Department of Mathematics of the University of Uppsala and discussed further during the workshop Categorical and Homotopical Structures in Proof Theory, held at the Centre de Recerca Matem`atica. We gratefully acknowledge the support of both institutions. The second-named author is supported by a Research Fellowship of St John’s College, Cambridge, and a Marie-Curie Intra-European Fellowship, Project no. 040802. The use of Paul Taylor’s prooftree package is also acknowledged. Appendix A. Structural rules for dependent type theories Weakening and substitution. The rule (∗) has the side-condition that the variable xshould not appear as a free variable in Γ or ∆. When stating the 24 N. GAMBINO AND R. GARNER first two rules below, Jstands for an arbitrary judgement. (Γ,∆) J(Γ) A∈Type (∗) (Γ, x ∈A, ∆) J (Γ, x ∈A, ∆) J(Γ) a∈A (Γ,∆[a/x]) J[a/x] Reflexivity, symmetry, and transitivity of definitional equality of types. A∈Type A=A A=B B=A A=B B =C A=C Reflexivity, symmetry, and transitivity of definitional equality of objects. a∈A a=a∈A a=b∈A b=a∈A a=b∈A b =c∈A a=c∈A Compatibility rules for definitional equality. a∈A A =B a∈B a=b∈A A =B a=b∈B References [1] D. W. Anderson, Fibrations and geometric realizations, Bulletin of the American Mathematical Society 84(5) (1978), 765–788. [2] S. Awodey and M. Warren, Homotopy theoretic models of identity types, Mathematical Proceedings of the Cambridge Philosophical Society (To appear). [3] R. Blackwell, G. M. Kelly, and A. J. Power, Two-dimensional monad theory, Journal of Pure and Applied Algebra 59 (1989), 1–41. [4] A. K. Bousfield, Constructions of factorisation systems in categories, Journal of Pure and Applied Algebra 9(1977), 207–220. [5] J. Cartmell, Generalised algebraic theories and contextual categories, Annals of Pure and Applied Logic 32 (1986), 209–243. [6] N. G. de Brujin, Telescopic mappings in typed lambda calculus, Information and Computation 91(2) (1991), 189–204. [7] P. Dybjer, Internal type theory, Types for proofs and programs (S. Berardi and M. Coppo, eds.), Lecture Notes in Computer Science, vol. 1158, Springer, 1997, pp. 120–134. [8] R. Garner, Two-dimensional models of type theory, In preparation. [9] M. Hofmann, On the interpretation of type theory of locally cartesian closed categories, Computer Science Logic 1994 (L. Pacholski and J. Tiuryn, eds.), Lecture Notes in Computer Science, vol. 933, Springer, 1995, pp. 427–441. [10] , Syntax and semantics of dependent type theories, Semantics of Logics of Computation (P. Dybjer and A. M. Pitts, eds.), Cambridge University Press, 1997, pp. 79–130. [11] , Extensional concepts in intensional type theory, Springer, 1999. [12] M. Hofmann and T. Streicher, The groupoid model of type theory, Twenty-five years of constructive type theory (G. Sambin and J. Smith, eds.), Oxford Logic Guides, vol. 36, Oxford University Press, 1998, pp. 83–111. [13] M. Hovey, Model categories, Mathematical Surveys and Monographs, vol. 63, American Mathematical Society, 1999. THE IDENTITY TYPE WEAK FACTORISATION SYSTEM 25 [14] W. A. Howard, The formulae-as-types notion of construction, To H. B. Curry: Essays in Combinatory Logic, Lambda Calculus, and Formalism (J. R. Hindley and J. P. Seldin, eds.), Academic Press, 1980, pp. 479–490. [15] B. Jacobs, Categorical logic and type theory, Studies in Logic and the Foundations of Mathematics, vol. 141, Elsevier, 1999. [16] A. Joyal, The theory of quasi-categories and its applications, Quaderns 45, Centre de Recerca Matem`atica, 2008. [17] A. Joyal and M. Tierney, Strong stacks and classifying spaces, Category Theory (Como 1990) (Berlin), Lecture Notes in Mathematics, vol. 1488, Springer, 1991, pp. 213–236. [18] S. Lack, Homotopy-theoretic aspects of 2-monads, Journal of Homotopy and Related Structures (To appear). [19] J. Lambek and P. J. Scott, Introduction to higher-order categorical logic, Cambridge Studies in Advanced Mathematics, vol. 7, Cambridge University Press, 1986. [20] F. W. Lawvere, Functorial semantics, Proc. Nat. Acad. Sci. USA, 50 (1963), 869– 872. [21] P. Martin-L¨of, Intuitionistic type theory, Blibliopolis, 1984. [22] J. P. May, A concise course in algebraic topology, Chicago Lecture Notes in Mathematics, The University of Chicago Press, 1999. [23] B. Nordstr¨om, K. Petersson, and J. M. Smith, Programming in Martin-L¨of type theory: an introduction, Oxford University Press, 1990. [24] , Martin-L¨of Type Theory, Handbook of Logic in Computer Science. Volume V (S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, eds.), Oxford University Press, 2001, pp. 1–37. [25] A. M. Pitts, Categorical logic, Handbook of Logic in Computer Science. Volume V (S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, eds.), Oxford University Press, 2001, pp. 39–128. [26] J. Rosick´y and W. Tholen, Lax factorisation algebras, Journal of Pure and Applied Algebra 175(3) (2002), 335–382. [27] D. S. Scott, Constructive validity, Symposium on Automated Demonstration, Lecture Notes in Mathematics, vol. 125, Springer, 1970, pp. 237–275. [28] , Relating theories of the λ-calculus, To H. B. Curry: Essays in Combinatory Logic, Lambda Calculus, and Formalism (J. R. Hindley and J. P. Seldin, eds.), Academic Press, 1980, pp. 403–450. [29] R. A. G. Seely, Locally cartesian closed categories and type theories, Mathematical Proceedings of the Cambridge Philosophical Society 95 (1984), 33–48. [30] R. Street, Fibrations and Yoneda’s lemma in a 2-category, Category Seminar (Proc. Sem. Sydney 1972/73) (G. M. Kelly and R. H. Street, eds.), Lecture Notes in Mathematics, vol. 420, Springer, 1974, pp. 104–133. [31] T. Streicher, Investigations into intensional type theory, Habilitationsschrift, Ludwig-Maximilians Universit¨at M¨unchen, 1993. [32] Paul Taylor, Practical foundations of mathematics, Cambridge Studies in Advanced Mathematics, vol. 59, Cambridge University Press, 1999.