Theoretical Computer Science 409 (2008) 94–109 Contents lists available at ScienceDirect Theoretical Computer Science journal homepage: www.elsevier.com/locate/tcs The identity type weak factorisation system Nicola Gambino a,b,∗ , Richard Garner c a Department of Computer Science, University of Leicester, University Road, LE1 7RH, England, UK b Centre de Recerca Matemàtica, Apartat 50, E-08193 Bellaterra, Spain c Department of Mathematics, Uppsala University, Box 480, S-751 06, Uppsala, Sweden article info Article history: Received 30 March 2008 Received in revised form 24 July 2008 Accepted 15 August 2008 Communicated by P.-L. Curien Keywords: Dependent type theory Identity type Weak factorisation system a b s t r a c t We show that the classifying category C (T) of a dependent type theory T with axioms for identity types admits a non-trivial weak factorisation system. We provide an explicit characterisation of the elements of both the left class and the right class of the weak factorisation system. This characterisation is applied to relate identity types and the homotopy theory of groupoids. © 2008 Elsevier B.V. All rights reserved. 1. Introduction From the point of view of mathematical logic and theoretical computer science, Martin-Löf’s axioms for identity types [25] admit a conceptually clear explanation in terms of the propositions-as-types correspondence [14,22,28]. 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 a and b are 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,30] validates not only the axioms for identity types, but also additional axioms, known as the reflection rules, which make identity types essentially trivial. To improve on this unsatisfactory situation and obtain models that do not validate the reflection rules, Awodey and Warren have recently introduced a semantics of identity types in 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 between the axioms for identity types and the notion of a weak factorisation system. Our main result states that if T is a dependent type theory 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 λ-calculus [19,29]. As such, it provides also a contribution to the development of a functorial semantics [20] for dependent type theories [2,5,7,10,15,21]. 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), generally referred to as display maps [15,33]. Indeed, the axioms for ∗ Corresponding author at: Department of Computer Science, University of Leicester, University Road, LE1 7RH, England, UK. Tel.: +44 (0)116 223 1304. E-mail addresses: [email protected] (N. Gambino), [email protected] (R. Garner). 0304-3975/$ – see front matter © 2008 Elsevier B.V. All rights reserved. doi:10.1016/j.tcs.2008.08.030 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 95 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 a 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 by Hofmann and Streicher [12], who showed that the axioms for identity types allow us to construct a groupoid out of every type. We develop this idea in three directions. First, we generalise it by constructing a groupoid out of every context, which we think of as a family of types, rather than out of a single type. Secondly, we extend this construction to a functor F : C (T) → Gpd. Finally, we use the functor F to relate the identity type weak factorisation system to the natural Quillen model structure on the category of groupoids [1,17], by showing that 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 The dependent type theories that we consider allow us to make judgements of four forms: A ∈ Type, a ∈ A, A = B ∈ Type, a = b ∈ A. (1) They assert, respectively, that A is a type, that a is an element of A, that A and B are definitionally equal types, and that a and b are 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 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 Φ = x0 ∈ A0 , x1 ∈ A1 (x0 ), . . . , xn ∈ An (x0 , . . . , xn−1 ) . (2) For the context in (2) to be well-formed, it is necessary that the variables x0 , . . . , xn are 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. Whenever we mention contexts, we implicitly assume that they are well-formed. We write (Φ ) J to express that a judgement J holds 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 From now on, we work with a fixed dependent type theory T. The only assumption that we make on T is that it contains the basic axioms stated in Appendix. For more information on dependent type theories, see [22,24]. We briefly recall the definition of the classifying category C (T) associated to 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 coincide up to renaming of the free variables in Φ and up to pointwise definitional equality. The classifying 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, while identity maps are defined in the evident way [26]. 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). In what follows, we will be particularly interested in the class of context morphisms known as as display maps [15,33]. These are context morphisms of the form 96 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 (Γ , x ∈ A) → Γ , defined by projecting away the variable x ∈ A, where Γ is a context and A is a type relative to Γ . As we will see in Section 4, display maps play a crucial role in the definition of the identity type weak factorisation system. To work with the category C (T) and its slices, it will be convenient to use some of the abbreviations for manipulating contexts 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 in Φ . Maps of this form will be referred to as dependent projections. Note that the class of dependent projections can be seen as the closure under composition of the class of display maps. 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 a is a dependent element of Φ relative to Γ . Dependent elements of this form are the same thing as context morphisms a : Γ → (Γ , Φ ) over Γ . When Γ is the empty context, we speak of global elements of the context Φ , which are the same thing as context morphisms a : ( ) → Φ . 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 in Appendix hold. The details are essentially straightforward, and hence omitted. Remark 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 ) . 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 A is 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 a and b are 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. In these rules 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 three axioms, which we also assume as being part of the rules for identity types, expressing commutation laws between the syntax of identity types and the substitution operation. The first of these axioms is (Γ , x ∈ A) B(x) ∈ Type (Γ , x ∈ A) b1 (x) ∈ B(x) (Γ , x ∈ A) b2 (x) ∈ B(x) (Γ ) a ∈ A . (Γ ) IdB(x) (b1 (x), b2 (x))[a/x] = IdB(a) (b1 (a), b2 (a)) ∈ Type The second of these axioms is (Γ , x ∈ A) B(x) ∈ Type (Γ , x ∈ A) b(x) ∈ B(x) (Γ ) a ∈ A . (Γ ) r(b(x))[a/x] = r(b(a)) ∈ IdB(a) (b(a), b(a)) The third axiom, which we do not spell out, asserts a similar commutation property for terms of the form J(a, b, p, d). 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. N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 97 Table 1 Deduction rules for identity types A ∈ Type a∈A b∈A (3) IdA (a, b) ∈ Type a∈A (4) r(a) ∈ IdA (a, a) 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) 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)) (5) (6) Remark 2. Expressions of the form e(e0 ) denote the application of e to e0 in the metatheory. For an expression e in which the variable x may appear free, we write [x]e to denote the λ-abstraction of x from e in the metatheory. As usual, we assume the η-rule and the β -rule in the metatheory. Using these rules, it is possible to show that the elimination and computation rules in (5) and (6) can be stated equivalently as p ∈ IdA (a, b) (x ∈ A, Θ (x, x, r(x)) e ∈ C (x, x, r(x)) (Θ (a, b, p)) J(a, b, p, [x]e) ∈ C (a, b, p) and a∈A (x ∈ A, Θ (x, x, r(x))) e ∈ C (x, x, r(x)) (Θ (a, a, r(a)) J(a, a, r(a), [x]e) = e[a/x] ∈ C (a, a, r(a)) where e[a/x] denotes the result of substituting a for x in e. We write [_]e to denote the λ-abstraction of a variable that does not appear in e. Remark 3. The elimination and computation rules, as stated in Table 1, generalise the standard elimination and computation rules for identity types [25]. 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 5-types. Without 5-types, the standard rules are quite weak, since they do not seem to imply the Leibniz rule for propositional equality [25], whereas our generalised rules suffice, as shown in Lemma 5. Furthermore, the generalised rules become derivable from the standard ones in the presence of 5-types, so that our development applies also to dependent type theories with standard axioms for identity types and 5-types. Remark 4. We do not assume the rules in (7), to which we refer as the reflection rules. p ∈ Id(a, b) p ∈ Id(a, b) a=b∈A r(a) = p ∈ Id(a, b) . (7) 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 the Appendix. The reflection rules are generally avoided, since they imply 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 [32, 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) where we used the notation for λ-abstractions in the metatheory explained in Remark 2. 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. 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 (which we sketch below) 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 1. For 98 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 Table 2 Deduction rules for identity contexts Φ ∈ Cxt a ∈ Φ b ∈ Φ (8) IdΦ (a, b) ∈ Cxt a∈Φ (9) r(a) ∈ IdΦ (a, a) 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) 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)) (10) (11) 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 refer to the relative context Ω (x, y, u) as the eliminating context, and to d as the eliminating family. We construct the identity context of a context Φ by induction on its 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)). The introduction rule (9) then reduces to the identity type introduction rule (6); whilst the elimination rule (10) may be derived from the identity type elimination rule (5) by induction on the length of the context Ω . Assuming we know how to define the identity contexts associated to contexts of length n, we can describe the identity context associated to a context of length n + 1 as follows. First we use the inductive hypothesis to prove Lemma 5 below. This Lemma states a very useful property, which we refer as the Leibniz rule for contexts, that is going to be used repeatedly in what follows. To prove it, we make use of the elimination and computation rules (10) and (11) for contexts of length n. Lemma 5. For each context Φ of length n, we can derive a rule of the form p ∈ Id(a, b) (x ∈ Φ ) Ω (x) ∈ Cxt p! (e) ∈ Ω (b) e ∈ Ω ( a) 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. N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 99 We now define the identity context of a context of length n + 1. Let us assume to have a context Φ of length n as in (2), and consider a context Φ 0 of length n + 1 of the form Φ 0 = (x ∈ Φ , xn+1 ∈ An+1 (x)). (12) By definition, elements a , b ∈ Φ have the form a = (a, an+1 ) and b = (b, bn+1 ), where a, b ∈ Φ , an+1 ∈ An+1 (a), and bn+1 ∈ An+1 (b). We define their associated identity context to have the form 0 0 0 0 0 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) This gives us the formation rule (8) for IdΦ 0 (a0 , b0 ). The corresponding introduction, elimination and computation rules are defined in a similar inductive manner. Since in the following we will need only the description of the identity contexts and the rules in Table 2, we omit the remaining details, which may be found in [8]. 3. The fundamental groupoid of a context 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 a to b. Following this idea, the context Id(a, b) can be thought of as the space of all paths from a to b. To speak of homotopies between paths, 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 p0 to p1 , and two paths p0 ∈ Id(a, b) and p1 ∈ Id(a, b) will be said to be homotopic if there exists a homotopy between them. Our aim is to pursue this analogy and to define a groupoid having the points of Φ as objects and homotopy equivalence classes of paths as maps. Because of the analogy with the definition of the fundamental groupoid of a space [23], we refer to this groupoid as the fundamental groupoid of a context. Lemma 6 below can the understood as expressing that paths can be composed, that there is a trivial path on each point, and that paths can be reversed. From now on, we assume to work with a fixed context Φ as in (2). We use freely the notation introduced in Remark 1. Lemma 6. We can derive rules of the form p ∈ Id(a, b) q ∈ Id(b, c ) a∈Φ p ∈ Id(a, b) q ◦ p ∈ Id(a, c ) 1a ∈ Id(a, a) p−1 ∈ Id(b, a) such that p ∈ Id(a, b) 1b ◦ p = p ∈ Id(a, b) a∈Φ (1a )−1 = 1a ∈ Id(a, a) hold. Proof. For the first rule, we apply the Leibniz rule as follows q ∈ Id(b, c ) (x ∈ Φ ) Id(a, x) ∈ Cxt p ∈ Id(a, b) q! (p) ∈ Id(a, c ) and define q ◦ p =def q! (p) ∈ Id(a, c ). For the second rule, we use the introduction rule, and simply define 1a =def r(a) ∈ Id(a, a). For the third rule, we apply the elimination rule on p ∈ Id(a, b), with (x ∈ Φ , y ∈ Φ , u ∈ Id(x, y)) Id(y, x) ∈ Cxt as the eliminating context, and r(x) ∈ Id(x, x) as the eliminating family. Hence, we can define p−1 =def J(a, b, p, [x] r(x)) ∈ Id(b, a). The computation rule implies the other rules. Lemma 7. Let p0 , p1 ∈ Id(a, b) and q0 , q1 ∈ Id(b, c ). We can derive rules of the form φ ∈ Id(p0 , p1 ) ψ ∈ Id(q0 , q1 ) ψ ◦ φ ∈ Id(q0 ◦ p0 , q1 ◦ p1 ) φ ∈ Id(p0 , p1 ) φ ∈ Id(p0 −1 , p1 −1 ) ∗ such that hold. p ∈ Id(a, b) q ∈ Id(b, c ) p ∈ Id(a, b) 1q ◦ 1p = 1q◦p ∈ Id(q ◦ p, q ◦ p) (1p ) = 1p ∈ Id(p, p) ∗ 100 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 Proof. For the first rule, use elimination over φ ∈ Id(p0 , p1 ) and ψ ∈ Id(q0 , q1 ), and Lemma 6. For the second rule, use elimination over φ ∈ Id(p0 , p1 ) and Lemma 6. Lemma 8. We can derive rules of the form p ∈ Id(a, b) q ∈ Id(b, c ) r ∈ Id(c , d) αp,q,r ∈ Id((r ◦ q) ◦ p, r ◦ (q ◦ p)) p ∈ Id(a, b) φp ∈ Id(1b ◦ p, p) ψp ∈ Id(p ◦ 1a , p) p ∈ Id(a, b) p ∈ Id(a, b) σp ∈ Id(p−1 ◦ p, 1a ) τp ∈ Id(p ◦ p−1 , 1b ) p ∈ Id(a, b) such that p ∈ Id(a, b) q ∈ Id(b, c ) αp,q,1c = 1q◦p ∈ Id(q ◦ p, q ◦ p) a∈Φ a∈Φ φ1a = 11a ∈ Id(1a , 1a ) ψ1a = 11a ∈ Id(1a , 1a ) a∈A a∈A σ1a = 11a ∈ Id(1a , 1a ) τ1a = 11a ∈ Id(1a , 1a ) hold. Proof. For αp,q,r use elimination over r ∈ Id(c , d). For φp we can define φp to be 1p by Lemma 6. For ψp use elimination over p ∈ Id(a, b). For σp and τp use elimination over p ∈ Id(a, b). Let a, b ∈ Φ . An application of Lemma 6, taking Φ therein to be IdΦ (a, b), shows that homotopy of paths is a reflexive, symmetric, and transitive relation on the set of paths from a to b. We write [a, b] for the quotient set, and [p] : a → b for the equivalence class of a path p ∈ Id(a, b). We can now define the fundamental groupoid F (Φ ) associated to Φ . The objects of F (Φ ) are the global elements of Φ . The maps from a to b in F (Φ ) are equivalence classes of paths [p] : a → b. Composition, identities, and inverses in F (Φ ) are defined by letting [q] ◦ [p] =def [q ◦ p], 1a =def [1a ], [p]−1 =def [p−1 ]. These operations are well-defined by Lemma 7. To establish the axioms for a category, we need to show [r ◦ (q ◦ p)] = [(r ◦ q) ◦ p], [1b ◦ p] = [p], [p ◦ 1a ] = [p] (13) and to establish the additional axioms for a groupoid, we need to show [p−1 ◦ p] = [1a ], [p ◦ p−1 ] = [1b ]. (14) For (13), we need homotopies α ∈ Id(r ◦ (q ◦ p), (r ◦ q) ◦ p), φ ∈ Id(1b ◦ p, p), and ψ ∈ Id(p ◦ 1a , p). For (14), we need homotopies σ ∈ Id(p−1 ◦ p, 1a ) and τ ∈ Id(p ◦ p−1 , 1b ). All of these are provided by Lemma 8. We now show that this construction extends to a functor. Recall that we write Gpd for the category of small groupoids and functors. Proposition 9. Let T be a dependent type theory with axioms for identity types. The function mapping a context Φ to its fundamental groupoid F (Φ ) extends to a functor F : C (T) → Gpd. Proof. We need to define a functor F (f ) : F (Φ ) → F (Ψ ) for every context morphism f : Φ → Ψ . On objects, F (f ) sends a ∈ F (Φ ) to f (a) ∈ F (Ψ ). On maps, F (f ) sends [p] : a → b to [f (p)] : f (a) → f (b), where f (p) ∈ Id(f (a), f (b)) is defined using the elimination rule by letting f (p) = J(a, b, p, [x]1fx ) ∈ Id(f (a), f (b)), (15) so that f (1a ) = 1fa ∈ Id(f (a), f (a)). (16) It is routine to check that the action of F (f ) on maps is well-defined. To show that F (f ) is a functor amounts to verifying the equations [f (q ◦ p)] = [f (q) ◦ f (p)], [f (1a )] = [1f (a) ]. For the first equation, elimination on q ∈ Id(b, c ) can be used to exhibit the required homotopy between f (q ◦ p) and f (q) ◦ f (p). For the second equation, use (16). We have therefore defined F : C (T) → Gpd on objects and maps. Thus, it remains to check that it is a functor. We begin by checking F (g ◦ f ) = F (g ) ◦ F (f ). N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 101 It is clear that F (g ◦ f ) and F (g ) ◦ F (f ) have the same action on objects. To show that they coincide on maps, we need to show that we have a homotopy between g (f (p)) and (gf )(p) for every p ∈ Id(a, b). By (15), we have g (f (p)) = J(f (a), f (b), f (p), [x] 1g (x) ) ∈ Id(gf (a), gf (b)) and (gf )(p) = J(a, b, p, [x] 1gf (x) ) ∈ Id(gf (a), gf (b)). The required homotopy can be obtained by the elimination rule on p ∈ Id(a, b). To conclude the proof, it suffices to check that F (1Φ ) = 1F (Φ ) . As before, it is clear that F (1Φ ) is the identity on objects. To check that it is the identity on maps, it suffices to show that [p] : a → b and [1Φ (p)] : a → b are the same equivalence classes, which can be proved by the elimination rule on p ∈ Id(a, b). 4. The identity type weak factorisation system Let us recall the notion of a weak factorisation system [4]. For this, we need some terminology and notation. Let E be a category. Given maps f : A → B and g : C → D in E , we say that f has the left lifting property with respect to g, or that g has the right lifting property with respect to f , if every commutative diagram of the form h A f /C g B k /D has a diagonal filler, that is to say is a map j : B → C making the diagram h A f /C ? j g B k /D commute. We write f t g to denote this situation. For a class of maps M , we define M t to be the class of maps having the right lifting property with respect to every map in M . Similarly, we define t M to be the class of maps having the left lifting property with respect to every map in M . A weak factorisation system on E consists of a pair of classes of maps (A, B ) such that the following hold. (1) Every map f admits a factorisation f = pi with i ∈ A and p ∈ B . (2) At = B and A = t B . We refer to (1) as the Factorisation Axiom and to (2) as the Weak Orthogonality Axiom. Elements of A and B will be also referred to as A-maps and B -maps, respectively. For more information on weak factorisation systems, see [16, Appendix D]. Let us now return to consider the dependent type theory T and its classifying category C (T). Recall from Section 2 that a display map is a context morphism of the form (Γ , x ∈ A) → Γ , obtained by forgetting the variable x ∈ A. We write D for the set of display maps in C (T). Our main result is the following. Theorem 10. Let T be dependent type theory with axioms for identity types. The pair (A, B ), where A =def t D and B =def At , forms a weak factorisation system on C (T). Let us emphasize that identity types are not involved in the definition of the classes of maps A and B . They are, however, used extensively in the proof that these classes of maps satisfy the axioms for a weak factorisation system. As usual in the proof of the existence of a weak factorisation system, the difficulties are concentrated in one particular step of the proof. Lemma 11 is the key step in our case, with the proof of Theorem 10 following from it by standard arguments in the theory of weak factorisation systems. To prove Lemma 11, it is convenient to work with the equivalent formulation of the rules for identity contexts given in Table 3. The equivalence between the sets of rules in Table 2 and in Table 3 follows by standard properties of substitution. As before, we use the notational convention stipulated in Remark 1. Also recall that a dependent projection is a context morphism of the form (Γ , Φ ) → Γ , defined by projecting away the variables in Φ , where Γ is a context and Φ is context relative to Γ . Lemma 11. Every map f admits a factorisation f = pi, where i ∈ A and p is a dependent projection. 102 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 Table 3 Variable-based rules for identity contexts Φ ∈ Cxt (x ∈ Φ , y ∈ Φ ) IdΦ (x, y) ∈ Cxt Φ ∈ Cxt (x ∈ Φ ) r(x) ∈ IdΦ (x, x) (x ∈ Φ , Θ (x, x, r(x))) d(x) ∈ Ω (x, x, r x) (x ∈ Φ , y ∈ Φ , u ∈ IdΦ (x, y), Θ (x, y, u)) J(x, y, u, d) ∈ Ω (x, y, u) (x ∈ Φ , Θ (x, x, r(x))) d(x) ∈ Ω (x, x, r(x)) (x ∈ Φ , Θ (x, x r(x))) J(x, x, r(x), d) = d(x) ∈ Ω (x, x, r(x)) Proof. For f : Φ → Ψ , define Id(f ) =def x ∈ Φ , y ∈ Ψ , u ∈ IdΨ (fx, y) . The required factorisation is defined as follows: if Φ / Id(f ) pf / Ψ, (17) where if =def (x, fx, 1fx ) and pf = (y). Apart from the ordering of the variable declarations x ∈ Φ and y ∈ Ψ , which is clearly unessential, pf is a dependent projection, as required. Hence, we only need to show that if ∈ A. This amounts to showing that it has the left lifting property with respect to all display maps. This amounts to providing diagonal fillers for every diagram of the form Φ / (v ∈ Λ, z ∈ D(v)) / (v ∈ Λ). Id(f ) Since display maps are closed under pullback [26, Lemma 6.3.2], it suffices to show that we can define a diagonal filler for every diagram of the form Φ Id(f ) / (Id(f ), z ∈ C (x, y, u)) Id(f ). The right-hand side display map gives us a dependent type C (x, y, u) relative to Id(f ) = (x ∈ Φ , y ∈ Ψ , u ∈ Id(f )). By the commutativity of the diagram, the top horizontal map gives us a dependent element d(x) ∈ C (x, fx, 1fx ) relative to (x ∈ Φ ). We can derive (x ∈ Φ , y0 ∈ Ψ , y1 ∈ Ψ , v ∈ Id(y0 , y1 ), Θ (y0 , y1 , v)) C (x, y1 , v ◦ u) ∈ Type, where Θ (y0 , y1 , v) = (u ∈ Id(fx, y0 ), z ∈ C (x, y0 , u)). By the definitional equality 1y ◦ u = u ∈ Id(f (x), y0 ), proved in Lemma 6, we have x ∈ Φ , y ∈ Ψ , Θ (y, y, 1y ) z ∈ C (x, y, 1y ◦ u). By the elimination rule applied to v ∈ Id(y0 , y1 ), we obtain (x ∈ Φ , y0 ∈ Ψ , y1 ∈ Ψ , v ∈ Id(y0 , y1 ), Θ (y0 , y1 , v)) J(y0 , y1 , v, [_]z ) ∈ C (x, y1 , v ◦ u). We then obtain x ∈ Φ , y ∈ Ψ , u ∈ Id(fx, y), z ∈ C (x, fx, 1fx ) n(x, y, u, z ) ∈ C (x, y, u ◦ 1fx ) where n(x, y, u, z ) =def J(fx, y, u, z ). We can now substitute d(x) for z and obtain (x ∈ Φ , y ∈ Ψ , u ∈ Id(fx, y)) n(x, y, u, d(x)) ∈ C (x, y, u ◦ 1fx ). Let us now recall that by Lemma 8 we have ψu ∈ Id(u ◦ 1fx , u). Hence, we can apply Lemma 5 and obtain (x ∈ Φ , y ∈ Ψ , u ∈ Id(fx, y)) (ψu )! (n(x, y, u, d(x))) ∈ C (x, y, u). N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 103 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 ), z ∈ C (x, y, u)) nn7 j nnn n nnn nnn Id(f ) Id(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)) = J(fx, fx, 1fx , [_]d(x)) = d(x). Here, we used Lemma 6, the definition of n, and the elimination rule for identity types. The commutativity of the bottom triangle is immediate. Proof of Theorem 10. Since D ⊆ B and B is closed under composition, B contains all dependent projections. The Factorisation Axiom then follows from Lemma 11. For the Weak Orthogonality Axiom, observe that At = B by the very definition of B in Theorem 10. So, we only need to show that A = t B . Since D ⊆ B , we have t B ⊆ t D , and so t B ⊆ A. Thus, it remains to prove that A ⊆ t B . Observe that every map in A has the left lifting property with respect to every dependent projection. This is because maps in A have the left lifting property with respect to display maps, and dependent projections are composites of display maps. The required inclusion A ⊆ t B amounts to showing that every map in A has the left lifting property with respect to every map in B . This follows from the fact that every map in A has the left lifting property with respect to every dependent projection, which we observed above, and the fact that every map in B is a retract of a dependent projection, which follows from Lemma 11 and the Retract Argument [13, Lemma 1.1.9]. Let us illustrate what happens when we apply the factorisation of Lemma 11 to the identity map 1Φ : Φ → Φ . The factorisation in (17) becomes / Id(Φ ) i Φ p / Φ, where Id(Φ ) =def (x ∈ Φ , y ∈ Φ , u ∈ Id(x, y)), and the maps i and p are defined by letting i =def (x, x, 1x ) and p =def (y), respectively. Let us consider a diagram of the form / (Id(Φ ), z ∈ C (x, y, u)) Φ i Id(Φ ) Id(Φ ) where C (x, y, u) is a type relative to the context Id(Φ ). By the commutativity of the diagram, the top horizontal map gives us a dependent element d(x) ∈ C (x, x, r(x)) relative to (x ∈ Φ ). By the elimination rule, we can deduce that J(x, y, u, d) ∈ C (x, y, u). We can therefore define a filler j / (Id(Φ ), z ∈ C (x, y, u)) jjj4 j jjj j j j i jjj jjjjj Id(Φ ) Id(Φ ) Φ 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]. Remark 12. The identity type weak factorisation system is not a functorial weak factorisation system. This would entail having operations mapping commutative squares Φ u f Φ0 /Ψ g v / Ψ0 104 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 into commutative diagrams /Ψ f Φ iu iv Id(u) pu / Id(v) Idf ,g Φ0 (18) pv / Ψ0 g subject to the functoriality conditions Idh,k ◦ Idf ,g = Idhf ,kg . Id1Φ ,1Φ 0 = 1Id(u) (19) We can use the identity elimination rules to define maps Idf ,g : Id(u) → Id(v) making the diagram in (18) commute and satisfying the first functoriality condition in (19). However, these maps need not satisfy the second functoriality condition in (19) strictly, but only up to propositional equality. To see why this is, let us consider the following situation: Φ Φ f f /Ψ /Ψ /Ξ g / Ξ. g The maps Idf ,f : Id(Φ ) → Id(Ψ ) and Idg ,g : Id(Ψ ) → Id(Ξ ) are defined as in Eq. (15) of Proposition 9. Their composite will not in general be equal to the map Idgf ,gf : Id(Φ ) → Id(Ξ ), but only pointwise propositionally equal. 5. Characterisation and applications We provide an explicit characterisation of the maps in the classes A and B of the identity type weak factorisation system established in Theorem 10. For this, we introduce some terminology, which is inspired by concepts of two-dimensional category theory [3,18,31]. We define a context morphism f : Φ → Ψ to be a type-theoretic injective equivalence if we can derive a judgement (y ∈ Ψ ) s(y) ∈ Φ such that we can derive also judgements of the form (x ∈ Φ ) x = s(f (x)) ∈ Φ , (y ∈ Ψ ) εy ∈ IdΨ (f (s(y)), y), (x ∈ Φ ) εf (x) = 1f (x) ∈ IdΨ (f (x), f (x)). (20) (21) (22) 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 ∈ Ψ , (x ∈ Φ ) j(x, fx, 1fx ) = x ∈ Φ . (23) (24) Although the identity type weak factorisation system is not to be functorial, we can follow the argument used to characterise the maps of a functorial weak factorisation system in [27, Section 2.4] to establish Lemma 13. Lemma 13. Let f : Φ → Ψ be a context morphism. (i) f ∈ A if and only if f is a type-theoretic injective equivalence. (ii) f ∈ B if and only if f is a type-theoretic normal isofibration. Proof. Recall that by Lemma 11 every map f : Φ → Ψ admits a factorisation Φ if / Id(f ) pf / Ψ, N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 105 where if ∈ A and pf ∈ B . Let us prove (i). Define A0 to be the class of maps f : Φ → Ψ such that the commutative diagram if Φ / Id(f ) (25) pf f Ψ Ψ has a diagonal filler. We claim that A = A0 . To show A ⊆ A0 , let f : Φ → Ψ be in A. The diagram in (25) 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 (25). We can then exhibit f as a retract of if by the diagram Φ Φ Φ / Id(f ) if f Ψ j 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 f is an injective equivalence if and only if f ∈ A0 . This involves unfolding the definitions of the context Id(f ) and of the morphism if : Φ → Id(f ). For the proof of (ii), let B 0 be the class of maps f : Φ → Ψ such that the commutative diagram Φ Φ Id(f ) if 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. We give two applications of Lemma 13. To motivate our first application, let us recall that, given a weak factorisation system (A, B ) on a category E with finite products, it is possible to define a homotopy relation between maps of E by thinking of A and B as if they were the classes of acyclic cofibrations and of fibrations of a Quillen model structure on E . For convenience, let us assume that the weak factorisation system comes together with an explicitly chosen factorisation of diagonal maps ∆X : X → X × X as an A-map iX : X → X I followed by a B -map pX : X I → X × X . We may then define two maps f : X → Y and g : X → Y to be homotopic if there exists a map h : X → Y I such that the diagram X f h g YI Y pY o π1 Y ×Y π2 /Y commutes. In the case of the identity type weak factorisation system, an explicit choice of factorisations of diagonal maps is given by Φ i / Id(Φ ) p / (x ∈ Φ , y ∈ Φ ) where the maps i and p are given by i =def (x, x, 1x ) and p =def (x, y), respectively. It follows that two maps f , g : Φ → Ψ in the classifying category C (T) are homotopic if and only if we can derive a judgement (x ∈ Φ ) p(x) ∈ Id(f (x), g (x)) expressing their pointwise propositional equality. The homotopy relation induced by a weak factorisation system (A, B ) can always be shown to be reflexive and symmetric. However, without further assumptions on the weak factorisation system we may not be able to show that it is transitive. One assumption that ensures transitivity is that pullbacks of A-maps in along B -maps are again A-maps. In our example, the classifying category C (T) does not have arbitrary pullbacks, but it does admit pullbacks along dependent projections [26, Section 6], which are B -maps. The closure property of A-maps stated in Proposition 14, however, suffices to show that the homotopy relation for the identity type weak factorisation system is transitive, as an easy calculation shows. Proposition 14. Pullbacks of A-maps along dependent projections are A-maps. 106 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 Proof. By Lemma 13, the claim follows once we show that, for a pullback diagram of form (x ∈ Φ , z ∈ Ω (f (x)) / (x ∈ Φ ) g f (y ∈ Ψ , z ∈ Ω (y)) / (y ∈ Ψ ) where g = (f (x), z ), if f is an injective equivalence, then so is g. Since f is an injective equivalence, we may assume to have (y ∈ Ψ ) s(y) ∈ Φ and the judgements in (20)–(22). Our first step in showing that g is an injective equivalence will be to construct a judgement (y ∈ Ψ , z ∈ Ω (y)) t (y, z ) ∈ (x ∈ Φ , z ∈ Ω (f (x)) satisfying (x ∈ Φ , z ∈ Ω (fx)) tg (x, z ) = (x, z ) ∈ (x ∈ Φ , z ∈ Ω (x)). Now, to give t is 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 εy−1 ∈ Id(y, fsy) using the Leibniz rule: (y ∈ Ψ , z ∈ Ω (y)) t2 (y, z ) =def (εy−1 )! (z ) ∈ Ω (f (t1 (y, z ))). Observe that we have tg (x, z ) = t (fx, z ) = (t1 (fx, z ), t2 (fx, z )) = (sfx, (εfx−1 )! (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, (εy−1 )! (z )), (y, z ) . By the description of identity contexts in Section 2, 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 )! (εy−1 )! (z ), z . So we define δ1 (y, z ) =def ε(y). We must now give an element δ2 (y, z ) ∈ Id((εy )! (εy−1 )! (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 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 6 implies that for x ∈ Φ and z ∈ Ω (x), we have 1 −1 (1x )! (1− x )! (z ) = (1x )! (z ) = (1x )! (z ) = z. N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 107 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. For our second application of Lemma 13, let us recall that the category Gpd of small groupoids and functors admits a Quillen model structure (W , C , F ), in which the class of weak equivalences W consists of the categorical equivalences, the class of fibrations F consists of the Grothendieck fibrations, and the class of cofibrations C consists of the functors that are injective on objects [1,17]. As a consequence of this, both (W ∩ C , F ) and (C , W ∩ F ) are weak factorisation systems on Gpd. 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 → B between groupoids is a Grothendieck fibration if and only if for every β : f (a) → b in B there exists α : a → a0 in A such that f (a0 ) = b and 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, if A pf / Path(f ) / B, where Path(f ) is the groupoid whose objects consist of triples (a, b, β), where a ∈ A, b ∈ B, and β : f (a) → b in B. Theorem 15. 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 13, f is a type-theoretic injective equivalence, so let us assume (y ∈ Ψ ) s(y) ∈ Φ and the judgements in (20)–(22). 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 ◦ εb0 and ε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(fx, y)) j(x, y, u) ∈ Φ and judgements as in (23) and (24). By (23), the map j : Id(f ) → Φ makes the following diagram commute j /Φ DD DD D f . pf DD D! Id(f ) (26) Ψ To prove that F (f ) : F (Φ ) → F (Ψ ) is a Grothendieck fibration, we will need an auxiliary result. We claim that there is a term x ∈ Φ , y ∈ Ψ , u ∈ Id(fx, y) m(x, y, u) ∈ IdId(f ) (x, fx, 1fx ), (x, y, u) . To see this, let us write Ω (x, y, u) =def IdId(f ) Φ if Id(f ) k (27) (x, fx, 1fx ), (x, y, u) . Then we have a commutative square / (Id(f ), Ω ) p Id(f ) where k is given by k =def (x, fx, 1fx , 1(x,fx,1f x) ), and p is the evident dependent projection. Because if ∈ A and p ∈ B , we have by Weak Orthogonality a diagonal filler m : Id(f ) → (Id(f ), Ω ), as required for (27). 108 N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 We now show that F (f ) is a Grothendieck fibration. Let us consider a map β : f (a) → b in F (Ψ ). Let p ∈ Id(f (a), b) be such that β = [p]. Note that such a p exists, but it is neither unique nor determined canonically. We then define a0 =def j(a, b, p). Next, we need to define α : a → a0 in F (Φ ). By (27), we have a term m(a, b, p) ∈ Id (a, fa, 1fa ), (a, b, p) . We define a map θ : (a, fa, 1fa ) → (a, b, p) in F (Id(f )) by letting θ = [m(a, b, p)]. The required map α : a → a0 can then be defined as the result of an application of the functor F (j) to θ . This has the required domain and codomain, since a = j(a, f (a), 1f (a) ) ∈ Φ by (24), and a0 = j(a, b, p) ∈ Φ by the definition set earlier. Furthermore, the commutativity of the diagram in (26) 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 16. 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 iF (f ) / Path(F (f )) kk5 k k k pF (f ) F (if ) kkk kkk kkk / F (Ψ ). F (Id(f )) F (Φ ) F (pf ) 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) → b in F (Φ ). Thus, σf can be defined as mapping (a, b, p) to (a, b, [p]). Direct calculations show the required properties. Let us write J for the groupoid with two objects and an isomorphism between them. As a special case of Proposition 16, we obtain that for every context Φ , there is a surjective equivalence σ : F (x ∈ Φ , y ∈ Φ , u ∈ Id(x, y)) → F (x ∈ Φ )J , where F (x ∈ Φ )J can be seen as the groupoid of isomorphisms in F (x ∈ Φ ). Acknowledgements We are grateful to Michael Warren for suggesting to use display maps rather than dependent projections in the definition of the identity type weak factorisation system, thus simplifying our original definition. We would also like to thank the referees for their useful comments. 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àtica. 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. Structural rules for dependent type theories Axiom, weakening and substitution The rule (∗) has the side-condition that the variable x should not appear as a free variable in Γ or ∆. When stating the rules below, J stands for an arbitrary judgement. (Γ , x ∈ A) x ∈ A (Γ , ∆) 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=B A=A B=A A=B B=C A=C . Reflexivity, symmetry, and transitivity of definitional equality of objects a∈A a=b∈A a=a∈A b=a∈A a=b∈A a=c∈A Compatibility rules for definitional equality a∈A A=B a∈B a=b∈A b=c∈A A=B a=b∈B . . N. Gambino, R. Garner / Theoretical Computer Science 409 (2008) 94–109 109 References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] D.W. Anderson, Fibrations and geometric realizations, Bulletin of the American Mathematical Society 84 (5) (1978) 765–788. S. Awodey, M.A. Warren, Homotopy theoretic models of identity types, Mathematical Proceedings of the Cambridge Philosophical Society (in press). R. Blackwell, G.M. Kelly, A.J. Power, Two-dimensional monad theory, Journal of Pure and Applied Algebra 59 (1989) 1–41. A.K. Bousfield, Constructions of factorisation systems in categories, Journal of Pure and Applied Algebra 9 (1977) 207–220. J. Cartmell, Generalised algebraic theories and contextual categories, Annals of Pure and Applied Logic 32 (1986) 209–243. N.G. de Brujin, Telescopic mappings in typed lambda calculus, Information and Computation 91 (2) (1991) 189–204. P. Dybjer, Internal type theory, in: S. Berardi, M. Coppo (Eds.), Types for Proofs and Programs, in: Lecture Notes in Computer Science, vol. 1158, Springer, 1997, pp. 120–134. R. Garner, Two-dimensional models of type theory, 2008 (submitted for publication), ArXiv:0808.2122. M. Hofmann, On the interpretation of type theory of locally Cartesian closed categories, in: L. Pacholski, J. Tiuryn (Eds.), Computer Science Logic 1994, in: Lecture Notes in Computer Science, vol. 933, Springer, 1995, pp. 427–441. M. Hofmann, Syntax and semantics of dependent type theories, in: P. Dybjer, A.M. Pitts (Eds.), Semantics of Logics of Computation, Cambridge University Press, 1997, pp. 79–130. M. Hofmann, Extensional Concepts in Intensional Type Theory, Springer, 1999. M. Hofmann, T. Streicher, The groupoid model of type theory, in: G. Sambin, J. Smith (Eds.), Twenty-five Years of Constructive Type Theory, in: Oxford Logic Guides, vol. 36, Oxford University Press, 1998, pp. 83–111. M. Hovey, Model categories, in: Mathematical Surveys and Monographs, vol. 63, American Mathematical Society, 1999. W.A. Howard, The formulae-as-types notion of construction, in: J.R. Hindley, J.P. Seldin (Eds.), H. B. Curry: Essays in Combinatory Logic, Lambda Calculus, and Formalism, Academic Press, 1980, pp. 479–490. B. Jacobs, Categorical logic and type theory, in: Studies in Logic and the Foundations of Mathematics, vol. 141, Elsevier, 1999. A. Joyal, The theory of quasi-categories and its applications, Quaderns 45, Centre de Recerca Matemàtica, 2008. A. Joyal, M. Tierney, Strong stacks and classifying spaces, in: Category Theory (Como 1990) (Berlin), in: Lecture Notes in Mathematics, vol. 1488, Springer, 1991, pp. 213–236. S. Lack, Homotopy—theoretic aspects of 2-monads, Journal of Homotopy and Related Structures 2 (2) (2007) 229–260. J. Lambek, P.J. Scott, Introduction to higher-order categorical logic, in: Cambridge Studies in Advanced Mathematics, vol. 7, Cambridge University Press, 1986. F.W. Lawvere, Functorial semantics, Proceedings of the National Academy of Sciences of the United States of America 50 (1963) 869–872. M.E. Maietti, Modular correspondence between dependent type theories and categorical universes including pretopoi and topoi, Mathematical Structures in Computer Science 15 (6) (2005) 1089–1149. P. Martin-Löf, Intuitionistic type theory — Notes by Giovanni Sambin of a series of lectures given in Padua, June 1980, Blibliopolis, 1984. J.P. May, A concise course in algebraic topology, in: Chicago Lecture Notes in Mathematics, The University of Chicago Press, 1999. B. Nordström, K. Petersson, J.M. Smith, Programming in Martin-Löf type Theory: An Introduction, Oxford University Press, 1990. B. Nordström, K. Petersson, J.M. Smith, in: S. Abramsky, D.M. Gabbay, T.S.E. Maibaum (Eds.), Martin-Löf Type Theory, in: Handbook of Logic in Computer Science. Volume V, Oxford University Press, 2001, pp. 1–37. A.M. Pitts, Categorical logic, in: S. Abramsky, D.M. Gabbay, T.S.E. Maibaum (Eds.), Handbook of Logic in Computer Science. Volume V, Oxford University Press, 2001, pp. 39–128. J. Rosický, W. Tholen, Lax factorisation algebras, Journal of Pure and Applied Algebra 175 (3) (2002) 335–382. D.S. Scott, Constructive validity, in: Symposium on Automated Demonstration, in: Lecture Notes in Mathematics, vol. 125, Springer, 1970, pp. 237–275. D.S. Scott, Relating theories of the λ-calculus, in: J.R. Hindley, J.P. Seldin (Eds.), H. B. Curry: Essays in Combinatory Logic, Lambda Calculus, and Formalism, Academic Press, 1980, pp. 403–450. R.A.G. Seely, Locally Cartesian closed categories and type theories, Mathematical Proceedings of the Cambridge Philosophical Society 95 (1984) 33–48. R. Street, Fibrations and Yoneda’s lemma in a 2-category, in: G.M. Kelly, R.H. Street (Eds.), Category Seminar (Proc. Sem. Sydney 1972/73), in: Lecture Notes in Mathematics, vol. 420, Springer, 1974, pp. 104–133. T. Streicher, Investigations into intensional type theory, Habilitationsschrift, Ludwig-Maximilians Universität München, 1993. P. Taylor, Practical foundations of mathematics, in: Cambridge Studies in Advanced Mathematics, vol. 59, Cambridge University Press, 1999.
© Copyright 2026 Paperzz