Close
About
FAQ
Home
Collections
Login
USC Login
Register
0
Selected
Invert selection
Deselect all
Deselect all
Click here to refresh results
Click here to refresh results
USC
/
Digital Library
/
University of Southern California Dissertations and Theses
/
Formalizing two-level type theory with cofibrant exo-nat
(USC Thesis Other)
Formalizing two-level type theory with cofibrant exo-nat
PDF
Download
Share
Open document
Flip pages
Contact Us
Contact Us
Copy asset link
Request this asset
Transcript (if available)
Content
Formalizing Two-Level Type Theory with Cofibrant Exo-nat by Elif Uskuplu A Dissertation Presented to the FACULTY OF THE USC GRADUATE SCHOOL UNIVERSITY OF SOUTHERN CALIFORNIA In Partial Fulfillment of the Requirements for the Degree DOCTOR OF PHILOSOPHY (MATHEMATICS) December 2023 Copyright 2023 Elif Uskuplu Above every seeker of wisdom, a loftier sage does rise In the realm of knowledge, one more knowing, one more wise ii Acknowledgements First and foremost, I would like to express my heartfelt gratitude to my advisors, Michael Shulman and Aaron Lauda, for their contributions to this research. Professor Shulman enriched my research experience, and Professor Lauda provided all kinds of support to enhance my academic journey. I would also like to thank Joseph Helfer and Andrew Bacon for accepting to be part of my thesis committee. I am grateful to Nicolai Kraus, Paolo Capriotti, and Egbert Rijke for their valuable contributions and discussions during my research. Of course, I extend my thanks to my entire family, especially my sister Hilal U˘gur, my mother Nimet U˘gur, and my father Arif U˘gur, who have supported me throughout this process and in my life as a whole. Lastly, though no amount of gratitude can suffice, I want to express my profound appreciation to my spouse and schoolmate, Yasin Emre Usk¨upl¨u. He has been with me since the beginning ¨ of my undergraduate education, providing unwavering support in every aspect of my life. Without his presence and encouragement, I could not have even contemplated pursuing an academic career. The work is partially supported by NSF grant DMS-1902092, the Army Research Office W911NF-20-1-0075, and the Simons Foundation. The work is also based upon work supported by the Air Force Office of Scientific Research under award number FA9550-21-1-0009. iii Table of Contents Epigraph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi Chapter 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 2: Two-level type theory - syntax . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 Types and exo-types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2 Isomorphisms and equivalences . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3 Fibrant exo-types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.4 Cofibrant exo-types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.5 Sharp exo-types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.6 Lifting cofibrancy from exo-nat to other types . . . . . . . . . . . . . . . . . 33 2.6.1 List exo-types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.6.2 Exo-type of binary trees . . . . . . . . . . . . . . . . . . . . . . . . . 37 Chapter 3: Two-level type theory - semantics . . . . . . . . . . . . . . . . . . . . . 42 3.1 Category with families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.1.1 Presheaf CwFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.1.2 Type formers in CwFs . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.1.3 CwFs as a model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.2 Two-level CwFs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.2.1 Two-level CwFs as a model . . . . . . . . . . . . . . . . . . . . . . . 57 3.3 Models with cofibrant exo-nat . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Chapter 4: Agda formalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4.1 Overview of library structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Chapter 5: Future directions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 iv List of Figures 2.1 The diagram about sharpness of exo-coproduct. . . . . . . . . . . . . . . . . 28 2.2 The diagram about sharpness of P-exo-type. . . . . . . . . . . . . . . . . . 30 2.3 Examples of the conversion between binary trees and parenthesizations. . . . 41 3.1 Naturality condition for ΘTy, where σ : ∆ → Γ and τ : Υ → ∆ in C. . . . . . 59 3.2 Naturality condition for ΘTm, where σ : ∆ → Γ and τ : Υ → ∆ in C. . . . . . 59 4.1 Agda code for two kinds of universes. . . . . . . . . . . . . . . . . . . . . . . 66 4.2 An example of the interaction between the flags --two-level and --cumulativity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 4.3 The module dependency graph of the library. . . . . . . . . . . . . . . . . . . 69 v Abstract This study provides some results about two-level type-theoretic notions in a way that the proofs are fully formalizable in a proof assistant implementing two-level type theory such as Agda. The difference from prior works is that these proofs do not assume any abuse of notation, providing more direct formalization. Also, some new notions, such as function extensionality for cofibrant exo-types, are introduced. The necessity of such notions arises during the task of formalization. In addition, we provide some novel results about inductive types using cofibrant exo-nat, the natural number type at the non-fibrant level. While emphasizing the necessity of this axiom by citing new applications as justifications, we also touch upon the semantic aspect of the theory by presenting various models that satisfy this axiom. vi Chapter 1 Introduction Formalizing mathematics has a newer and more vivid meaning than it had before. It stands for the task of representing mathematical knowledge in digital form. Formalization in the new sense is close to implementation of a theory or verification of a knowledge. The basic tools for such a task are the proof assistant programs like Lean, Coq, Agda, and more [5]. In order to formalize a piece of mathematics, we should provide equational reasoning and basic definitions of the mentioned theory to our favorite proof assistant, and then we can make formal derivations relying on the previous building blocks. These derivations might be the digitized version of the knowledge that we proved before by hand. In this sense, the task is a kind of verification of the human knowledge done on paper. Moreover, we can see the implementation aspect of the formalization in the proof assistant itself. For example, proof assistants such as Lean, Coq, and Agda implement dependent type theory [12] while Mizar implements Tarski–Grothendieck set theory [4]. As proof assistants become more interactive than before, it is possible to learn more from the formalization process itself. For many mathematicians, using abuse of notation is a natural approach, and it indeed has some benefits. However, when we start to make mathematics precise in a proof assistant, this approach is not allowed. This is one of the significant differ1 ences between mathematics on paper and on computer. Therefore, during the formalization task, it is very likely to explore the gaps due to abuse of formal language. This is an excellent example of what we can learn from proof assistants. From the author’s perspective, it is fair to say that as we teach computers to be clever at mathematics, they teach us to be more clever. This study is an experience of the interaction between a theory discovered by people and its formalization. The theory subject to the experience is the Homotopy type theory (HoTT). It is a new foundational theory for mathematics. It relies on the intuitionistic type theory with a homotopical interpretation. This theory is also known as the Univalent Foundation due to its essential part, the Univalence axiom. It roughly says equivalent mathematical objects are equal. HoTT is a relatively new and rapidly evolving field within mathematics. By approaching problems that could be subjects of logic from the perspective of homotopy theory, it offers new perspectives and techniques. It treats higher-categorical structures natively. Also, it is naturally an isomorphism- and equivalence-invariant theory thanks to the univalence. Another essential feature of HoTT is that it is constructed on top of MLTT, which can be practically implemented in proof assistants such as Coq [6] and Agda [19]. However, HoTT lacks modeling of some structures (e.g., semisimplical types). Thus, there are some efforts to extend HoTT. Two-level type theory (2LTT) is one of these extensions1 . Briefly saying, 2LTT has two levels; the base level is HoTT while the second level is a traditional form of type theory validating the uniqueness of identity proofs. One can think that the second level is the meta-theory of the first. Chapter 2 and Chapter 4 of this study aim to analyze the bridge between the two levels in terms of formalized mathematics. Why do we care about this bridge, although it has already been analyzed on paper? As a reader who is now familiar with proof assistants might guess, the formalization task is not easy compared to the work done on paper. Some definitions need to be changed or adjusted to be applicable to the assistant. Even obvious derivations should be implemented to obtain 1While we provide basics of 2LTT, we mainly refer to [20] for HoTT and to [3] for 2LTT. 2 precise proofs. In other words, there is no room for gaps. In the case of 2LTT, there is no well-accepted formalization for now. Recently, one of the proof assistants, Agda, has released some new features that allow us to work with 2LTT. Moreover, using these, we have developed an Agda library [21] about 2LTT and some of its applications. This was one of the first attempts to use these features of Agda. Although the initial goal was to formalize the content of the paper The Univalence Principle [1], the basics of 2LTT had to be built first because the study in the mentioned paper is based on 2LTT. Within this experience, some modifications to the definitions and some additional tools were needed. One of our goals is to emphasize these changes and additions that make 2LTT applicable in Agda easily. We provide the details of our library in Chapter 4. During our Agda project, we encountered situations where certain proofs required the formalization of a new auxiliary tool, which we refer to as function extensionality for cofibrant exo-types. Function extensionality is a fundamental property of dependent functions, asserting that two functions are equal if and only if they produce equal results for every input. The specific notion of equality may vary depending on different contexts and levels, but in the case of traditional function extensionality, the equality notion remains consistent both in the domain and the range. However, when dealing with cofibrant exo-types, the situation is different. Here, the equality notions for the input terms and the output terms may differ. Therefore, in our study, we introduce a novel function extensionality property tailored for such cases, and we rigorously establish its validity. Furthermore, our project led us to uncover novel results related to certain inductive types, notably List and Binary-Trees, which had not been explored within the context of 2LTT before. What initially started as a foundation for another study has opened up exciting new directions for further research. In Chapter 5, we also explain why the results about the certain types can be an inspiration to a more general case. One of the original motivations for 2LTT was to define semisimplicial types. However, al3 though plain 2LTT allows defining the type of n-truncated semisimplicial types for any exonatural number n, a term of N in the second level, it does not seem possible to assemble these into a type of untruncated semisimplicial types. Voevodsky’s solution [22] was to assume that exo-nat, N in the second level, is fibrant (isomorphic to a type in the first level), which works for simplicial sets but may not hold in all infinity-toposes. However, assuming cofibrancy, a weaker notion than fibrancy, of exo-nat also allows for defining a fibrant type of untruncated semisimplicial types with a broader syntax, including models for all infinity-toposes. After giving the overview of the models of 2LTT, we provide such models in Chapter 3. Structure of this work. In Chapter 2, we begin with the fundamentals of 2LTT. The beginning of this chapter is written in an informal style similar to HoTT Book [20]; however, we have formalized all the theorems in that chapter. Our basic objects, types, and exo-types are explained. We then give the three exo-types classifications which are fibrancy, cofibrancy, and sharpness. Note that these concepts are the basic building blocks of the mentioned study [1]. We also provide new results about the cofibrancy and sharpness of some inductive types. Proposition 2.4.2 and the entire Section 2.6 are new in this field. In Chapter 3, to present the complete picture, we also explored the semantic aspect of the study and introduced the meaning of 2LTT’s model, providing results about the general models of the theory we were concerned with. As far as we know, there have been no previous studies on non-trivial models of 2LTT with cofibrant exo-nat. By non-trivial, we mean the proposed model satisfies cofibrant exo-nat but does not necessarily satisfy fibrant exo-nat. Theorem 3.3.3 proves the existence of models we desired. In Chapter 4, we point to the relevant codes in the Agda library and talk about how, if any, things that differ from previous work contribute to Agda formalization. In Chapter 5, we briefly discuss the future directions. Drawback and limitations. Although the proofs in the paper are logically valid and complete, the formalization of 2LTT heavily depends on new, experimental, and undocumented features of Agda. As such, there are some bugs emerging from the previously untested in4 teractions of these features, and there might be more than we encountered. There are some efforts by Agda developers to fix these bugs in the Agda source code. We expect the study with these experimental features to produce documentation on what we need to avoid bugs. 5 Chapter 2 Two-level type theory - syntax 2.1 Types and exo-types The primitive objects of a type theory are types and terms. These are similar to sets and elements in set theory. For 2LTT, there are two different kinds of types: one kind in HoTT and other kind in meta level. We reserve the word “types” for ones in HoTT (as usual) while we use the word “exo-type1” for ones in meta level, as in [1]. According to this distinction, we should define each type and type formers twice: one for types, one for exo-types. In type theory, we define universe as a type of types. In order to avoid paradoxes a la Russell, we assume a universe hierarchy. Thus, a universe is again a type, but in a different sense than its terms. In our setting, we have a hierarchy of universes of types, denoted by U, and exo-universes of exo-types, denoted by Ue . We always make the distinction between types and exo-types using the superscript −e . After having universes and exo-universes, it is easy to define types and exo-types. We are assuming all definitions in HoTT Book [20], and hence we have basic type and type formers. Exo-type and exo-type formers are defined exactly in the same way, but these are defined in 1This term was originally suggested by Ulrik Buchholtz. 6 the exo-universe. Definition 2.1.1. • For a type A : U and a type family B : A → U, we define the dependent function type (briefly Q -type) Y a:A B(a) as usual. If B is a constant family, then the dependent function type is the ordinary function type: Y a:A B := A → B . For an exo-type A : Ue and an exo-type family B : A → Ue , we have the dependent function exo-type (briefly Q -exo-type) Y a:A e B(a) in a similar way. If B is constant, then we have the ordinary function exo-type Y a:A e B := A →e B . It should be noted that the notation for maps between exo-types “→e” can be used throughout this paper to emphasize distinction. However, we omit the notation and use usual arrows for any cases since the domain and the codomain can be derived from the context, or we can specify whether we have type or exo-type. • For a type A : U and a type family B : A → U, we define the dependent sum type (briefly P-type) X a:A B(a) as usual, and its terms are of the form pair(a, b) for a : A and b : B(a). The projection 7 maps are π1 : P a:A B(a) → A and π2 : P a:A B(a) → B(a). When B is a constant family, we call it the product type and denote it by A × B. For an exo-type A : Ue and an exo-type family B : A → Ue , we have the dependent sum exo-type (briefly P-exo-type) X a:A e B(a) in a similar way, and its terms are of the form paire (a, b) for a : A and b : B(a). The projection maps are π1 e : P a:A eB(a) → A and π2 e : P a:A eB(a) → B(a). When B is a constant family, we have the product exo-type A ×e B. Note that we will use the notation (a, b) for pair(a, b) or paire (a, b) when the context is clear. We prefer the comma notation in this paper due to easier reading. This choice and the choice for arrows may seem to be contradictory with our claim of “no abuse of notation”. However, the choices are only for aesthetic purposes, and the notation difference is precise in the formalization. • For a pair of types A, B : U, we define the coproduct type A + B : U as usual, constructed by the maps inl : A → A + B and inr : B → A + B. For a pair of exo-types A, B : Ue , we define the coproduct exo-type A +e B : Ue similarly, constructed by the maps inle : A → A +e B and inre : B → A +e B. • While the unit type, denoted by 1 : U, is constructed by a single term ⋆ : 1, the unit exo-type, denoted by 1 e : Ue , is constructed by a single exo-term ⋆ e : 1 e . • We have both the empty type, denoted by 0 : U, and the empty exo-type, denoted by 0 e : Ue . Both have no constructors, and hence no term by definition. • The natural number type, denoted by N : U, is constructed by a term 0 : N and a function term succ : N → N. The natural number exo-type (briefly exo-natural or 8 exo-nat), denoted by N e : Ue , is constructed by 0 e : N e and succe : N e → N e . • The finite type having n terms, denoted by N<n, defined inductively (on n : N) as N<0 := 0 and N<n+1 := N<n + 1 . Similarly exo-finite exo-type having n terms, denoted by N e <n, is defined inductively (on n : N e ) as N e <0 := 0 e and N e <n+1 := N e <n + e 1 e . • For a type A : U and a, b : A, we define the identity type (or path type) a = b : U as usual, its constructor is refl : a = a. For an exo-type A : Ue and a, b : A, we have the exo-equality a =e b : Ue in a similar way; its constructor is refle : a =e a. Note that these type/exo-type pairs may not coincide in the cases of +e , N e , 0 e , and =e . For example, even if A, B : U, we may not have A +e B : U, namely, this is always an exo-type, but not generally a type. The difference in these cases is that the elimination/induction rules of fibrant types cannot be used unless the target is fibrant. For example, we can define functions into any exo-type by recursion on N e , but if we want to define a function f : N → A by recursion, we must have A : U. Remark 2.1.2. We assume the univalence axiom (UA) only for the identity type. Thus, we also have the function extensionality (funext) for it because UA implies funext (Theorems 4.9.4 & 4.9.5 in [20]). For the exo-equality, we assume the funexte and the axiom called Uniqueness of Identity Proofs (UIP). In other words, we have the following • UA : Q A,B:U (A ≃ B) → (A = B) • funext : (f, g : Q A B(a)) → ( Q a:A f(a) = g(a) → (f = g)) • funexte : (f, g : Qe A B(a)) → ( Qe a:A f(a) =e g(a) → (f =e g)) 9 • UIP : Qe a,b:A Qe (p,q:a =e b) p =e q In the applications or examples, we often make use of both versions of function extensionality. Note also that UIP says that for any terms a, b in an exo-type A, if they are exo-equal, namely, there is an exo-equality between them, then the equality term is unique. Remark 2.1.3. Just as there is a type hierarchy in terms of path types such as contractible types, propositions, and sets, we can define exo-contractible exo-type, exopropositions, and exo-sets similarly with respect to =e . Since we assume UIP for exoequality, this yields that all exo-types are exo-sets. As another note, any property of = can be defined for =e similarly by its elimination rule. For example, we have both transport (tr) and exo-transport (tre ), we have both path-type homotopies (∼) of functions between types and exo-equality homotopies (∼e ) of functions between exo-types, and so on. For this kind of properties, not defined here, we refer to the HoTT Book [20]. 2.2 Isomorphisms and equivalences Considering these twin definitions in the previous section, it’s natural to ask whether there is a correspondence between them. We obtain such a correspondence according to the relation between types and exo-types. In [3], it is assumed that there is a coercion map c from types to exo-types, for any type A : U we have c(A) : Ue . Another approach, as in [1], is taking c as an inclusion, in other words, assuming every type is an exo-type. In this work, the second approach is assumed. Therefore, we can apply exo-type formers to types. For example, both N + N and N +e N make sense. The former is originally a type, but also an exo-type. However, the latter is only an exo-type. We will later prove some isomorphisms related to such correspondences. However, what an isomorphism between exo-types means should be defined beforehand. Definition 2.2.1. 10 • A function f : A → B between exo-types is called an isomorphism (or exo-isomorphism) if there is a function g : B → A such that g ◦ e f =e idA and f ◦ e g =e idB where idA : A → A is the identity map. We define the exo-type of exo-isomorphisms as A ∼= B := Xe f:A→B Xe g:B→A (f ◦ e g = e idB) × e (g ◦ e f = e idA). It can be read as A ∼= B consists of exo-quadruples (f, g, p, q) such that f : A → B and g : B → A are functions, and p, q are witnesses for the relevant identities. Note that ◦ e means that the composition is between two functions of exo-types. • A function f : A → B between types is called an equivalence if its fibers are contractible. We define the type of equivalences as A ≃ B := X f:A→B Y b:B is-Contr X a:A f(a) = b !! . It can be read as A ≃ B consists of pairs (f, p) where f is a function and p is a witness of that all fibers of f is contractible. In other words, the preimage of each term in B is unique up to the identity type. • A function f : A → B between types is called quasi-invertible if there is a function g : B → A such that g ◦ f = idA and f ◦ g = idB where idA : A → A is the identity map. Remark 2.2.2. In these definitions, one can use funexte or funext, and instead of showing, for example, g ◦ e f =e idA, it can be showed that g(f(a)) = a for any a : A. Moreover, a map is an equivalence if and only if it is quasi-invertible. Therefore, we can use both interchangeably. For practical purposes, when we need to show f is an equivalence, we generally do it by showing that it is quasi-invertible. Assuming that each type is an exo-type, and considering all definitions so far, the correspon11 dence between exo-type formers and type formers can be characterized2 as follows: Theorem 2.2.3. If A, C : U are types and B : A → U is a type family, we have the following maps. The first three maps are exo-isomorphisms. i. 1 e → 1, ii. Pe a:A B(a) → P a:A B(a), iii. Qe a:A B(a) → Q a:A B(a), iv. A +e C → A + C, v. 0 e → 0, vi. N e → N, vii. For any a, b : A, we have (a =e b) → (a = b). Proof. For each one, the definition follows from the elimination rule of the corresponding exo-types. i. The map x 7→ ⋆ is an isomorphism with the inverse x 7→ ⋆ e . ii. The map paire (a, b) 7→ pair(a, b) is an isomorphism with the inverse pair(a, b) 7→ paire (a, b). iii. The map f 7→ (a 7→ f(a)) is an isomorphism with the inverse as denoted the same. Note that we do not take the identity map because domain and codomain are not the same. iv. The map is defined as inle a 7→ inl a and inre b 7→ inr b. v. The map is the usual null map that corresponds to the principle ex falso quodlibet. vi. The map, say f, is defined as 0 e 7→ 0 and succe (n) 7→ succ(f(n)). vii. The map is defined as refle 7→ refl. 2This is the same as Lemma 2.11 in [3]. 12 Remark 2.2.4. It is worth emphasizing that the inverses of the maps iv, v, and vi can be assumed to exist. There are some models where these hold (for the details, see the discussion below Lemma 2.11 [3]). However, a possible inverse for the map vii would yield a contradiction because the univalence axiom is inconsistent with the uniqueness of identity proofs. This conversion from the exo-equality (=e ) to the identity (=) has still an importance in many proofs later. Thus we denote it by eqtoid : Y a,b:A e (a = e b) → (a = b). One of its useful corollaries is the following lemma. Lemma 2.2.5. Let A, B : U be two types. If A ∼= B, then A ≃ B. Proof. Let f : A → B and g : B → A be such that p : f ◦ e g = e idB and q : g ◦ e f = e idA . Since, A → B and B → A are also (function) types, we get eqtoid(p) : f ◦ e g = idB and eqtoid(q) : g ◦ e f = idA . Since f ◦ e g = f ◦ g and g ◦ e f = g ◦ f hold by definition, we are done. 2.3 Fibrant exo-types Definition 2.3.1. An exo-type A : Ue is called a fibrant exo-type if there is a type RA : U such that A and RA are exo-isomorphic. In other words, A is fibrant when the following exo-type is inhabited isFibrant(A) := X RA:U e (A ∼= RA). 13 Proposition 2.3.2 ([3]). The following are true: i. Any type A : U is a fibrant exo-type. ii. The unit exo-type 1 e is fibrant. iii. Let A : Ue and B : A → Ue , if A is fibrant, and each B(a) is fibrant, then both Pe a:A B(a) and Qe a:A B(a) are fibrant. iv. If A, B : Ue are exo-isomorphic types, then A is fibrant if and only if B is fibrant. v. If A : Ue is fibrant, and there are two types B, C : U such that A ∼= B and A ∼= C, then B = C. Proof. i. This is trivial because we can take (A, idA) : isFibrant(A). ii. By Theorem 2.2.3, we know that there is an exo-isomorphism e : 1 e ∼= 1. iii. Let RA : U and RB : A → U such that A ∼= RA and B(a) ∼= RB(a) for each a : A. Take rA : A → RA with inverse sA : RA → A. Using the functoriality of P-exo-types and the map ii in Theorem 2.2.3, we have X a:A e B(a) ∼= X c:RA e RB(sA(c)) ∼= X c:RA RB(sA(c)). Similarly, the functoriality of Q -exo-types and the map iii in Theorem 2.2.3 imply that Y a:A e B(a) ∼= Y c:RA e RB(sA(c)) ∼= Y c:RA RB(sA(c)). iv. If A is fibrant, namely, A ∼= RA for a type RA : U, since ∼= is transitive, we get B ∼= A ∼= RA. The reverse is the same. v. By transitivity, we have B ∼= C. Lemma 2.2.5 implies A ≃ B, and the result follows from the univalence. 14 Just as we have fibrant exo-types, we can consider the maps between fibrant exo-types as the maps between types. Definition 2.3.3. Let A, B : Ue be two fibrant exo-types, and f : A → B. Let RA, RB : U be such that A ∼= RA and B ∼= RB. We have the following diagram. A B ∼= ∼= RA RB f rA sA rB sB We call f a fibrant-equivalence if rB ◦ e f ◦ e sA : RA → RB is an equivalence. Proposition 2.3.4. Let A, B, C : Ue be fibrant exo-types, and f : A → B and g : B → C. Consider the corresponded diagram. A B C ∼= ∼= ∼= RA RB RC f rA f ′ rB g sA sB rC sC The following are true: i. If f is an exo-isomorphism, then it is a fibrant-equivalence. ii. If f, g are fibrant-equivalences, then so is g ◦ e f. iii. If f, f′ are homotopic with respect to =e , and f is a fibrant-equivalence, then f ′ is a fibrant-equivalence, too. Proof. i. Let h : B → A be such that f ◦ e h =e idB and h ◦ e f =e idA. We claim that 15 rB ◦ e f ◦ e sA : RA → RB is an equivalence with the inverse rA ◦ e h ◦ e sB : RB → RA. It can be shown via the following chain of exo-equalities: (rB ◦ e f ◦ e sA) ◦ e (rA ◦ e h ◦ e sB) =e rB ◦ e f ◦ e (sA ◦ e rA) ◦ e h ◦ e sB =e rB ◦ e (f ◦ e h) ◦ e sB =e rB ◦ e sB =e idRB Then taking eqtoid of this exo-equality proves that (rB ◦ e f ◦ e sA) ◦ (rA ◦ e h ◦ e sB) = idRB . The right-inverse identity can be proved similarly. ii. We need to prove that rC ◦ e (g ◦ e f) ◦ e sA is an equivalence. This map is path-homotopic to (rC ◦ e g ◦ e sB) ◦ (rB ◦ e f ◦ e sA). Since compositions and homotopies preserve equivalences, we are done. iii. By assumption rB ◦ e f ◦ e sA is an equivalence. For all c : RA, we have rB(f(sA(c))) =e rB(f ′ (sA(c))) because f(x) =e f ′ (x) for all x : A. Since homotopies preserve equivalences, we get rB ◦ e f ′ ◦ e sA is an equivalence. We also have other useful properties for fibrant-equivalences. For example, consider the following diagram between fibrant exo-types. 16 A B C f f ◦ e g g Then 2-out-of-3 property says if two of the three maps f, g and the composite g ◦ e f are fibrant-equivalences, then so is the third. For another example, consider the commutative diagram between fibrant exo-types. A B A′ B′ f g g ′ f ′ Then 3-out-of-4 property says if three of the four maps f, f ′ , g, g ′ are exo-equivalences, then so is the fourth. 2.4 Cofibrant exo-types In this section, a weaker definition than fibrancy is given. We also provide a new (but logically equivalent) characterization of it. Note that if a property, that is defined for types initially, is attributed to a fibrant exo-type, we emphasize that the property belongs to the fibrant match of the exo-type. Definition 2.4.1 ([3] Corollary 3.19(i)). Let A : Ue be an exo-type. We call it cofibrant if the following holds: • For any type family Y : A → U over A, the exo-type Qe a:A Y (a) is fibrant, • In the case above, if Y (a) is contractible for each a : A, then so is the fibrant match of Qe a:A Y (a). The following gives a logically equivalent definition of cofibrancy. Attention should be paid to the use of = and =e in order to indicate whether the terms belong to the type or the 17 exo-type. Proposition 2.4.2. Let A : Ue be an exo-type such that for any type family Y : A → U over A, the exo-type Qe a:A Y (a) is fibrant. Then the following are equivalent: i. In the case above, if Y (a) is contractible for each a : A, then so is its fibrant match of Qe a:A Y (a), namely A is cofibrant. ii. (Funext for cofibrant exo-types). In the case above, for any f, g : Qe a:A Y (a) if f(a) = g(a) for each a : A, then r(f) = r(g) where FM : U and Qe a:A Y (a) ∼= FM r s . Proof. (i ⇒ ii) Let f, g : Qe a:A Y (a) be such that ta : f(a) = g(a) for each a : A. Consider another type family Y ′ : A → U defined as Y ′ (a) := X b:B(a) b = f(a). Then both f ′ := λa.(f(a), refl) and g ′ := λa.(g(a), t−1 a ) are terms in Qe a:A Y ′ (a). By our assumptions, there is a FM′ : U such that Qe a:A Y ′ (a) ∼= FM′ r ′ s ′ . Since the type of paths at a point is contractible (Lemma 3.11.8 in [20]), we have each Y ′ (a) is contractible. By the assumption (i), we get FM′ is contractible, and hence r ′ (f) = r ′ (g). (2.1) 18 Using this, we have the following chain of identities: r(f) = r(π1(s ′ (r ′ (f ′ )))) = r(π1(s ′ (r ′ (g ′ )))) = r(g). The first (and the third, by symmetry) identity is obtained as follows: Because r ′ and s ′ are exo-inverses of each other, we have (a : A) → π1(f ′ (a)) =e π1((s ′ (r ′ (f ′ )))(a)). Thus, by funexte , we get π1(f ′ ) =e π1((s ′ (r ′ (f ′ )))). Then we apply3 r to the equality, and make it an identity via eqtoid because the terms are in FM′ which is a type. The second identity is obtained by the applying to the function λx.r(λa.π1((s ′x)(a))) : FM′ → FM to the identity 2.1, so we are done. Note that even if r has exo-type domain and s ′ has exo-type codomain, we can compose these in a way that the resulting map is from a type to a type. Thus, we can apply it to an identity. (ii ⇒ i) Suppose Y (a) is contractible for each a : A. We want to show that FM is contractible where Qe a:A Y (a) ∼= FM r s . Let ba : Y (a) be the center of contraction for each a : A. Then this gives a function f := λa.ba : Qe a:A Y (a). For any x : FM, since f(a) = ba = s(x)(a) for each a : A by 3We mean the usual ap operation in HoTT by saying “applying a function to an identity (or exo-equality)”. 19 contractibility assumption, we get r(f) = r(s(x)). Also, applying eqtoid to the exo-equality r(s(x)) =e x, we get r(s(x)) = x, and transitivity of = yields r(f) = x. Therefore, FM is contractible with the center of contraction r(f). Cofibrant exo-types have the following properties. Proposition 2.4.3 ([3]). i. All fibrant exo-types are cofibrant. ii. If A and B are exo-types such that A ∼= B, and if A is cofibrant, then B is cofibrant. iii. 0 e is cofibrant, and if A, B : Ue are cofibrant, then so are A+eB and A×eB. In particular, all exo-finite exo-types are cofibrant. iv. If A : Ue is cofibrant and B : A → Ue is such that each B(a) is cofibrant, then Pe a:A B(a) is cofibrant. Proof. i. Let A be a fibrant exo-type, say A RA r s . Then for any Y : A → U, by Proposition 2.3.2, we know that Qe a:A Y (a) is fibrant with the fibrant match Q c:RA Y (s(c)). If each Y (a) is contractible, then so is Q c:RA Y (s(c)) because this holds for ordinary types. ii. Let f : A → B be an exo-isomorphism with the inverse g : B → A. Let Y : B → U. Consider the following diagram. Qe b:B Y (b) Qe a:A Y (f(a)) FMA u v rA sA The maps u, v form isomorphisms by the Q -functoriality property. The isomorphisms rA, sA are obtained by the cofibrancy of A. Therefore, we get Qe b:B Y (b) is fibrant. Also, if each Y (b) is contractible, then in particular Y (f(a)) is contractible for each a : A. So FMA is contractible since A is cofibrant. This proves that B is cofibrant. iii. In the case of 0 e , for any Y : 0 e → U, it’s easy to show that Qe c:0 e Y (c) ∼= 1. This satisfies two conditions necessary for being cofibrant simultaneously. 20 For an exo-coproduct, if A, B : Ue are cofibrant, and Y : A+e B → U, we have the following diagram. Qe c:A+eB Y (c) ( Qe a:A Y (inl(a))) ×e ( Qe b:B Y (inr(b))) Qe c:A+eB Y (c) FMA × FMB u v rA×rB sA×sB Here, the maps u, v have their own obvious definitions, and they are isomorphisms. (Actually, the analogous statement is true for types4 , and the exo-type version can be proven similarly in terms of =e .) The exo-isomorphisms rA and rB come from cofibrancy of A and B, respectively. It is easy to see that rA × rB is an exo-isomorphism. Therefore, (rA × rB) ◦ e u is the exo-isomorphism we searched for. If each Y (c) is contractible, in particular, both Y (inl(a)) and Y (inr(b)) are contractible. By the assumption, this means that both FMA and FMB are contractible, and so is FMA × FMB. This proves that A +e B is cofibrant. The case of an exo-product is a particular case of Pe -exo-types. For exo-finite exo-types, using induction on N e , it follows from that both 0 e and 1 e are cofibrant, and cofibrancy is preserved under exo-coproducts. iv. Suppose A is cofibrant and each B(a) is cofibrant. Let Y : Pe a:A B(a) → U and consider the following diagram. Qe c: Pe a:A B(a) Y (c) Qe a:A Qe b:B(a) Y (a, b) Qe a:A FMB(a) FMA u v rB(a) sB(a) rA sA The maps u, v form the usual isomorphism by the expansion of Pe -exo-type. (Actually, the same is true for types, and the exo-type version can also be proven similarly in terms of =e .) The maps rB(a) and sB(a) form an isomorphism by the cofibrancy of B(a) and the Q - 4See Exercise 2.9 in the HoTT Book [20] 21 functoriality property. The last pair of maps rA, sA form an isomorphism by the cofibrancy of A. Therefore, the exo-type in the top left corner is fibrant. Furthermore, if each Y (c) is contractible, in particular Y (a, b) is contractible, then each FMB(a) is contractible by the cofibrancy of B(a). This proves that FMA is contractible by the cofibrancy of A. This proves that Pe a:A B(a) is cofibrant. 2.5 Sharp exo-types Another class of exo-types is the class of sharp ones. This was given in [1] for the first time. As in the previous section, we’ll give the proofs without any abuse of notation, and so their formalization is the same as in this paper. Definition 2.5.1 (Def. 2.2 [1]). An exo-type A is sharp if it is cofibrant, and and it has a “fibrant replacement”, meaning that there is a fibrant type RA and a map r : A → RA such that for any family of types Y : RA → U, the precomposition map below is a fibrantequivalence (recall Definition 2.3.3). (− ◦e r) : Y c:RA Y (c) → Y a:A e Y (r(a)) (2.2) The following lemma gives another definition for sharp exo-types. First, we need an auxiliary definition. Definition 2.5.2. Let A, B : Ue be two fibrant exo-types, and f : A → B be a map. Let RA, RB : U be such that A ∼= RA and B ∼= RB. Take sA : RA → A and rB : B → RB as these isomorphisms. Then f has a fibrant-section if rB ◦ e f ◦ e sA : RA → RB has a section, namely, there is g : RB → RA such that (rB ◦ e f ◦ e sA) ◦ e g = idRB. 22 Lemma 2.5.3 ([1]). Let A be a cofibrant exo-type, RA a type, and r : A → RA a map. The following are equivalent: 1. The map (2.2) is a fibrant-equivalence for any Y : RA → U, so that A is sharp. 2. The map (2.2) has a fibrant-section for any Y : RA → U. 3. The map (2.2) is a fibrant-equivalence whenever Y := λx.Z for a constant type Z : U, hence RA → Z is equivalent to the fibrant match of A → Z. Proof. (1 ⇒ 2) follows from the fact that an equivalence has a section. (1 ⇒ 3) is trivial because 3 is a particular case of 1. (2 ⇒ 1) Let Y : RA → U be a family of types over A and consider the relevant diagram. Q c:RA Y (c) Q a:A Y (r(a)) Q c:RA Y (c) FM (− ◦e r) rA α:=rA ◦ e (− ◦e r) sA By the assumption, we know that α has a section, say β : FM → Q c:RA Y (c), so that we have α ◦ β = idFM. It is enough to show that β ◦ α = idQ RA Y We claim that for any f, g : Q c:RA Y (c), we have α(f) = α(g) → f = g. If this is true, for any h : Q c:RA Y (c), taking f := β(α(h)) and g := h we are done by funext. Now, for the proof of the claim, consider another type family over RA defined as Y ′ (c) := (f(c) = g(c)), so that we have another diagram Q c:RA Y ′ (c) Q a:A Y ′ (r(a)) Q c:RA Y ′ (c) FM′ (− ◦e r) r ′ A α ′ :=r ′ A ◦ e (− ◦e r) s ′ A 23 and again α ′ has a section β ′ . If we assume α(f) = α(g) for f, g : Q c:RA Y (c), this is q : rA(f ◦ e r) = rA(g ◦ e r) by the definition. Define T := λ(a : A).pa where pa : f(r(a)) = g(r(a)) is obtained by f(r(a)) = (sA(rA(f ◦ e r)))(a) = (sA(rA(g ◦ e r)))(a) = g(r(a)). The first and the last ones follow from the fact that rA and sA are inverses of each other. The middle identity is obtained by the applying λu.(sA(u))(a) to the path q. Finally, we are done by using funext on β ′ (s ′ A(T)) : Qe c:RA f(c) = g(c). (3 ⇒ 2) Let Y : RA → U be a family of types over RA and define Z := P c:RA Y (c). By our assumptions, we have the following diagrams. Our aim is to show that α has a section. RA → Z A → Z Q c:RA Y (c) Q a:A e Y (r(a)) ∼= and ∼= RA → Z ≃ FMZ Q c:RA Y (c) FM (− ◦e r) rZ (− ◦e r) rA αZ :=rZ ◦ e (− ◦e r) sZ βZ α:=rA ◦ e (− ◦e r) sA For any f : Qe a:A Y (r(a)) define f ′ : A → Z by f ′ (a) := (r(a), f(a)). For all a : A, we have qa : π1(βZ(rZ(f ′ )) (r(a))) = r(a) obtained by applying π1 to (βZ(rZ(f ′ ))) (r(a)) = sZ(αZ(βZ(rZ(f ′ ))))(a) = sZ(rZ(f ′ ))(a) = f ′ (a) The first comes from the fact that u ◦ e r =e (sZ ◦ e αZ)(u) for all u : RA → Z. The second and 24 the third are followed by the exo-isomorphisms rZ, sZ and the equivalence αZ, βZ. Consider another diagram obtained by the assumption 3 for Z := RA. RA → RA A → RA ∼= RA → RA ≃ FMRA (− ◦e r) rRA αRA:=rRA ◦ e (− ◦e r) sRA βRA By funext for cofibrant exo-types, since λa.qa : Ye a:A π1(βZ(rZ(f ′ )) (r(a))) = r(a), we get rRA(π1 ◦ e (βZ(rZ(f ′ ))) ◦ e r) = rRA(r). Then for all f : Qe a:A Y (r(a)), we have pf : π1 ◦ e (βZ(rZ(f ′ ))) = idRA→RA obtained by π1(βZ(rZ(f ′ ))) = βA(αA(π1 ◦ e (βZ(rZ(f ′ ))))) = βA(rRA(π1 ◦ e (βZ(rZ(f ′ ))) ◦ e r)) = βA(rRA(r)) = βA(αA(idRA→RA)) = idRA→RA . These come from exo-isomorphisms and/or equivalences. Finally, we define the section map β : FM → Q c:RA Y (c) by the following5 : β(x) := λ(c : RA). tr (happly psA(x) c) π2(βZ(rZ((sA(x) ′ )))(c)). 5Here, tr and happly are the operations related by the identity types, see [20] for the details. 25 To finish the proof, we should show α ◦ β = idFM. Let x : FM, then for all a : A, we have β(x)(r(a)) = sA(x)(a). (2.3) This comes from applying π2 to the identity (r(a), β(x)(r(a))) = (sA(x))′ (a) which is obtained by (r(a), β(x)(r(a))) = βZ(rZ(sA(x) ′ )) (r(a)) = sZ(αZ(βZ(rZ(sA(x) ′ )))) (a) = sZ(rZ(sA(x) ′ ))(a) = sA(x) ′ (a) Here, the first identity is followed by the lifting property6 of the transport map, the others are obtained by exo-isomorphisms or equivalences. Now, by funext for cofibrant exo-types, the identity (2.3) proves that rA(β(x) ◦ e r) = rA(sA(x)). However, the left side is equal to (α ◦ β)(x) by definition, and the right side is equal to x due to the exo-isomorphism. Therefore, β is a section for α, which proves the statement 2. As in the cofibrant exo-types, the notion of sharpness has its own preservation rules. The following proposition gives these rules. Proposition 2.5.4 ([1]). The following are true: i. All fibrant exo-types are sharp. ii. If A and B are exo-types such that A ∼= B, and if A is sharp, then B is sharp. iii. 0 e is sharp, and if A and B are sharp exo-types, then so are A +e B and A ×e B. iv. If A is a sharp exo-type, B : A → U is such that each B(a) is sharp, then Pe a:A B(a) 6Lemma 2.3.2 in the HoTT Book [20] 26 is sharp. v. Each finite exo-type N e <n is sharp. vi. If N e is cofibrant, then it is sharp. Proof. For (i) if A is a fibrant exo-type, and RA : U is such that A ∼= RA, then we can take RA as the fibrant replacement. By Proposition 2.4.3(i) A is cofibrant, and the map (2.2) is trivially a fibrant-equivalence. By Proposition 2.4.3(iii), 0 e is cofibrant, and we can take 0 as fibrant replacement. Also, the Q -type and Qe -exo-type in the map (2.2) are contractible and exo-contractible, respectively. Thus, it is trivially a fibrant-equivalence. The statement (ii) can be shown as in Proposition 2.4.3(ii). Since 1 e is fibrant, and hence sharp, the sharpness of finite types follows from that sharpness is preserved under an exocoproduct. The case of an exo-product is a particular case of Pe -exo-types. Thus, it remains to show the exo-coproduct case, (iv) and (vi). For an exo-coproduct, let A and B be two sharp exo-types. By Proposition 2.4.3(iii), A+e B is cofibrant. Let RA, RB : U be the fibrant replacements of A, B, respectively. Let rA : A → RA and rB : B → RB be the relevant maps. We claim that RA + RB is a fibrant replacement of A +e B with the map r : A +e B → RA + RB defined by r(x) :≡ inl rA(a) if x = inle a, inr rB(b) if x = inre b. For Y : RA + RB → U consider the commutative diagram in Figure 2.1. In the diagram, the equivalences ≃1 and ≃2, and the isomorphism ∼=1 follow from the universal property of (exo)coproducts [20]. The three pairs of maps (uA, vA), (uB, vB), and (u, v) are obtained by cofibrancy of A, B, and A +e B, and hence these are all exo-isomorphisms. Since A and B 27 Q c:RA+RB Y (c) Q c:RA+RB Y (c) Q x:RA Y (inl x) × Q y:RB Y (inr y) Q x:RA Y (inl x) × Q y:RB Y (inr y) Qe a:A Y (inl rA(a)) ×e Qe b:B Y (inr rB(b)) F A × F B Qe d:A+eB Y (r(d)) FM ≃1 ≃2 (− ◦e rA)×e (− ◦e rB) α×β uA×euB ∼=1 vA×evB ∼=2 u v Figure 2.1: The diagram about sharpness of exo-coproduct. are sharp, the map α and β are equivalences. It is then easy to see that α × β is also an equivalence. The composition of three arrows on the left is the precomposition map (− ◦e r). Observe that the composition of three arrows on the right is an equivalence. Indeed, the first and second are already equivalences. Since we have the isomorphism ∼=2 between types F A × F B and FM, this is also an equivalence by Proposition 2.3.4(i). Therefore, the right composition of arrows is an equivalence, so (− ◦e r) is a fibrant-equivalence. For a dependent sum, let A be a sharp exo-type, B : A → U be such that each B(a) is sharp. By Proposition 2.4.3(iv), we have Pe a:A B(a) is cofibrant. It remains to find a fibrant replacement. Let rA : A → RA be the fibrant replacement of A, and ra : B(a) → RB(a) be the fibrant replacement of each B(a) for a : A. We have RB : A → U. Consider the diagram obtained by the sharpness of A. 28 RA → U A → U ∼= RA → U ≃ FM (− ◦e rA) u α v β Define RBg := β(u(RB)) : RA → U, and we will make P c:RA RBg(a) the fibrant replacement of Pe a:A B(a). Define r : Pe a:A B(a) → P c:RA RBg(a) by r(a, b) := ( rA(a), ea(ra(b)) ) where e : Qe a:A RB(a) ≃ RBg(rA(a)). The family of equivalences e is obtained by the identity, for all a : A RBg(rA(a)) = v(u(RBg◦ e rA))(a) = v(α(RBg))(a) = v(α(β(u(RB))))(a) = v(u(RB))(a) = RB(a). It remains to show that (− ◦e r) is a fibrant-equivalence. Consider the commutative diagram in Figure 2.2 for the dependent type Y : P c:RA RBg(a) → U. In Figure 2.2, the first and the second rows contain two types, and there is a canonical equivalence ϕ0 between them obtained by a universal property. Similarly, the map ϕ4 is a canonical isomorphism. Also, the maps ϕ1, ϕ2, and ϕ3 have their own obvious definitions. The types from FM1 to FM4 are obtained by the cofibrancy of A, B(a) and Pe a:A B(a). Therefore, the pairs of maps from (u1, v1) to (u4, v4) are isomorphisms. The pair (α1, β1) is an equivalence since A is sharp. The pair (α2, β2) is an equivalence by a functoriality rule7 since RB(a) ≃ RBg(rA(a)) for any a : A. The pair (α3, β3) is an equivalence by a similar functoriality rule and the fact that B(a) is sharp for each a : A. The 7 If A ≃ B and P : A → U, Q : B → U such that P ≃ Q, then Q A P ≃ Q B Q. We have similar rule for exo-types with ∼=. 29 Q z: P c:RA RBg(c) Y (z) Q z: P c:RA RBg(c) Y (z) Q c:RA Q y:RBg(c) Y (c, y) Q c:RA Q y:RBg(c) Y (c, y) ≃ Qe a:A Q y:RBg(rA(a)) Y (rA(a), y) ∼= FM1 ≃ Qe a:A Q x:RB(a) Y (rA(a), ea(x)) ∼= FM2 ≃ Qe a:A Qe b:B(a) Y (rA(a), ea(ra(b))) ∼= FM3 ≃ Qe s: Pe a:A B(a) Y (r(s)) ∼= FM4 ϕ0 ϕ0 ϕ1 α1 ϕ2 u1 v1 β1 α2 ϕ3 u2 v2 β2 α3 ϕ4 u3 v4 β3 α4 u4 v4 β4 Figure 2.2: The diagram about sharpness of P-exo-type. 30 pair (α4, β4) is an isomorphism since the other sides of the last square are all isomorphisms, and hence it is an equivalence. Now, while the composition of the maps on the left is the precomposition (− ◦e r), the composition of the maps on the right is an equivalence. Thus, it finishes the proof that Pe a:A B(a) is sharp. As for the statement (vi), suppose N e is cofibrant. We take N as a fibrant replacement, and the transfer map r : N e → N defined by r(0 e ) := 0 and r(succe n) = succ r(n). For any Y : N → U, consider the diagram: Q n:N Y (n) Qe m:Ne Y (r(m)) Q n:N Y (n) FMY (− ◦e r) uY αY vY Using Lemma 2.5.3, we will show that (− ◦e r) has a fibrant-section, namely, αY = uY ◦ e (− ◦e r) has a section. First, we define an auxiliary type S : Y n:N Y Y :N→U Y x:FMY Y (n) by S(0, Y, x) := vY (x)(0 e ) and S(succ(n), Y, x) := S(n, Y ′ , x′ ) where Y ′ (n) := Y (succ(n)), x ′ := uY ′(λa. vY (x) (succe (a)) ). We then define the section map βY : FMY → Q n:N Y (n) as βY (x)(n) := S(n, Y, x). To finish the proof, it remains to show that αY ◦ βY = id. By funext, it suffices to show that 31 for any x : FMY , we have αY (βY (x)) = x. Using funext for cofibrant exo-types, it is enough to show that for any m : N e , we have (βY (x)) (r(m)) = vY (x) (m). (2.4) Indeed, if we have this equality, then by funext for cofibrant exo-types (used at the second equality), we get αY (βY (x)) = uY (βY (x) ◦ e r) = uY (vY (x)) = x. We will prove the identity (2.4) by induction on m : N e . For m = 0 e , we get βY (x)(r(0 e )) = βY (x)(0) = S(0, Y, x) = vY (x)(0). For m = succe m′ , we get by induction βY ′(x ′ )(r(m′ )) = vY ′(x ′ )(m′ ). Using this, we obtain βY (x)(r(m)) = βY (x)(succ(r(m′ ))) = S(succ(r(m′ )), Y, x) = S(r(m′ ), Y ′ , x′ ) = βY ′(x ′ )(r(m′ )) = vY ′(x ′ )(m′ ) = vY ′(uY ′(λa. vY (x) (succe (a)))) (m′ ) = (λa. vY (x) (succe (a))) (m′ ) = vY (x) (m) 32 2.6 Lifting cofibrancy from exo-nat to other types In this section, we give a new result about other inductive types. Using cofibrant exo-nat, we will show that some other inductive types preserve cofibrancy. 2.6.1 List exo-types Definition 2.6.1. For an exo-type A : Ue we define the exo-type Liste (A) : Ue of finite exo-lists of terms of A, which has constructors • []e : Liste (A) • ::e : A → Liste (A) → Liste (A) Similarly, if A : U is a type, the type List(A) of finite lists of A has constructors [] and :: . As in Theorem 2.2.3, we have an obvious map f : Liste (A) → List(A) for a type A defined as f([]e ) := [] and f(a ::e l) := a :: f(l). We will give some conditions for cofibrancy and sharpness of Liste (A). Indeed, if we assume N e and A are cofibrant, then we can show Liste (A) is cofibrant. The proof is obtained by an isomorphism between a cofibrant exo-type and Liste (A). If A is also sharp, the same isomorphism gives that Liste (A) is sharp. Moreover, we can show sharpness of Liste (A) in a way analogous to Proposition 2.5.4(vi). Lemma 2.6.2. Let A : Ue be an exo-type. Then we have X n:Ne e A n ! ∼= Liste (A) where A0 e := 1 e and A(succe n) := A ×e An . Proof. Define ϕ : (Pe n:Ne An ) → Liste (A) as follows ϕ(0 e , ⋆e ) := []e ϕ(succe (n),(a, p)) := a ::e ϕ(n, p). 33 Define θ : Liste (A) → ( Pe n:Ne An ) as follows, θ([]e ) := (0 e , ⋆e ) θ(a ::e l) := (succe (π e 1 θ(l)),(a, πe 2 θ(l)) ). Then it is easy to show by the induction on the constructors that ϕ ◦ e θ = e idListe (A) and θ ◦ e ϕ = e idPe n:Ne An . Proposition 2.6.3. If A : Ue is cofibrant and N e is cofibrant, then so is Liste (A). Proof. By Lemma 2.6.2 and Proposition 2.4.3(ii), it is enough to show that Pe n:Ne An is cofibrant. By the assumption and 2.4.3(iii), we have An is a cofibrant exo-type for all n : N e . Since we also assume N e is cofibrant, we are done by 2.4.3(iv). By a similar reasoning, we obtain that Liste (A) is sharp if A is sharp and N e is cofibrant. However, we can also show the sharpness of Liste (A) like in Proposition 2.5.4(vi). Proposition 2.6.4. Let A : Ue be a sharp exo-type. Suppose also that N e is cofibrant. Then Liste (A) is sharp. Proof. Since A is sharp, it is cofibrant. By Proposition 2.6.3, we have Liste (A) is cofibrant, so it remains to find the fibrant replacement of it. Since A is sharp, we have a type RA : U and a map rA : A → RA such that the map 2.2 is a fibrant-equivalence for any Y : RA → U. We claim that List(RA) is a fibrant replacement of Liste (A). Define r : Liste (A) → List(RA) as r([]e ) := [] r(a ::e l) := rA(a):: r(l) 34 Consider the following commutative diagram for any Y : List(RA) → U Q t:List(RA) Y (t) Qe s:Liste (A) Y (r(s)) ∼= Q t:List(RA) Y (t) FMY (− ◦e r) uY αY :=uY ◦ e (− ◦e r) vY The type FMY and the isomorphism uY are obtained by the cofibrancy of Liste (A). We want to show that αY is an equivalence. First, we define an auxiliary type S : Y t:List(RA) Y Y :List(RA)→U Y x:FMY Y (t) ! by S([], Y, x) := vY (x)([]e ) and S(c :: l, Y, x) := S(l, Y ′ , x′ ) where Y ′ (l) := Y (c :: l), x ′ := uY ′(T) for a T : Qe s:Liste (A) Y ′ (r(s)) defined as follows. For s : Liste (A), consider the following diagram Q c:RA Y (c :: r(s)) Qe a:A Y (rA(a):: r(s)) ∼= Q c:RA Y (c :: r(s)) ≃ FM (− ◦e rA) u α β v The equivalence α is obtained by the sharpness of A. Now we define T(s) := β(u(λ a.vY (x)(a ::e s))) (c) : Y (c :: r(s)) = Y ′ (r(s)). 35 We also claim that for any s : Liste (A), Y : List(RA) → U, and x : FMY we have S(r(s), Y, x) = vY (x)(s). (2.5) It follows by induction on Liste (A). If s = []e , the refl term satisfies the identity 2.5. If s = b ::e s ′ for s ′ : Liste (A), then we have the following chain of identities. S(r(b ::e s ′ ), Y, x) = S(rA(b):: r(s ′ ), Y, x) = S(r(s ′ ), Y ′ , x′ ) = vY ′(uY ′(T))(s ′ ) = T(s ′ ) = β(u(λ a.vY (x)(a ::e s ′ ))) (rA(b)) = (λ a.vY (x)(a ::e s ′ )) (b) = vY (x)(b ::e s ′ ) These are obtained by, respectively, the definition of r, the definition of S, the induction hypothesis, the fact that v ′ Y is the inverse of u ′ Y , the definition of T, the fact that β is the inverse of α = u ◦ e (− ◦e r), and the definition of the given function. Note that when we have exo-equalities of terms in types, we can use eqtoid to make them identities. Now, define βY : FMY → Q t:List(RA) Y (s) as βY (x)(t) := S(t, Y, x). Then we obtain αY (βY (x)) = uY (βY (x) ◦ e r) = uY (vY (x)) = x. These are obtained by, respectively, the definition of αY , the fact that βY (x) ◦ e r = vY (x) since we can use funext for cofibrant exo-types and Equation 2.5, and the fact that vY is the inverse of uY . 36 This proves that αY has a section for any Y : List(RA) → U. By Lemma 2.5.3, we conclude that Liste (A) is sharp. 2.6.2 Exo-type of binary trees Definition 2.6.5. For exo-type N, L : Ue we define the exo-type BinTreee (N, L) : Ue of binary exo-trees with node values of exo-type N and leaf values of exo-type L, which has constructors • leafe : L → BinTreee (N, L) • nodee : BinTreee (N, L) → N → BinTreee (N, L) → BinTreee (N, L) Similarly, if N, L : U is a type, the type BinTree(N, L) of binary trees with node values of type N and leaf values of type L constructors leaf and node. We also have a definition for unlabeled binary (exo)trees. Definition 2.6.6. The exo-type UnLBinTreee : Ue of unlabeled binary exo-trees is constructed by • u-leafe : UnLBinTreee • u-nodee : UnLBinTreee → UnLBinTreee → UnLBinTreee Similarly, the type UnLBinTree : U of unlabeled binary trees is constructed by u-leaf and u-node. It is easy to see that if we take N = L = 1 e , then BinTreee (N, L) is isomorphic to UnLBinTreee . However, we have a more general relation between them. For any N, L : Ue , we can show BinTreee (N, L) ∼= Xe t:UnLBinTreee N # of nodes of t × e L # of leaves of t . (2.6) Thanks to this isomorphism we can determine the cofibrancy or the sharpness of BinTreee (N, L) 3 using the cofibrancy or the sharpness of UnLBinTreee . Indeed, we will show that if N e is cofibrant, then UnLBinTreee is not only cofibrant but also sharp. Since any finite product of cofibrant (sharp) exo-types is cofibrant (sharp), we can use isomorphism 2.6 to show BinTreee (N, L) is cofibrant (sharp) under some conditions. Thus, the main goal is to get cofibrant (sharp) UnLBinTreee . We will construct another type which is easily shown to be cofibrant (sharp) to achieve this goal. Let Parens : Ue be the exo-type of parentheses constructed by popen : Parens and pclose : Parens. In other words, it is an exo-type with two terms. Define an exo-type family isbalanced : Liste (Parens) → N e → U e where isbalanced(l, n) := 1 e if the list of parentheses l needs n many opening parentheses to be a balanced parenthesization, and isbalanced(l, n) := 0 e otherwise. For example, we have isbalanced(popen ::e pclose ::e []e , 0 e ) = 1 e isbalanced(popen ::e pclose ::e pclose ::e []e ,succe (0 e )) = 1 e isbalanced(popen ::e pclose ::e popen ::e []e ,succe (0 e )) = 0 e . In other words, the first says that “()” is a balanced parenthesization, the second says that “())” needs one opening parenthesis, the third says that “()(” is not balanced if we add one more opening parenthesis. Since 0 e and 1 e are cofibrant (also sharp), we get isbalanced(l, n) is cofibrant (sharp) for any l : Liste (Parens) and n : N e . Finally, for any n : N e define Balanced(n) := Xe l:Liste (Parens) isbalanced(l, n). Lemma 2.6.7. If N e is cofibrant, then for any n : N e , the exo-type Balanced(n) is both 38 cofibrant and sharp. Proof. By definition, Parens is a finite exo-type. Therefore, it is both cofibrant (Proposition 2.4.3(iii)) and sharp (Proposition 2.5.4(v)). Since we assumed N e is cofibrant, Proposition 2.6.3 shows that Liste (Parens) is cofibrant, and Proposition 2.6.4 shows that Liste (Parens) is sharp. Since isbalanced(l, n) is both cofibrant and sharp for any l : Liste (Parens) and n : N e , the exotype Balanced(n) is cofibrant by Proposition 2.4.3(iv) and sharp by Proposition 2.5.4(iv). The exo-type that we use to show UnLBinTreee is both cofibrant and sharp, is Balanced(0 e ). The following result will be analogous to the combinatorial result that there is a one-to-one correspondence between full binary trees and balanced parenthesizations [11]. Proposition 2.6.8. There is an isomorphism UnLBinTreee ∼= Balanced(0 e ). Proof. We will define the map and explain the construction. For the proof that it is an isomorphism, we refer to its formalization in our library. Define first ϕ : UnLBinTreee → (n : N e ) → Balanced(n) → Balanced(n) as follows: ϕ(u-leafe , n, b) := b ϕ(u-nodee (t1, t2), n, b) := ϕ(t2, n, b′ ) where b ′ := (popen ::e (π1(ϕ (t1, succe (n), (pclose ::e π1(b), π2(b))))) , π2(ϕ (t1, succe (n), (pclose ::e π1(b), π2(b))))). 39 Using this, the main map Φ : UnLBinTreee → Balanced(0 e ) is defined as Φ(t) := ϕ(t, 0 e ,([]e , ⋆e )). The construction basically maps each tree to a balanced parenthesization in the following way. A leaf is represented by the empty list of parentheses. If trees t1 and t2 have representations l1 and l2, then the tree u-nodee (t1, t2) is represented by the list l2 (l1 ). Figure 2.3 provides some examples of this conversion. The inverse of Φ is defined exactly to reverse this process, but it needs some auxiliary definitions. One can see the formalization [21] for the details. This isomorphism provides the results we wanted. Corollary 2.6.9. If N e is cofibrant, then UnLBinTreee is both cofibrant and sharp. Proof. It follows from Lemma 2.6.7 and Proposition 2.6.8. Corollary 2.6.10. If N e is cofibrant, and N, L : Ue are cofibrant (sharp) exo-types, then BinTreee (N, L) is cofibrant (sharp). Proof. It follows from the isomorphism 2.6 and Corollary 2.6.9. 40 • () • • • ()() • • • • • (()()) • • • • • • • ()(()()) • • • • • • • • Figure 2.3: Examples of the conversion between binary trees and parenthesizations. 41 Chapter 3 Two-level type theory - semantics In this chapter, we will examine the semantic aspect of the theory discussed in the previous chapters. In order for the axiom we accept about natural numbers to have meaning, we will investigate its models, preferably a large number of them. To do this, we will first provide the necessary background information about the models of the two-level type theory, and then introduce the additional conditions required for the fulfillment of the aforementioned axiom. Notational conventions During this chapter, we follow the conventions below. Variables. Γ, ∆, . . . stand for contexts, σ, θ, τ , . . . for context morphisms, P, Q, R, . . . for presheaves, A, B, C, Y , . . . for types and type families, and a, b, c, . . . for terms. Substitution. Whenever P : C op → Set is a presheaf, σ : ∆ → Γ a morphism, and A : P(Γ), we write A[σ] instead of P(σ)(A). Equality signs. Recall 2LTT has two different equality signs: “=e” and “=”. Now, another equality comes forward, that is the equality in meta-theory. We reserve “=” for the meta42 theory’s equality, and use “Id” for the identity type, “Eq” for the exo-equality. 3.1 Category with families Definition 3.1.1. A category with families (CwF) consists of the following: • A category C with a terminal object 1C : C. Its objects are called contexts, and 1C is called the empty context. • A presheaf Ty : C op → Set. If A : Ty(Γ), then we say A is a type over Γ. • A presheaf Tm : (R Ty) op → Set. If a : Tm(Γ, A), then we say a is a term of A. • For any Γ : C and A : Ty(Γ), there is an object Γ.A : C, a morphism pA : Γ.A → Γ, and a term qA : Tm(Γ.A, A[pA]) with the universal property: for any object ∆ : C, a morphism σ : ∆ → Γ, and a term a : Tm(∆, A[σ]), there is a unique morphism θ : ∆ → Γ.A such that pA ◦ θ = σ and qA[θ] = a. This operation is called the context extension. Note that for all contexts Γ : C and types A : Ty(Γ), there is a natural isomorphism Tm(Γ, A) ∼= C/Γ((Γ, idΓ),(Γ.A, pA)). Indeed, this follows from the universal property of the context extension by taking ∆ := Γ and σ := idΓ. This observation says that the terms of A over Γ can be regarded as the sections of pA : Γ.A → Γ. The proposition below is a useful fact for the rest of the chapter. Proposition 3.1.2. Let σ : ∆ → Γ be a context morphism and A : Ty(Γ). There exists a morphism σ + : ∆.A[σ] → Γ.A that makes the following diagram into a pullback square: 43 ∆.A[σ] Γ.A ∆ Γ σ + pA[σ] pA σ . Proof. The existence of a morphism σ + follows from the universal property for the extension Γ.A, using the morphism σ ◦ pA[σ] : ∆.A[σ] → Γ. Consider another commutative diagram of the form Θ ∆.A[σ] Γ.A ∆ Γ η τ σ + pA[σ] pA σ . Universal property for the extension ∆.A[σ] gives a unique morphism θ : Θ → ∆.A[σ] such that pA[σ] ◦ θ = τ . Since we have both pA ◦ η = σ ◦ τ and pA ◦ σ + ◦ θ = σ ◦ pA[σ] ◦ θ = σ ◦ τ, by the universal property for the extension Γ.A, we have σ + ◦ θ = η. Rather than presenting a specific instance of a CwF, we will offer a more extensive range of CwF examples in the subsequent section. 44 3.1.1 Presheaf CwFs The category of presheaves is a archetypal example of a CwF [13]. Let C be a (small) category, and Cb be its category of presheaves. The CwF structure on Cb, denoted by (Tyc, Tmc) is defined in the following manner: • Contexts are presheaves C op → Set. • The constant presheaf that takes the value ⋆ in the category of sets, can be characterized as the terminal object 1Cb. • Recall that Tyc is a presheaf on Cb. If P : Cb, then Tyc(P) is the underlying set of the category of presheaves RdP over the category of elements R P. In other words, a type A : Tyc(P) is a functor R P op → Set. If ϕ : Q → P is a morphism in Cb and A : Tyc(P), we define the type substitution A[ϕ] : Tyc(Q) as A[ϕ](Γ, x) := A(Γ, ϕΓ(x)) where x : QΓ. • Recall that Tmc is a presheaf on R Tyc. For P : Cb and A : Tyc(P), we define Tmc(P, A) := ( a : Y Γ:C, x:PΓ A(Γ, x) | if σ : ∆ → Γ, x : PΓ, then a(Γ, x)[σ] = a(∆, x[σ])) . If ϕ : Q → P is a morphism in Cb, A : Tyc(P), and a : Tmc(P, A), we define the term substitution a[ϕ] : Tmc(Q, A[ϕ]) as a[ϕ](Γ, x) := a(Γ, ϕΓ(x)) 4 where x : QΓ. • For P : Cb and A : Tyc(P), the context P.A is again a presheaf over C defined by P.A(Γ) := a x:P(Γ) A(Γ, x). If σ : ∆ → Γ is a morphism in C and (x, a) : P.A(Γ), then we define (x, a)[σ] = P.A(σ)(x, a) := (x[σ], a[σ]). The morphism pA : P.A → P is defined by the first projection. In other words, for Γ : C and (x, a) : P.A(Γ), we have (pA)Γ(x, a) = x. The term qA : Tmc(P.A, A[pA]) is given by the second projection. In other words, for Γ : C and (x, a) : P.A(Γ), we have qA(Γ,(x, a)) = a. Note that A[pA](Γ,(x, a)) = A(Γ, pA(x, a)) = A(Γ, x). It remains to verify the universal property for the context extension. Let Q : Cb, τ : Q → P, and b : Tmc(Q, A[τ ]). Define θ : Q → P.A as follows: for Γ : C and x : QΓ, we have θΓ(x) := (τΓ(x), b(Γ, x)). It is straightforward to verify the defining rules: pA ◦ θ = τ because (pA ◦ θ)Γ(x) = pA(τΓ(x), b(Γ, x)) = τΓ(x), and qA[θ] = b because qA[θ](Γ, x) = qA(Γ, θΓ(x)) = qA(Γ,(τΓ(x), b(Γ, x))) = b(Γ, x). Since the defining properties of pA and qA determines the map θ, it is uniquely deter46 mined. Therefore (Cb, Tyc, Tmc) satisfies the conditions in Definition 3.1.1. Simplicial set CwF Let C = △ be the simplex category. The presheaf category △b is called the category of simplicial sets, denoted by SSet. Like any other presheaf category, SSet has a CwF structure (Tyc, Tmc), but it has another CwF structure. We only define a new type presheaf Ty : SSetop → Set as follows: Ty(P) is a subset of Tyc(P) such that A : Ty(P) if the display map P.A → P is a Kan fibration. With the induced term presheaf Tm obtained by Tmc, we obtain a CwF (SSet, Ty, Tm). It is easy to prove this structure satisfies all axioms of being a CwF [10]. We always refer this new CwF structure on SSet unless stated otherwise. SSet is not a unique example of a presheaf category having two CwF structures. There are many of them, and they will be useful to talk about two-level structures in the later sections. 3.1.2 Type formers in CwFs The objective of this section is to establish the meanings of particular type formers within a CwF, and to examine the requirements that must be fulfilled for the CwF to possess these type formers. Although this analysis could be applied to various standard type formers, our focus will be solely on those indispensable for the subsequent sections. Dependent function types We say that a CwF (C, Ty, Tm) supports Π-types [13] if • for any two types A : Ty(Γ) and B : Ty(Γ.A), there is a type Π(A, B) : Ty(Γ), • for each b : Tm(Γ.A, B), there is a term λ(b) : Tm(Γ, Π(A, B)), and • for each f : Tm(Γ, Π(A, B)) and a : Tm(Γ, A), there is a term app(f, a) : Tm(Γ, B[a]) 47 such that the following equations (with appropriate quantifiers) hold: app(λ(b), a) = b[a] λ(app(f, a), qA) = f Π(A, B)[τ ] = Π(A[τ ], B[τ +]) λ(b)[τ ] = λ(b[τ ]) app(f, a)[τ ] = app(f[τ ], a[τ ]). Note that using dependent function types, one can define simple function types. Indeed, if A, B : Ty(Γ), then the type of functions from A to B over Γ, denoted by BA : Ty(Γ) is defined via Π(A, B[pA]). We will show that a presheaf CwF supports Π-types. Proposition 3.1.3. For any (small) category C, the presheaf Cwf (Cb, Tyc, Tmc) supports Πtypes. Proof. Let A : Tyc(P) and B : Tyc(P.A). First, we need to define Π(A, B) : Tyc(P). Recall that Π(A, B) should be a presheaf over R P. For each Γ : C and x : PΓ, the type Π(A, B)(Γ, x) consists of the elements f in the categorical product f : Y ∆:C, σ:∆→Γ, a:A(∆,x[σ]) B(∆,(x[σ], a)) such that if Θ : C and τ : Θ → ∆, then f(∆, σ, a)[τ ] = f(Θ, σ ◦ τ, a[τ ]). (3.1) If τ : (Υ, y) → (Γ, x) is a morphism in R P, namely, τ : Υ → Γ is a morphism in C such that x[τ ] = y, for each f : Π(A, B)(Γ, x), ∆ : C, σ : ∆ → Υ, and a : A(∆, y[σ]), we define 48 f[τ ](∆, σ, a) := f(∆, τ ◦ σ, a). Using the compatibility condition 3.1, we indeed obtain a presheaf Π(A, B) on R P. Second, for each b : Tmc(P.A, B), we need to define a term λ(b) : Tmc(P, Π(A, B)). Recall that λ(b) should be an element in Y Γ:C,x:PΓ Π(A, B)(Γ, x). Now, for Γ : C, x : PΓ, ∆ : C, σ : ∆ → Γ, and a : A(∆, x[σ]) we define λ(b)(Γ, x)(∆, σ, a) := b(∆, x[σ], a). This definition makes sense because the term b is in Q Γ:C,z:P.AΓ B(Γ, z). Third, for each f : Tmc(P, Π(A, B)) and a : Tmc(P, A), we need to define a term app(f, a) : Tmc(P, B[a]). Recall that it should be in Y Γ:C,x:PΓ B[a](Γ, x). Now, for Γ : C, x : PΓ, we define app(f, a)(Γ, x) := f(Γ, x)(Γ, id, a). It is easy but straightforward to prove coherence rules [13]. Dependent pair types We say that a CwF (C, Ty, Tm) supports Σ-types [13] if • for any two types A : Ty(Γ) and B : Ty(Γ.A), there is a type Σ(A, B) : Ty(Γ), • for each a : Tm(Γ, A) and b : Tm(Γ, B[a]), there is a term ⟨a, b⟩ : Tm(Γ, Σ(A, B)), and • for each z : Tm(Γ, Σ(A, B)), there are terms π1(z) : Tm(Γ, A) and π2(z) : Tm(Γ, B[π1(z)]) 49 such that the following equations (with appropriate quantifiers) hold: π1(⟨a, b⟩) = a π2(⟨a, b⟩) = b ⟨π1(z), π2(z)⟩ = z Σ(A, B)[τ ] = Σ(A[τ ], B[τ +]) ⟨a, b⟩[τ ] = ⟨a[τ ], b[τ ]⟩ π1(z)[τ ] = π1(z[τ ]) π2(z)[τ ] = π2(z[τ ]). We will show that a presheaf CwF supports Σ-types. Proposition 3.1.4. For any (small) category C, the presheaf Cwf (Cb, Tyc, Tmc) supports Σtypes. Proof. Let A : Tyc(P) and B : Tyc(P.A). First, we need to define Σ(A, B) : Tyc(P). Recall that Σ(A, B) should be a presheaf over R P. For each Γ : C and x : PΓ, we define Σ(A, B)(Γ, x) := {(a, b)| a : A(Γ, x), b : B(Γ,(x, a))}. For a morphism σ : (∆, y) → (Γ, x) in R P and (a, b) : Σ(A, B)(Γ, x), we define (a, b)[σ] := (a[σ], b[σ]). One can define the operations ⟨ , ⟩, π1, and π2 in an obvious way, and it is easy to prove the coherence rules. 50 Extensional identity type We say that a CwF (C, Ty, Tm) supports extensional identity types [13] if • for any type A : Ty(Γ), there is a type EqA : Ty(Γ.A.A[pA]), • a morphism refle A : Γ.A → Γ.A.A[pA]. EqA such that pEqA ◦ refle A equals the diagonal morphism Γ.A → Γ.A.A[pA], and • for each B : Ty(Γ.A.A[pA]. EqA), a function J e : Tm(Γ.A, B[refle A]) → Tm(Γ.A.A[pA]. EqA, B) such that these data are stable under substitution with respect to context morphisms, and such that • if h : Tm(Γ.A, B[refle A]), then J e (h)[refle A] = h, and • if h : Tm(Γ.A.A[pA]. EqA, B), then J e (h[refle A]) = h. The last equality can be thought of as a η rule. And this rule holds if and only if refle A is an isomorphism with the inverse pA[pA] ◦ pEqA . We will show that a presheaf CwF supports extensional identity types. Proposition 3.1.5. For any (small) category C, the presheaf Cwf (Cb, Tyc, Tmc) supports extensional identity types. Proof. Let A : Tyc(P). Recall that EqA should be a presheaf over R Γ.A.A[pA]. For each Γ : C, x : PΓ, and a, b : A(Γ, x), we define EqA(Γ, x, a, b) := {⋆} if a = b ∅ if a ̸= b . 51 The morphism refle A : P.A → P.A.A[pA]. EqA is defined for each Γ : C as (x, a) 7→ (x, a, a, ⋆). Since pEq : P.A.A[pA]. EqA → P.A.A[pA] is the first projection, we indeed have pEq ◦ refle A is the diagonal map. If B : Tyc(P.A.A[pA]. EqA), the function J e : Tmc(P.A, B[refle A]) → Tmc(P.A.A[pA]. EqA, B) is defined as follows: If α : Tmc(P.A, B[refle A]), this means we have α : Y Γ:C (x,a):P.AΓ B(Γ,(x, a, a, ⋆)) and J e (α) : Y Γ:C (x,a,b,p):P.A.A[pA]. EqΓ B(Γ,(x, a, b, p)). Thus, we define J e (α)(Γ,(x, a, b, p)) := α(Γ,(x, a)) which makes sense because p : Eq(a, b) means a = b and p = ⋆. Now, it is easy to prove the coherence rules. Intensional identity type We say that a CwF (C, Ty, Tm) supports intensional identity types [13] if • for any type A : Ty(Γ), there is a type IdA : Ty(Γ.A.A[pA]), • a morphism reflA : Γ.A → Γ.A.A[pA]. IdA such that pIdA ◦ reflA equals the diagonal morphism Γ.A → Γ.A.A[pA], and • for each B : Ty(Γ.A.A[pA]. IdA), a function J : Tm(Γ.A, B[reflA]) → Tm(Γ.A.A[pA]. IdA, B) such that these data are stable under substitution with respect to context morphisms, and such that if h : Tm(Γ.A, B[reflA]), then J(h)[reflA] = h. The last equality can be thought of as a β rule. Since the intensional identity type former, Id, is a particular case of Eq, we can say that every presheaf CwF supports intensional identity types. If we also assume Univalence for 52 intensional identities, it is not true in general that every presheaf CwF supports such an identity. For example, the presheaf CwF on Set supports the identity type and the uniqueness of identity proof (UIP), but UIP contradicts with univalence [20]. Nonetheless, it has been established that the simplicial set CwF, denoted as SSet, does provide support for univalent identity types [15]. Indeed, this category stands as one of the widely recognized models not only for Martin-L¨of Type Theory but also for Homotopy Type Theory. In the case of intensional identity types, we can also establish a definition for what constitutes a “contractible” type. This notion serves as a crucial component in the overall definition of cofibrancy. Definition 3.1.6. Let A : Ty(Γ) be a type. We call A a contractible type if there is a term in the following type over Γ: isContr(A) := Σ(A, Π(A[pA], IdA)). Having such a term means that there is a term c : Tm(Γ, A) called center of contraction, such that for any term a : Tm(Γ.A, A[pA]) there is a term p : Tm(Γ, IdA[c +, a+]). In other words, we have a section map c : Γ → Γ.A to pA such that the following diagram, where h is the contracting homotopy, commutes: Γ.A Γ.A.A[pA]. IdA Γ.A.A[pA] c + h pIdA . Natural number type We say that a CwF (C, Ty, Tm) supports a natural number type if • there is a type N : Ty(1C) where 1C is the terminal object of C, • there is a term 0 : Tm(1C, N) which can be thought as a context morphism 1C → 1C.N, 53 • there is a morphism succ : Tm(1C, N) → Tm(1C, N) which can be thought as a context morphism 1C.N → 1C.N, and • for each Γ : C, the unique morphism σ : Γ → 1C, and B : Ty(Γ.N[σ]) with two context morphisms b0 : Γ → Γ.N[σ].B and bs : Γ.N → Γ.N[σ].B → Γ.N[σ].B, there is a morphism J N B : Γ.N[σ] → Γ.N[σ].B such that J N B ◦ 0[σ] = b0 and J N B ◦ succ[σ](α) = bs(α, JN B(α)), and these data are stable under substitution with respect to context morphisms. The last morphism can be thought of as a usual induction rule on N. Proposition 3.1.7. For any (small) category C, the presheaf Cwf (Cb, Tyc, Tmc) supports a natural number type. Proof. Since N should be a presheaf over R 1Cb, for each Γ : C and x : (1Cb)Γ we define N(Γ, x) := N, the external set of natural numbers. The term 0 : Tmc(1Cb, N) is obtained by the morphism 1Cb → 1Cb.N which we define 0Γ(x) := (x, 0) for any Γ : C and x : (1Cb)Γ. The morphism succ : 1Cb.N → 1Cb.N is defined as succΓ(x, k) := (x, k + 1) for any Γ : C and (x, k) : (1Cb.N)Γ. For any P : Cb and σ : P → 1Cb, if B : Tyc(P.N[σ]) with b0 and bs, the function J N B : P.N[σ] → P.N[σ].B is defined as, for each Γ : C, and (x, k) : (P.N[σ])Γ (J N B)Γ(x, k) := b0(x) if k = 0 bs (x, k′ ), (J N B)Γ(x, k′ ) if k = k ′ + 1 . Clearly, J N B ◦ 0[σ] = b0 holds. For the other equality, we have (J N B ◦ succ[σ])Γ(x, k) = (J N B)Γ(x, k + 1) = (bs)Γ (x, k), (J N B)Γ(x, k) . Also, it is easy to prove the the remaining coherence rules. We can talk about the unit type, the empty type, coproducts, and others, and give the conditions for a CwF to supports them. In general, if we have a collection T of type formers, we say a CwF supports T if the CwF supports each type formers in T. Example 3.1.8. Let T := { Q , P, 1, 0, N, Eq}. Then for any (small) category C, the presheaf CwF (Cb, Tyc, Tmc) supports T. 1 3.1.3 CwFs as a model Based on the example of presheaf CwF we discussed earlier, it becomes clear that CwFs can be used to model dependent type theory. A CwF provides a structure that covers contexts, types, terms, and substitutions. Moreover, if a CwF has enough type formers, it allows us to work with dependent products, dependent sums, and other inductive types. A reader who is interested in delving into the details and exploring similar constructions related to CwFs can refer to [10]. Our primary focus here is to establish the necessary background to discuss models where exo-nat is cofibrant. Definition 3.1.9. [3] A model of Martin-L¨of type theory with type formers T is a CwF that supports T. We already know that a presheaf CwF is a model of Martin-L¨of type theory with usual type formers and extensional identity types. The simplicial set CwF, SSet, is a model of Martin-L¨of type theory with usual type formers and intensional identity types. 3.2 Two-level CwFs Let us recall that the aim of this study on semantics is to gain insight into the models of 2LTT with a cofibrant exo-nat. Once we have acquired models of various type theories, a natural 1We’ve not given the proofs for 1 and 0, but these are trivial facts. 55 question arises: can we merge these models to obtain a comprehensive model of 2LTT? The answer to this question is affirmative, as it is indeed possible to combine two CwF structures on the same category in a manner that ensures their compatibility and coherence. Definition 3.2.1. [10] A two-level CwF is a CwF (C, Ty, Tm), equipped with another type presheaf Tyf : C op → Set, and a natural transformation c : Tyf → Ty. Remark 3.2.2. Given a two-level Cwf C, we define a second CwF structure on C using Tyf as the type functor, and the term functor is obtained as Tmf (Γ, A) := Tm(Γ,cΓ(A)). The context extension holds from Γ.A := Γ.cΓ(A). In order to emphasize the difference, we use the superscripts e , f and write Tye , Tme for the original CwF structure, write Tyf , Tmf for the one obtained by the coercion transformation. It is not surprising that this choice is intentional to be consistent with the first chapter. The original CwF will model the “exo” level of 2LTT while the other model the usual “HoTT” level of 2LTT. Example 3.2.3. Recall Tyc denotes the presheaf CwF structure. The simplicial set presheaf SSet originally had a presheaf CwF structure. Recall that Ty(P) := {A : Tyc(P) | pA : P.A → P is a Kan fibration} gives another type functor. Taking Tyf = Ty and c : Tyf → Tyc as the inclusion, we obtain SSet as a two-level Cwf. In a similar vein to how we can build a presheaf CwF from any arbitrary (small) category, when the category itself is a CwF, we can proceed to construct a two-level CwF. This particular construction, which we refer to as the presheaf two-level CwF, will serve as our primary focus and model of interest. Definition 3.2.4. Let C be a (small) category with CwF structure Ty, Tm. There is a two-level CwF structure on Cb called presheaf two-level CwF, denoted by (Cb, Tyc, Tmc, Tyf , Tmf ) defined as follows: 56 • (Cb, Tyc, Tmc) is the presheaf CwF defined in Section 3.1.1, • given P in Cb, the type functor Tyf is given by Tyf (P) := Cb(P, Ty), and • for Γ in C and B in P(Γ), we define cP (A)(Γ, B) := Tm(Γ, AΓ(B)). As before, given A in Tyf (P), we define Tmf (P, A) := Tmc(P,cP (A)). 3.2.1 Two-level CwFs as a model Similar to how a type theory can be interpreted within the framework of a category with families, two-level type theories can be interpreted using two-level category with families. Below, we provide the precise definition for such interpretation. Definition 3.2.5. A two-level model of a type theory with type formers T f and exo-type formers T e is a two-level CwF on a category C such that • the structure Tyf , Tmf is a model of type theory with T f , • the structure Tye , Tme is a model of type theory with T e . Remark 3.2.6. In the subsequent sections, when we say a two-level model with enough type formers or a model of 2LTT, we mean the two-level model with T f and T e where the collections are the types and exo-types we defined in Section 2.1. Our only assumption concerning the coercion morphism Tyf → Tye is that it is a natural transformation. However, in the context of a two-level model with enough type formers, we have the semantic counterpart of Theorem 2.2.3. This theorem furnishes nice inversion rules from types to exo-types, and its proof heavily relies on the preservation of context extension and the elimination rules associated with the type formers [3]. With the foundational knowledge established thus far, we are now equipped to delve into the discussion of potential models of 2LTT that satisfy the condition of having a cofibrant exo-nat. However, before proceeding to the subsequent section, where this discussion takes 57 place, let us first provide the semantic definition of “cofibrancy” for an exo-type. Definition 3.2.7. Let (C, Tye , Tme , Tyf , Tmf ) be a model of 2LTT with conversion c : Tyf → Tye . We say an exo-type A : Tye (Γ) is cofibrant if for any ∆ : C and σ : ∆ → Γ 1. there is a map, natural in ∆, Θ Ty ∆ : Tyf (∆.A[σ]) → Tyf (∆) such that for any Y : Tyf (∆.A[σ]) we have the following isomorphism natural in ∆; c∆(ΘTy ∆ (Y )) ∼= Ye (A,c∆.A[σ](Y )), 2. and there is a map, natural in ∆, Θ Tm ∆ : Tmf (∆.A[σ], isContr(Y )) → Tmf ∆, isContr(ΘTy ∆ (Y )) . In other words, if Y is contractible, then so is ΘTy Γ (Y ). Remark 3.2.8. This does not represent a direct translation of the internal definition; rather, it can be seen as a universe-free adaptation of it. In Definition 2.4.1, the quantification is over specific types within a particular universe. Externally, we can express it in terms of all types. Consequently, the external version holds slightly more strength. The naturality conditions gives the following: In Figure 3.1, all vertical arrows are context substitutions. When the commutative sides are appropriately composed, the top and bottom isomorphisms are equal, which can be expressed as the cube “commuting”. In Figure 3.2, the vertical arrows are context substitutions, and the square is commutative. 5 Tyf (∆.A[σ]) Tyf (∆) Tye (∆.A[σ]) Tye (∆) Tyf (Υ.A[σ ◦ τ ]) Tyf (Υ) Tye (Υ.A[σ ◦ τ ]) Tye (Υ) Θ Ty ∆ c∆.A[σ] c∆ Qe (A[σ], ) Θ Ty Υ cΥ.A[σ◦τ] cΥ Qe (A[σ◦τ], ) Figure 3.1: Naturality condition for ΘTy, where σ : ∆ → Γ and τ : Υ → ∆ in C. Tmf (∆.A[σ], isContr(Y )) Tmf ∆, isContr(ΘTy ∆ (Y )) Tmf (Υ.A[σ ◦ τ ], isContr(Y [τ ])) Tmf Υ, isContr(ΘTy Υ (Y [τ ])) ΘTm ∆ ΘTm Υ Figure 3.2: Naturality condition for ΘTm, where σ : ∆ → Γ and τ : Υ → ∆ in C. 3.3 Models with cofibrant exo-nat In the following definition, recall that all products exist in the category of sets. Definition 3.3.1. Let (C, Ty, Tm) be a CwF with enough type formers. We say C has exo-nat products if there is a map ΩΓ : Q N Ty(Γ) → Ty(Γ), where N is the external natural numbers, such that for any Y : Q N Ty(Γ) we have 1) the set Tm(Γ, ΩΓ(Y )) is isomorphic to the categorical product of the sets Tm(Γ, Ya) for each a : N, namely, we have Tmf (Γ, ΩΓ(Y )) ∼= Q a:N Tmf (Γ, Ya) ϕ ψ 2) if d, c : Q a:N Tm(Γ, Ya) are such that there is a term in the type Id(da, ca) as being terms of Ya : Ty(Γ), then there is a term in the type Id(ψ(d), ψ(c)) as being terms of ΩΓ(Y ), and all these are natural in Γ. In simpler terms, the first requirement stated in Definition 3.3.1 ensures that Qe a:Ne Y (a) has a fibrant match, while the second requirement ensures that the funext for cofibrant exo-types holds. Example 3.3.2. Let C be a good model category [16]. Define Ty(Γ) as the set of fibrations over Γ (with suitable coherence conditions [17]). Define for A : Ty(Γ) the set Tm(Γ, P) as the hom-set C/Γ[Γ, Γ.A]. Since Ty(Γ) is closed under countable products, we can take ΩΓ(Y ) := Q a:N Ya, and there is a clear bijection between C/Γ[Γ, ΩΓ(Y )] and Q a:N( C/Γ[Γ, Ya]), the first requirement in Definition 3.3.1 holds. Suppose d, c : Q a:N Tm(Γ, Ya) are such that there is a term in the type Id(da, ca) as being terms of Ya : Ty(Γ). In that model, it means da and ca, as being maps Γ → Ya, are right homotopic. That is, there are maps pa : Γ → Ya I such that the following diagram commutes: Ya I Γ Ya × Ya pa . Since Ya is fibrant (as being in the slice category) and Γ is cofibrant (as being an object of a good model category), by a standard lemma (Corollary 1.2.6 in [14]), we have da and ca are also left homotopic. Namely, the following diagram commutes: Γ + Γ Ya Γ ′ where Γ′ is a cylinder object for Γ fixed for all a : N. This induces a left homotopy between d and c, namely, we have: Γ + Γ Q a:N Ya Γ ′ . 60 Now by the same lemma, we have d and c are right homotopic, that is, we have p : Γ → ( Q a:N Ya) I such that the following diagram commutes: ( Q a:N Ya) I Γ Q a:N Ya × Q a:N Ya p . This means that there is a term in the type Id(d, c) as being terms of Q a:N Ya. So the second requirement in Definition 3.3.1 holds. We omit the details, but the naturality conditions follows from the coherence conditions on Ty. In Theorem 3.3.3, we provide a class of two-level CwFs that satisfy the axiom that N e is a cofibrant exo-type. This is the main result of this chapter. Theorem 3.3.3. If (C, Ty, Tm) is a CwF (with sufficient type formers) having exo-nat products, the corresponded two-level CwF obtained by Definition 3.2.4 satisfies the axiom that N e is a cofibrant exo-type. Proof. Recall that N e : Tyc(1Cb). For any P : Cb, the context morphism σ : P → 1Cb is unique, so we omit substitutions over such morphisms and write P.N e instead of P.N e [σ]. First, we define the map ΘTy P : Tyf (P.N e ) → Tyf (P). For any Y : Tyf (P.N e ) = Cb(P.N e , Ty), we need ΘTy P (Y ) : Tyf (P) = Cb(P, Ty). We denote ΘTy P (Y ) by Y˜ for easier reading. Now, for Γ : C and x : PΓ, we define Y˜ Γ(x) := ΩΓ ((YΓ(x, n))n) where the map ΩΓ : Q N Ty(Γ) → Ty(Γ) is obtained by the assumption of having exo-nat products, Definition 3.3.1. Since we have YΓ(x, n) : Ty(Γ), the definition makes sense. We want to show cP (Y˜ ) ∼= Ye (N e ,cP.Ne (Y )). Both are elements in Tyc(P), namely, presheaves over R P. Thus, it is enough to define a natural transformation G : cP (Y˜ ) → Qe (N e ,cP.Ne (Y )) such that for any Γ : C and x : PΓ, 61 the map GΓ,x : cP (Y˜ )(Γ, x) → Ye (N e ,cP.Ne (Y ))(Γ, x) is an isomorphism of sets, namely, a bijection. If we elaborate on these a little further, we obtain the following. By definition, cP (Y˜ )(Γ, x) = Tm(Γ, Y˜ Γ(x)). Also, Qe (N e ,cP.Ne (Y ))(Γ, x) consists of the elements f : Y ∆:C σ:∆→Γ n:Ne (∆,x[σ]) cP.Ne (Y )(∆, x[σ], n) = Tm(∆, Y∆(x[σ], n)) such that if Υ : C and τ : Υ → ∆, then f(∆, σ, n)[τ ] = f(Υ, σ ◦ τ, n[τ ]). By the definition of N e , we have N e (∆, x[σ]) = N, external natural number set, and having exo-nat products provides us Y n:N Tm(∆, Y∆(x[σ], n)) ∼= Tm(∆, Y˜ (x[σ])). Thus, the range of GΓ,x can be written as f : Y ∆:C σ:∆→Γ Tm(∆, Y˜∆(x[σ])) such that if Υ : C and τ : Υ → ∆, then f(∆, σ)[τ ] = f(Υ, σ ◦ τ ). This elaboration allows us to easily perceive that this function is a bijeciton because it is a standard application of the Yoneda Lemma. The naturality condition of this operation is also easily satisfied because the substitution is functorial. Thus, we have confirmed the first stage of our claim. It remains to handle the contractibility part. Basically, we need to show that for the center of contraction c : Tmf (P.N e , Y ) and the identity terms in Id(c, d) for any other terms d : Tmf (P.N e , Y ), we can find (naturally) a center of contraction ˜c : Tmf (P, Y˜ ) and an identity term Id(˜c, ˜d) for any other terms ˜d : Tmf (P, Y˜ ). With a similar elaboration on terms, we have Tmf (P.N e , Y ) = Tmc(P.N e ,cP.Ne (Y )) and Tmf (P, Y˜ ) = 62 Tmc(P,cP (Y˜ )). Therefore, we know c : Y Γ:C x:PΓ n:Ne (Γ,x) cP.Ne (Y )(Γ, x, n) = Tm(Γ, YΓ(x, n)) is a center of contraction, for any such term d, we have a term in Id(c, d), and we need c˜ : Y Γ:C x:PΓ cP (Y˜ )(Γ, x) = Tm(Γ, Y˜ Γ(x)) as a center of contraction, and related contracting terms. However, this is exactly the second criteria in Definition 3.3.1, and we have already assumed it. Therefore, N e is a cofibrant exo-type in the presheaf two-level CwF. Remark 3.3.4. Example 3.3.2 also enables us to construct a two-level CwF out of the class in the theorem, that satisfy the axiom. Indeed, we can take Tye (Γ) as the set of all morphisms over Γ, and Tme as the same as Tm, and obtain a two-level CwF (C, Tye , Tme , Ty, Tm) with the conversion c : Ty → Tye as being inclusion. It is then enough to take the map ΘΓ(Y ) in Definition 3.2.7 as equal to Q a:N Ya. 63 Chapter 4 Agda formalization This chapter serves as an introduction to our formalization library [21], implemented in Agda. We have opted for Agda over other proof assistants because of its recent feature enhancements that enable us to effectively engage with 2LTT. Several proof assistants and formalization projects focus on 2LTT. In [2], for instance, the authors of [3] have formalized some of their work in the Lean proof assistant [18]. Since Lean lacks direct support for 2LTT, they utilized type classes to distinguish between types and exo-types. Their work operates within a type theory that features universes of types with UIP, where exo-types correspond to the standard types of the proof assistant, while HoTT level types are represented as types “tagged” with the additional structure of being fibrant. In the case of the Coq proof assistant [6], Boulier and Tabareau [7] adopted a similar strategy within their formalization library [8]. However, Agda offers more direct support for a version of 2LTT. Agda is a dependently typed functional programming language which is developed in the programming logic group at Chalmers University of Technology with implementation described in Ulf Norell’ PhD thesis [19]. Thanks to its typing system, Agda can be used as a proof assistant, allowing to prove mathematical theorems, generally in a constructive setting. 64 The main features of Agda are the following [9] : • It is based on MLTT and supports a rich family of strictly positive inductive and inductive-recursive data types and families. • Agda offers an interactive proof development environment. Users can incrementally construct formal proofs, interact with the system to provide hints, and receive immediate feedback on the validity of their proofs. • Agda supports a very flexible pattern-matching. As previously mentioned, we have chosen to employ Agda for formalizing our theory due to its favorable environment for working with 2LTT, facilitated by a combination of both longstanding and recently introduced flags. In Agda, a flag typically refers to a command-line option or compiler directive that you can use to modify the behavior of the Agda compiler and development environment when working with Agda code. Flags are used to control various aspects of type-checking, optimization, error reporting, and more. They allow you to customize your Agda development environment to suit your specific needs and requirements. In our library, we mainly use four flags; --two-level, --cumulativity, --without-K, and --exact-split. The flag --two-level enables a new sort called SSet. This provides two distinct universes for us. Note that while it is common to assume typical ambiguity1 in papers, the formalization works with polymorphic universes. The flag --cumulativity enables the subtyping rule Set i ≤ SSet i for any level i. Thanks to the flag we can take types as arguments for the operations/formations which are originally defined for exo-types, as we discussed below Definition 2.1.1. There is a problem with the usage of these two flags together, and Figure 4.2 gives an example for this. As in the example, Agda has a feature that prevents elimination from a fibrant type to a non1HoTT Book, Section 1.3 65 Figure 4.1: Agda code for two kinds of universes. Figure 4.2: An example of the interaction between the flags --two-level and --cumulativity. fibrant type. However, when we lift N to a term in Ue , which is obtained by the cumulativity, it is not a fibrant type anymore, and Agda allows the elimination on its constructors. As noted in Remark 2.2.4, such maps are not completely wrong, and can be added to our theory. However, there are important models where they do not exist, so they should not be definable in an implementation. Also, there are other problems emerging because of the cumulativity itself2 . The flag --without-K enables a key property. It is used to disable the uniqueness of identity proofs (or called Axiom K) in Agda for the identity type of the terms of types in Set. Disabling the Axiom K with the flag has a significant impact on the behavior of Agda. When 2See https://github.com/agda/agda/issues/5761 66 this flag is used, Agda will treat equality between types (in Set) as non-trivial, meaning that even if you have a proof of equality between two types, you cannot directly substitute one for the other in all contexts. Since this does not affect the types in SSet, the exo-equality is not affected by this change; thus we indeed obtain the identity type and the exo-equality as we desired. The flag --exact-split enables that Agda definitions by pattern matching are definitional equalities. The flag is used to enforce stricter and more precise pattern matching in dependent function definitions, helping to catch potential issues related to coverage and termination checking. 4.1 Overview of library structure Figure 4.3 provides a visual representation of the intricate web of dependencies among the files within the library. The largest circle within the diagram offers insights into the dependencies associated with code pertaining to types and exo-types. The middle circle pertains to fibrancy and cofibrancy, while the smallest circle addresses aspects related to sharpness. The folders Types and Exo-types in our Agda library [21] contain all the basic definitions. The main file Primitive.agda (Figure 4.1) has the definition of the universe and the exouniverse. The file C.agda contains the complete proof of Lemma 2.2.3. The folder Coercion in the library contains the formalization of all about fibrant exo-types. Note that in [1], when an exo-type A is fibrant, its fibrant match is also assumed to be A because this paper uses isFibrant(A) := Pe RA:U (A =e RA) as the definition of fibrancy. If we assume axiom T33 , these two are logically equivalent. The main purpose of our choices becomes clearer in the formalization. In the case A =e B where A is an exo-type, and B is 3Axiom T3 says that if an exotype A is isomorphic to a type B, then A is itself a (fibrant) type [3]. 67 a type, we can still define an isomorphism between them by transporting their terms under this equality, but if we have A ∼= B, we get the isomorphism directly. In this way, we gain practical advantages. For example, the notion of fibrant-equivalence (Definition 2.3.3) is new, and it is designed for practical purposes. Also, with this approach, all proofs provided here become the same as in their formalization. Thus, there is no gap between language and symbolism. The folder Cofibration in the library is about the material related to cofibrant exo-types. The file Funext_for_cofibrant_types.agda is Proposition 2.4.2. This is one of the significant contributions of Agda formalization to the theory. We need it while we try to formalize some proofs. We already know some functorial properties of dependent function types in the usual HoTT. When we have dependent exo-types A : B → U for A : Ue , the exo-type Q a:A B(a) can be fibrant or not. However, we still need the functoriality rules for it, which are very useful in the application4 . Then Proposition 2.4.2 addresses this need by giving another version of funext, which works well enough. The folder Sharpness in the library contains all the definitions and proofs of sharpness. The files Cofibrancy_of_List in the library are the formalization of Lemma 2.6.2 and Proposition 2.6.3. The file On_Sharpness_of_List is the formalization of Proposition 2.6.4. The file BinTree in the library includes the proof of the isomorphism 2.6. Also, the file Cofibrancy_of_BinTree includes Proposition 2.6.8 and the cofibrancy results about (unlabeled) binary trees. The file On_Sharpness_of_BinTree includes the sharpness results about (unlabeled) binary trees. 4For example, the proof of Proposition 2.5.4 (vi) 68 Figure 4.3: The module dependency graph of the library. 69 Chapter 5 Future directions As previously mentioned, this formalization project aims to move a study about 2LTT [1] to Agda. In addition to definitions and results here, we also formalized exo-categories and diagram signatures in that study. More will be added in the future. We also plan to generalize the results about cofibrancy and sharpness. Natural numbers, lists, and binary-trees are all inductive types. The general class of such inductive types is called W-types. Similar to the cofibrant exo-nat axiom, we have been studying on possible conditions (or axioms) related to W-types to obtain criteria for cofibrant and sharp W-types. Currently, a study on W-types in 2LTT has not been conducted yet; thus, we plan to work on this open problem. We have already considered some special cases like lists and binary trees. We can use their proofs to find a general pattern if possible. That is why we cared these cases initially. We have been studying to improve the Agda library. The experimental feature of Agda we used reveals also some bugs; hence, we plan to solve these issues to obtain precise consistency. Furthermore, it is not unreasonable to think that this study will offer new ideas about the concepts specific to 2LTT. 70 Bibliography [1] Benedikt Ahrens et al. “The Univalence Principle”. In: (2021). doi: 10.48550/ARXIV. 2102.06275. url: https://arxiv.org/abs/2102.06275. [2] Danil Annenkov, Paolo Capriotti, and Nicolai Kraus. Lean Formalisation of Two-Level Type Theory. 2019. url: https://github.com/annenkov/two-level. [3] Danil Annenkov et al. “Two-level type theory and applications”. In: Mathematical Structures in Computer Science (2023), pp. 1–56. doi: 10.1017/S0960129523000130. [4] Grzegorz Bancerek et al. “The Role of the Mizar Mathematical Library for Interactive Proof Development in Mizar”. In: J. Autom. Reason. 61.1–4 (2018), pp. 9–32. doi: 10.1007/s10817-017-9440-6. url: https://doi.org/10.1007/s10817-017-9440- 6. [5] Henk Barendregt and Herman Geuvers. “Proof-Assistants Using Dependent Type Systems”. In: Handbook of Automated Reasoning. Elsevier Science Publishers B. V., 2001, pp. 1149–1238. [6] Yves Bertot and Pierre Cast´eran. Interactive theorem proving and program development. Texts in Theoretical Computer Science. An EATCS Series. Springer-Verlag, Berlin, 2004, pp. xxvi+469. doi: 10.1007/978-3-662-07964-5. [7] Simon Boulier and Nicolas Tabareau. “Model structure on the universe in a two level type theory”. In: (2017). url: https://hal.science/hal-01579822. [8] Simon Boulier and Nicolas Tabareau. Two-level type theory in Coq. 2020. url: https: //github.com/CoqHott/coq-2ltt. [9] Ana Bove, Peter Dybjer, and Ulf Norell. “A brief overview of Agda—a functional language with dependent types”. In: Theorem proving in higher order logics. Vol. 5674. Lecture Notes in Comput. Sci. Springer, Berlin, 2009, pp. 73–78. doi: 10.1007/978- 3-642-03359-9\_6. 71 [10] Paolo Capriotti. “Models of type theory with strict equality”. PhD thesis. Nottingham, UK: School of Computer Science, University of Nottingham, 2016. url: http : / / arxiv.org/abs/1702.04912. [11] Shimon Even. Graph Algorithms. Ed. by Guy Even. 2nd ed. Cambridge University Press, 2011. doi: 10.1017/CBO9781139015165. [12] Herma Geuvers. “Proof assistants : history, ideas and future”. In: Sadhana 34.3–25 (2009), pp. 3–25. doi: 10.1007/s12046-009-0001-5. url: https://doi.org/10. 1007/s12046-009-0001-5. [13] Martin Hofmann. “Syntax and Semantics of Dependent Types”. In: Semantics and Logics of Computation. Publications of the Newton Institute. Cambridge University Press, 1997, pp. 79–130. doi: 10.1017/CBO9780511526619.004. [14] Mark Hovey. Model categories. Vol. 63. Mathematical Surveys and Monographs. American Mathematical Society, Providence, RI, 1999, pp. xii+209. [15] Krzysztof Kapulkin and Peter LeFanu Lumsdaine. “The simplicial model of univalent foundations (after Voevodsky)”. In: J. Eur. Math. Soc. (JEMS) 23.6 (2021), pp. 2071– 2126. doi: 10.4171/JEMS/1050. [16] Peter LeFanu Lumsdaine and Michael Shulman. “Semantics of higher inductive types”. In: Math. Proc. Cambridge Philos. Soc. 169.1 (2020), pp. 159–208. doi: 10 . 1017 / s030500411900015x. [17] Peter Lefanu Lumsdaine and Michael A. Warren. “The Local Universes Model: An Overlooked Coherence Construction for Dependent Type Theories”. In: 16.3 (2015). doi: 10.1145/2754931. [18] Leonardo de Moura et al. “The Lean Theorem Prover (System Description)”. In: Automated Deduction - CADE-25. Springer International Publishing, 2015, pp. 378–388. [19] Ulf Norell. “Towards a practical programming language based on dependent type theory”. PhD thesis. Chalmers University of Technology, 2007. url: https://www.cse. chalmers.se/~ulfn/papers/thesis.pdf. [20] The Univalent Foundations Program. Homotopy Type Theory—Univalent Foundations of Mathematics. The Univalent Foundations Program, Princeton, NJ; Institute for Advanced Study (IAS), Princeton, NJ, 2013, pp. xiv+589. [21] Elif Uskuplu. Formalisation of 2LTT in Agda. 2023. url: https : / / github . com / ElifUskuplu/2LTT-Agda. 72 [22] Vladimir Voevodsky. A simple type system with two identity types. Unpublished note. 2013. 73
Abstract (if available)
Abstract
This study provides some results about two-level type-theoretic notions in a way that the proofs are fully formalizable in a proof assistant implementing two-level type theory such as Agda. The difference from prior works is that these proofs do not assume any abuse of notation, providing more direct formalization. Also, some new notions, such as function extensionality for cofibrant exo-types, are introduced. The necessity of such notions arises during the task of formalization. In addition, we provide some novel results about inductive types using cofibrant exo-nat, the natural number type at the non-fibrant level. While emphasizing the necessity of this axiom by citing new applications as justifications, we also touch upon the semantic aspect of the theory by presenting various models that satisfy this axiom.
Linked assets
University of Southern California Dissertations and Theses
Conceptually similar
PDF
Unbounded utility
PDF
The structure and higher representation theory of odd categorified sl(2)
PDF
A “pointless” theory of probability
PDF
The Z/pZ Gysin sequence in symplectic cohomology
PDF
Zeta functions: from prime numbers to K-theory
PDF
Uncertain knowledge
PDF
Positivity and generalized Teichmüller theory: dynamical and algebraic aspects
PDF
On sutured construction of Liouville sectors-with-corners
PDF
Moyal star formalism in string field theory
PDF
Symmetries of categorified quantum groups
PDF
Higher gauge fields and instantons in type-II superstring theory and M-theory
PDF
Switching dynamical systems with Poisson and multiscale observations with applications to neural population activity
PDF
On information captured by neural networks: connections with memorization and generalization
PDF
Unique continuation for elliptic and parabolic equations with applications
PDF
Disease modifying treatments for Alzeimer's disease: modeling, value assessment and eligible patients
PDF
Holography, magnetic fields and thermodynamic volumes
PDF
Instantial terms, donkey anaphora, and individual concepts
PDF
The geometry of motivic spheres
PDF
Culturally-relevant, autonomy supportive instruction: toward an integration for enhancing the motivation of racially and ethnically diverse learners
PDF
Relationships between a community college student’s sense of belonging and student services engagement with completion of transfer gateway courses and persistence
Asset Metadata
Creator
Uskuplu, Elif (author)
Core Title
Formalizing two-level type theory with cofibrant exo-nat
School
College of Letters, Arts and Sciences
Degree
Doctor of Philosophy
Degree Program
Mathematics
Degree Conferral Date
2023-12
Publication Date
10/25/2023
Defense Date
10/23/2023
Publisher
Los Angeles, California
(original),
University of Southern California
(original),
University of Southern California. Libraries
(digital)
Tag
Agda,category with families,homotopy type theory,OAI-PMH Harvest,proof assistant,two-level type theory
Format
theses
(aat)
Language
English
Contributor
Electronically uploaded by the author
(provenance)
Advisor
Lauda, Aaron (
committee chair
), Bacon, Andrew (
committee member
), Helfer, Joseph (
committee member
), Shulman, Michael (
committee member
)
Creator Email
euskuplu@usc.edu,uskupluelif@gmail.com
Permanent Link (DOI)
https://doi.org/10.25549/usctheses-oUC113761201
Unique identifier
UC113761201
Identifier
etd-UskupluEli-12434.pdf (filename)
Legacy Identifier
etd-UskupluEli-12434
Document Type
Dissertation
Format
theses (aat)
Rights
Uskuplu, Elif
Internet Media Type
application/pdf
Type
texts
Source
20231030-usctheses-batch-1103
(batch),
University of Southern California
(contributing entity),
University of Southern California Dissertations and Theses
(collection)
Access Conditions
The author retains rights to his/her dissertation, thesis or other graduate work according to U.S. copyright law. Electronic access is being provided by the USC Libraries in agreement with the author, as the original true and official version of the work, but does not grant the reader permission to use the work if the desired use is covered by copyright. It is the author, as rights holder, who must provide use permission if such use is covered by copyright.
Repository Name
University of Southern California Digital Library
Repository Location
USC Digital Library, University of Southern California, University Park Campus MC 2810, 3434 South Grand Avenue, 2nd Floor, Los Angeles, California 90089-2810, USA
Repository Email
cisadmin@lib.usc.edu
Tags
Agda
category with families
homotopy type theory
proof assistant
two-level type theory