arthurfreitasramos - ufpe
TRANSCRIPT
Arthur Freitas Ramos
Explicit Computational Paths in Type Theory
Universidade Federal de [email protected]
http://cin.ufpe.br/~posgraduacao
Recife2018
Arthur Freitas Ramos
Explicit Computational Paths in Type Theory
Esse trabalho foi apresentado Γ PΓ³s-graduação em CiΓͺncia da Computação do Centro de InformΓ‘tica da Universidade Federal de Pernambuco como requisito parcial para obtenção do grau de Doutor em CiΓͺncia da Computação.
Γrea de Concentração: Teoria da Computação
Orientadora: Anjolina Grisi de Oliveira Co-orientador: Ruy JosΓ© Guerra Barreto de Queiroz
Recife2018
Catalogação na fonte BibliotecÑria Monick Raquel Silvestre da S. Portes, CRB4-1217
R175e Ramos, Arthur Freitas Explicit computational paths in type theory / Arthur Freitas Ramos. β 2018.
145 f.: il., tab.
Orientadora: Anjolina Grisi de Oliveira. Tese (Doutorado) β Universidade Federal de Pernambuco. CIn, CiΓͺncia da
Computação, Recife, 2018. Inclui referΓͺncias.
1. CiΓͺncia da computação. 2. Teoria da computação. I. Oliveira, AnjolinaGrisi de (orientador). II. TΓtulo.
004 CDD (23. ed.) UFPE- MEI 2018-140
Arthur Freitas Ramos
βExplicit Computational Paths in Type Theoryβ
Tese de Doutorado apresentada ao Programa
de PΓ³s-Graduação em CiΓͺncia da
Computação da Universidade Federal de
Pernambuco, como requisito parcial para a
obtenção do tΓtulo de Doutora em CiΓͺncia da
Computação.
Aprovado em: 17/08/2018.
_____________________________________________________
Orientadora: Profa. Anjolina Grisi de Oliveira
BANCA EXAMINADORA
______________________________________________ Prof. Frederico Luiz Gonçalves de Freitas
Centro de InformΓ‘tica /UFPE
______________________________________________ Prof. Edward Hermann Haeusler
Departamento de InformΓ‘tica / PUC/RJ
_______________________________________________ Prof. Hugo Luiz Mariano
Instituto de MatemΓ‘tica e EstatΓstica / USP
_______________________________________________ Profa. Elaine GouvΓͺa Pimentel
Departamento de MatemΓ‘tica / UFRN
_______________________________________________ Prof. AntΓ³nio MΓ‘rio da Silva Marcos Florido
Departamento de CiΓͺncia de Computadores / Universidade do Porto
To my parents, Neide & Valdez, who are my role models.To my wife, LΓ‘is, for all the love and support.
ACKNOWLEDGEMENTS
This work would have not been possible without the help of many people. First, I canpoint the never-ending dedication of my parents, Neide and Valdez. Despite facing manyhardships in life, they always valued my education, supporting and encouraging my stud-ies. For this, I am eternally grateful. You are my role models and my heroes. I thankmy wife, LaΓs, for her patience, love and support. Without her, it would be impossible towrite this work. I also thank my advisor, Professor Ruy de Queiroz. He has been in thisjourney with me for 5 years, since the end of my undergraduate studies. I have learned agreat deal from him and he has shown me true wisdom. Last but not least, I thank Godfor giving me patience, strength and resilience every time I asked.
ABSTRACT
The current work has three main objectives. The first one is the proposal of com-putational paths as a new entity of type theory. In this proposal, we point out the factthat computational paths should be seen as the syntax counterpart of the homotopicalpaths between terms of a type. We also propose a formalization of the identity type usingcomputational paths. The second objective is the proposal of a mathematical structure fora type using computational paths. We show that using categorical semantics it is possibleto induce a groupoid structure for a type and also a higher groupoid structure, usingcomputational paths and a rewrite system. We use this groupoid structure to prove thatcomputational paths also refutes the uniqueness of identity proofs. The last objective is toformulate and prove the main concepts and building blocks of homotopy type theory. Weend this last objective with a proof of the isomorphism between the fundamental groupof the circle and the group of the integers.
Key-words: Computational paths. Homotopy type theory. Identity type. Category the-ory. Term rewrite system. Uniqueness of identity proofs.
RESUMO
O presente trabalho tem trΓͺs objetivos principais. O primeiro Γ© propor caminhos com-putacionais como uma nova entidade da teoria dos tipos. Nessa proposta, indicamos queos caminhos computacionais podem ser vistos como uma contrapartida sintΓ‘tica dos cam-inhos homotΓ³picos entre termos de um mesmo tipo. TambΓ©m propomos uma formalizaçãodo tipo identidade usando caminhos computacionais. O segundo objetivo Γ© propor umaestrutura matemΓ‘tica para um tipo usando os caminhos computacionais. Mostramos, us-ando semΓ’ntica categΓ³rica, que Γ© possΓvel induzir uma estrutura de grupΓ³ide de alta ordempara um tipo, utilizando os caminhos computacionais e um sistema de reescrita. Usamoso modelo de grupΓ³ide para provar que os caminhos computacionais tambΓ©m refutam aunicidade de provas de identidade. O ΓΊltimo objetivo Γ© formular e provar os principaisconceitos da teoria homotΓ³pica dos tipos utilizando caminhos. Finalizamos esse ΓΊltimoobjetivo com uma prova do isomorfismo entre o grupo fundamental do cΓrculo e o grupodos inteiros.
Palavras-chaves: Caminhos computacionais. Teoria homotΓ³pica dos tipos. Tipo iden-tidade. Teoria das categorias. Sistema de reescrita de termos. Unicidade de provas deidentidade.
LIST OF TABLES
Table 1 β Multiple semantical interpretations of a type . . . . . . . . . . . . . . . 31
LIST OF ABBREVIATIONS AND ACRONYMS
πΌπβ πΈ identity type elimination
πΌπππ₯π‘ β πΈ extensional identity type elimination
πΌπππ₯π‘ β πΈπ extensional identity type equality
πΌπππ₯π‘ β πΉ extensional identity type formation
πΌπππ₯π‘ β πΌ extensional identity type introduction
πΌππππ‘ β πΉ identity type formation
πΌππππ‘ β πΌ identity type introduction
Ξ β πΆ dependent function computation
Ξ β πΈ dependent function elimination
Ξ β πΉ dependent function formation
Ξ β πΌ dependent function introduction
Ξ£ β πΈ1 first dependent sum elimination
Ξ£ β πΈ2 second dependent sum elimination
Ξ£ β πΉ dependent sum formation
Ξ£ β πΌ dependent sum introduction
Nβ πΌ0 zero introduction
Nβ πΌπ successor induction
Γ β πΈ1 first product elimination
Γ β πΈ2 second product elimination
Γ β πΉ product formation
Γ β πΌ product introduction
UIP Uniquiness of Identity Proofs
ZFC Zermelo-Frankel-Choice
CONTENTS
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.1 FOUNDATIONS OF MATHEMATICS AND ZFC . . . . . . . . . . . . . . 131.2 THE IDENTITY TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.3 OBJECTIVES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.4 STRUCTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2 TYPE THEORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.1 BASIC CONCEPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.1.1 Definitional Equality vs Propositional Equality . . . . . . . . . . . . . 202.1.2 Type Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.1.3 Function Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.1.4 Dependent Function Type(Ξ ) . . . . . . . . . . . . . . . . . . . . . . 242.1.5 Product type (Γ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.1.6 Coproduct (+) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.1.7 Dependent Pair Type (Ξ£) . . . . . . . . . . . . . . . . . . . . . . . . . 272.1.8 Alternative Formulation for the Dependent Pair . . . . . . . . . . . . 282.1.9 The Natural Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.1.10 Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.2 IDENTITY TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.2.1 Formal Definition of The Identity Type . . . . . . . . . . . . . . . . . 322.2.2 Basic Constructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.2.3 Extensionality vs Intensionality . . . . . . . . . . . . . . . . . . . . . . 362.3 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3 CATEGORY THEORY . . . . . . . . . . . . . . . . . . . . . . . . . 383.1 BASIC CONCEPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383.1.1 Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.1.2 Isomorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413.1.3 Groupoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.1.4 Functors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.1.5 Duality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453.1.6 Commutativity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463.1.7 Product between two categories . . . . . . . . . . . . . . . . . . . . . 463.1.8 Hom and Small Categories . . . . . . . . . . . . . . . . . . . . . . . . 473.2 PRODUCT IN A CATEGORY . . . . . . . . . . . . . . . . . . . . . . . . 483.2.1 Product in Type Theory and Category Theory . . . . . . . . . . . . . 50
3.2.2 Coproduct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513.3 NATURAL TRANSFORMATIONS . . . . . . . . . . . . . . . . . . . . . . 513.3.1 Adjoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553.4 HIGHER CATEGORIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573.4.1 Globular Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573.4.2 Horizontal Composition . . . . . . . . . . . . . . . . . . . . . . . . . . 583.4.3 Bicategories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593.5 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4 COMPUTATIONAL PATHS . . . . . . . . . . . . . . . . . . . . . . 624.1 INTRODUCING COMPUTATIONAL PATHS . . . . . . . . . . . . . . . . 634.1.1 Formal Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.1.2 Equality Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664.1.3 Identity Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674.1.4 Path-based Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 684.1.4.1 Reflexivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694.1.4.2 Symmetry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694.1.4.3 Transitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694.2 TERM REWRITE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . 724.2.1 πΏππ·πΈπ β ππ π . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734.2.1.1 Subterm Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734.2.1.2 Rewriting Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734.2.2 Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834.2.2.1 Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834.2.2.2 Confluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844.2.2.3 Normalization Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . 854.2.3 Rewrite Equality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864.2.4 πΏππ·πΈπ β ππ π2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874.3 GROUPOID MODEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894.3.1 Globular Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894.3.2 The Induced Groupoid . . . . . . . . . . . . . . . . . . . . . . . . . . . 904.3.3 Higher Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 934.4 UNIQUENESS OF IDENTITY PROOFS . . . . . . . . . . . . . . . . . . . 984.5 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5 HOMOTOPY TYPE THEORY . . . . . . . . . . . . . . . . . . . . . 1015.1 GROUPOID LAWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1015.2 FUNCTORIALITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1075.3 TRANSPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095.4 HOMOTOPIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.5 CARTESIAN PRODUCT . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155.6 UNIT TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195.7 FUNCTION EXTENSIONALITY . . . . . . . . . . . . . . . . . . . . . . . 1205.8 UNIVALENCE AXIOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1245.9 IDENTITY TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1255.10 COPRODUCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1285.11 REFLEXIVITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305.12 NATURAL NUMBERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1315.13 SETS AND AXIOM K . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1335.14 FUNDAMENTAL GROUP OF A CIRCLE . . . . . . . . . . . . . . . . . . 1355.15 RULES ADDED TO πΏππ·πΈπ β ππ π . . . . . . . . . . . . . . . . . . . . 1385.16 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1406.1 FUTURE WORK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
REFERENCES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
13
1 INTRODUCTION
In this chapter, we introduce the main objective of this work. First, we show that theaxiom system Zermelo-Frankel-Choice (ZFC), the main theory currently used as founda-tions of mathematics, is not constructive and thus, modeling it using computers is notpracticable. After that, we introduce a theory that can be used as a foundation for com-putation and mathematics at the same time, homotopy type theory. Then, we introducethe type responsible for this connection, the identity type. Given the importance givento this type, it will be the main entity of this work. The main objective is to show analternative way of formalizing the identity type, using an entity known as computationalpath. To do that, we propose a mathematical model to computational paths and provemany results of homotopy type theory using it.
1.1 FOUNDATIONS OF MATHEMATICS AND ZFC
One can easily say that the XIX century caused a mathematical revolution. It is mainlyresponsible for the modern way of mathematical thinking (AVIGAD, 2007). Before thiscentury, mathematical practice was closely related to algorithmic processes. This cen-tury was marked by a sharp increase in abstraction in mathematics (AVIGAD, 2007).For example, it was in this century that non-euclidean geometries were proposed. First,the hyperbolic geometry by Nikolai Lobachevsky in 1832 and then elliptic geometry byBernhard Riemman in 1851.
Given this high level of abstraction, a natural question has arisen. Where do math-ematical objects come from? A mathematical object already exists and is awaiting forsomeone to discover it, or is it a creation of human minds? This question divided themathematical community and was responsible for the creation of a whole new area of re-search, called philosophy of mathematics. In one hand, there were some mathematiciansthat defended that there is already an abstract and immutable universe containing allmathematical objects. Thus, a mathematicianβs job was to discover the objects of thiswork. This vision is known as Platonism and is currently the main vision of most mathe-maticians. On the other hand, there were some that believed that a mathematical objectis created at the exact moment that it is conceived in the mind of a mathematician. Thus,the objective is constructed by the mathematician. This vision is known as constructivism.Since computers uses algorithmic process (programs) to obtain results, it is closely relatedto this constructive view of mathematics.
This work has been written based on the authorβs masterβs thesis (RAMOS, 2015), three journal papers,two published (RAMOS; QUEIROZ; OLIVEIRA, 2017; QUEIROZ; OLIVEIRA; RAMOS, 2016) and a thirdone still unpublished, and a conference talk (RAMOS, 2017) based on the still unpublished paper.
Chapter 1. Introduction 14
The way one does mathematics can depend on the view one chooses to follow. We aregoing to give an classic example of two proofs (DUMMETT, 1977), one that is not acceptedby constructivists and one that is. Consider the following proposition:
Proposition 1.1. There exist two irrational numbers π e π such that ππ is a rationalnumber.
First, we give a proof that is accepted by platonists but not by constructivists.
Proof. Consider the numberβ
2. It is clearly irrational. Thus,β
2β
2 is irrational or ratio-nal. If it is rational, then we conclude the proof. If not (
β2
β2)
β2 =
β22 = 2 (DUMMETT,
1977), also conclude the proof, sinceβ
2β
2 was considered to be irrational.
This proof shows that one of the two cases solves the problem, but not determinewhich one does. Thus, this proof is not constructive. But, if one accepts the platonicpoint of view, this proof is completely acceptable. Consider this alternate proof:
Proof. Consider numbersβ
2 and logβ2 3. Since both are irrationals and
β2logβ
2 3 = 3,then our proof is complete.
One can notice that we directly show two irrational numbers that can be used toconstruct a rational one. Thus, we consider this proof as a constructive one.
Currently, most mathematicians are platonists, thus they accept proofs like the firstone. One of the factors that may be responsible for this is the fact that ππΉπΆ is widelyaccepted as a foundation for mathematics. ππΉπΆ, a abbreviation for Zermelo-Frankel withchoice is an axiomatic theory proposed in 1908 and improved in 1920-1940 (HORSTEN,2015). that gave a mathematical formalization for set theory. It was born out of necessity,since Russel noticed that naive set theory led to a paradox.
In 1901, the philosopher and mathematician Bertrand Russell discovered a paradoxthat disrupted the mathematical community. In naive set theory, one can construct thefollowing set: π = {π₯|π₯ /β π₯}. Russel noticed that it led to a paradox (IRVINE, 2014), ifone thinks in the following way: If π is not a member of itself, then by the definition of π it should be a member of itself. But if π is a member of itself, it would contradict directlyits own definition. Thus, π cannot exist. Thus, ππΉπΆ was proposed to deal with problemslike this one.
The main problem is that ππΉπΆ is not constructive. Using the axiom of choice, one canshow a theorem that states that every set can be well-ordered(HRBACEK; JECH, 1999).Nevertheless, one is not able to construct directly a well-ordering for the reals. Therefore,this clearly shows that ππΉπΆ admits results without an explicit construction.
Chapter 1. Introduction 15
1.2 THE IDENTITY TYPE
In this section, we show that it is possible to connect computer science and mathematicsusing the identity type. The identity type is arguably the most important entity of atheory known as type theory. Type theory is a construct theory proposed by the mathe-matician Martin-LΓΆf in 1971(MARTIN-LΓF, 1975; MARTIN-LΓF, 1982; MARTIN-LΓF, 1984).The fundamental concept of this theory is the concept of type. A type is defined by adescription on how to construct and eliminate it (BRIDGES; PALMGREN, 2013). We showthis theory in detail in chapter 2
Given any type π΄, we write π : π΄ to indicate that π is a term of type π΄. The identitytype captures the following idea: given any terms π : π΄ and π : π΄ and a proof π thatestablishes that π = π, then one can say that π is term of the identity type πΌππ΄(π, π), i.e.,the terms of type πΌππ΄(π, π) are proofs that establish that π = π. That way, the identitytype gives two main facts: that π is equal to π and why this equality holds.
A groundbreaking result turned the identity type in one of the most studied topicsof type theory: the direct relation between the identity type and homotopy type theory(VOEVODSKY, 2014). This came from the fact that one can semantically interpret a typeπ΄ as a topological space, the objects π, π : π΄ are seen as point of this space and a term π :πΌππ΄(π, π) is seen as a homotopical path between points π and π(Univalent Foundations Program,2013). This interpretation yielded groundbreaking results. One of the most importantresult is the fact that it connected homotopy theory with type theory, giving rise tohomotopy type theory. Moreover, it raised the possibility of type theory as a foundationof mathematics. Also, since type theory is naturally constructive, it can be used as afoundation for computation.
The distinguished mathematician Vladimir Voevodsky made clear the advantages ofusing a constructive theory as a foundation for mathematics (VOEVODSKY, 2014). Vo-evodsky, which is a Fields Medal winner, proposes that the increasingly abstraction ofmathematics makes the mathematician prone to committing errors when doing mathe-matics. To illustrate that, he uses his past experiences: he discovered in 2013 that a paperpublished by him in 1989 contained errors (VOEVODSKY, 2014). Thus, he argues that ifone did mathematics using the help of an automatic theorem checker, errors like this onewould not occur anymore. Thus, one practical advantage of homotopy type theory is thefact that all proofs can be modeled and checked by computers.
One of the disadvantages of the identity type is that it can be hard to understand. Itis based on the fact that the only canonical proof of equality is the reflexivity, i.e., givena term π : π΄, we have a canonical proof π(π) : π = π. This leads to a complex eliminationrule that gives rise to an induction known as path induction (Univalent Foundations Program,2013). Although beautifully defined, we have noticed that proofs that uses the identitytype can be sometimes a little too complex. The elimination rule of the intensional identitytype encapsulates lots of information, sometimes making too troublesome the process of
Chapter 1. Introduction 16
finding the reason that builds the correct type.Inspired by the path-based approach of the homotopy interpretation, we believe that
a similar approach can be used to define the identity type in type theory. Our main idea isto add computational paths to the formal syntax of type theory. That way, this new entitywould be the syntax counterpart of semantical paths. In the sequel, we shall define formallythe concept of a computational path. The main idea, i.e. proofs of equality statements as(reversible) sequences of rewrites, is not new, as it goes back to a paper entitled βEqualityin labeled deductive systems and the functional interpretation of propositional equality", presented in December 1993 at the 9th Amsterdam Colloquium, and published in theproceedings in 1994(QUEIROZ; GABBAY, 1994).
One of the most interesting aspects of the identity type is the fact that it can be usedto construct higher structures. This is a rather natural consequence of the fact that it ispossible to construct higher identities. For any π, π : π΄, we have type πΌππ΄(π, π). If this typeis inhabited by any π, π : πΌππ΄(π, π), then we have type πΌππΌππ΄(π,π)(π, π). If the latter type isinhabited, we have a higher equality between π and π(HARPER, 2012). This concept is alsopresent in computational paths. One can show the equality between two computationalpaths π and π‘ by constructing a third one between π and π‘. We show in the sequel a systemof rules used to establish equalities between computational paths(OLIVEIRA, 1995). Then,we show that these higher equalities go up to the infinity, forming a β-globular-set. Wealso show that computational paths naturally induce a structure known as groupoid. Wealso go a step further, showing that computational paths are capable of inducing a highergroupoid structure.
After constructing this mathematical model, we also need to show that it is possible touse computational paths to construct concepts of homotopy type theory. To do that, weinvestigate well established properties and concepts of the foundations of homotopy typetheory. We are interested in the ones connected to the identity type. Our main objective isto show that these properties and theorems are valid in our approach for the identity typebased on computational paths. In this sense, we show that one can use computationalpaths to define and develop concepts of homotopy type theory. We end this work with aproof using computational paths that the fundamental group of a circle is isomorphic tothe integers.
1.3 OBJECTIVES
In the previous sections, we pointed out the importance of type theory to mathematicsand computation. We have also said that the identity type is one of the main conceptsof this theory and perhaps the most interesting one. With that in mind, we have saidthat we want to develop an alternative approach to the identity type, based on the factthat an equality proof can be seen as a sequence of rewrites between two computationalobjects. In this sense, this work has 3 main objectives.
Chapter 1. Introduction 17
The first objective is to formally introduce to type theory an entity known as com-putational paths and, based on this entity, propose a formulation for the identity type.To do this, we revisit the main concepts of type theory and some important concepts ofπ-calculus. Then, we introduce the notion of computational paths. We present this newentity in the traditional way of defining a type in type theory: we define formation, intro-duction, elimination and computation rules. We also establish a rewrite system that willwork as an algebra of computational paths.
The second objective is to give mathematical meaning to the structure of computa-tional paths. We do this using categorical semantics. Specifically, we are talking aboutthe groupoid structure of a type. We use our computational path entity and the associ-ated rewrite system to show that every type has an induced groupoid associated to it.We also go a step further, showing that it is possible to induce higher structures such asbicategories.
Our final objective is to establish the connection between computational paths andhomotopy type theory. We use the theory developed in this work to show that manyconcepts and proofs of homotopy type theory can be achieved without the use of path-induction, using computational paths instead. In this sense, we show that our approach iscapable of producing the main building blocks of homotopy theory. We end this objectivewith an important proof: we use computational paths to show that the fundamentalgroupoid of the circle is isomorphic to the group of the integers.
Thus, to achieve the first objective, we have mainly used a computational approach.The second one is mainly a mathematical approach. The third objective is a mix betweenthe previous two.
1.4 STRUCTURE
This first chapter was meant as an introduction for this work. We have highlighted theimportance of the importance of the identity type in type theory. We have also exposedthe main objectives of this work.
The second chapter will be focused on type theory. In this chapter, we will introducethe basic concepts and the difference of definitional and propositional equality. We alsoshow the classic approach for the identity type, showing the formation, introduction,elimination and computation rules. We also show how to use this approach in practice,showing how some basic types can be constructed.
The third chapter will be focused on category theory. We show the basic conceptsof this theory and also some concepts of higher category. This chapter is important tounderstand the results of chapter 4.
The fourth chapter is of great importance, since it is responsible for objectives 1 and2. In this chapter, we introduce the concept of computational paths and establishes theconnection with the identity type. Moreover, we introduce an extremely important rewrite
Chapter 1. Introduction 18
system, responsible for establishing the equalities between computational paths. Thus,we use this system and categorical semantics to show that computational paths inducea mathematical structure known as groupoid. We finish this chapter establishing onefundamental result, the refutation of the uniqueness of identity proofs using computationalpaths.
The fifth chapter is responsible for objective 3. In this chapter. we use the theorydeveloped in chapter 4 to define, construct and prove the main building blocks of homotopytheory. In the process, we prove dozens of lemmas and theorems. We end this chapter withone of the most classic proofs of algebraic topology: we use computational paths and therewrite system to show that the fundamental group of the circle is isomorphic to the groupof the integers.
The sixth chapter is the conclusion of this work. It is a short chapter in which wereview and point out all results obtained in this work.
19
2 TYPE THEORY
Among the theories used as a foundation for computation, one of the most famousand that is closely related to a general purpose computer are the theory of Turing ma-chines, proposed by Alan Turing in 1937. Turing machines had great success in giving amathematical formalization for the concept of computer. Moreover, it is essential in theinvestigation of the complexity of algorithms and the limits of computations, proving theexistence of problems that are not bound to be solved by computers (BARKER-PLUMMER,2013).
Even before Turingβs groundbreaking work, one theory that has the same power ofTuringβs machine had already been proposed by Alonso Church. Known as π-calculus, itcan be seen as a very basic programming language, with only two operations: functionabstraction and function application. Despite this fact, π-calculus plays a very importantrole in computation, logic and mathematics.
Initially, π-calculus was proposed to simplify the notation of functions (ALAMA, 2015).Take π(π₯) = π₯Ε‘ as a very simple example. How do we calculate the value of π(3)? It isvery simple. We just need to plug the value 3 in place of π₯ in the expression π₯2, resultingin 32 = 9. The idea that π₯2 is an expression that awaits one term to be plugged into itis given by the abstraction operation. We denote this fact by the expression π.π₯2. Thus,π = π.π₯2. Function is the reverse process. Given π.π₯2, one can use an application tosubstitute the value of input π₯ for an arbitrary value π¦. When we apply π¦, we woundup with (π.π₯2).π¦. Then, we say that this term π½-reduce to [π¦/π₯]π₯2 = π¦2. The notation[π¦/π₯] indicates that all occurrences of π₯ in the term will be substituted for π¦. We are alsogoing to use this notation in type theory. Therefore, we had in our previous example thefollowing case: [3/π₯]π₯2 = 32 = 9.
One of the most counterintuitive facts is that it is possible to prove that this theorywith only two simple operations is powerful enough to formalize all computable functions(HINDLEY; SELDIN, 2008). That way, π-calculus, together with the theory of Turingβsmachines are the two main theories used to formalize computability and that serve as afoundation for computation.
Type theory is a theory that is in many aspects similar to π-calculus. Despite this,it was originally proposed with for a different purpose. Instead of being a foundation forcomputation, the main objective of type theory was to function as a foundation for con-structive mathematics. Specifically, an attempt based on Erret Bishopβs constructivism.This work will focus on a specific kind of type theory: Martin-LΓΆfβs intensional type the-
Parts of this chapter are based on previous research done by the author and appears in his MasterβsThesis (RAMOS, 2015)
Chapter 2. Type Theory 20
ory, originally proposed in 1971. Since this theory is intrinsically constructive, it has alsobeen used as a foundation for computation. This fact can be seen in practice: Coq, Agdaand Epigram are all examples of programming languages based on the concepts of typetheory.
In the next section, we describe and develop the main basic concepts and types ofMartin-LΓΆfβs intensional type theory. The correct understanding of this concepts will beessential to the development of latter sections of this work.
2.1 BASIC CONCEPTS
The main and most basic concept of type theory is the concept of type. A type must beunderstood as a fundamental concept that work as the basis of type theory. One can thinkof a type as similar to the concept of set in set theory. In fact, types are more powerfulin type theory than sets in set theory (Univalent Foundations Program, 2013). The reason forthat is that one cannot derive all results of ZFC using sets only. The use of first-orderlogic is necessary to state the axioms. In ZFC, the concept of set and propositions arecompletely distinct. In contrast, we are going to see that propositions can be seen as typesin type theory.
Let π΄ be a type and π a term of type π΄. We say that π΄ is inhabited by π and denotethis by π : π΄. This is the basic judgment of type theory. Another judgment is π = π : π΄,indicating that π and π are intensionally equal elements of type π΄.
The syntax of type theory is independent of the nature of type π΄. π΄ can be a set,a proposition or even a topological space. Nevertheless, for all those cases, if π has typeπ΄, then we always denote π : π΄. What differs is the semantical interpretation of π : π΄(Univalent Foundations Program, 2013). If π΄ is a set, then π can be understood as an elementof set π΄. If it is a space, then π is a point of space π΄. A very interesting case is when π΄
is a proposition. In that case, π can be seen as a witness of the veracity of π΄. In otherwords, π is a proof that π΄ is true. One should keep in mind that it is only a semanticalinterpretation. Even when π΄ is a set and π : π΄, one cannot write π β π΄.
In the next subsection, we investigate the existence of two different kinds of equalitiesin type theory.
2.1.1 Definitional Equality vs Propositional Equality
One of the main things that one should grasp about type theory is the existence andthe difference between two types of equality. The first kind of equality is originated bythe fact that two terms are equal simply by definition, without the need of some resultestablishing the equality. This equality is called definitional equality. The other kind ofequality is when equality is seen as a type. In that case, it is called propositional equality.
Chapter 2. Type Theory 21
Between the two kinds of equality, the most interesting one is the propositional, since itoriginates the identity type. Given terms π, π : π΄, one could derive the judgment π = π : π΄.Thus, taken this judgment as a starting point, one can naturally conceive a premiseestablishing the equality between terms π and π of type π΄. This equality gives rise toa proposition, i.e., a type known as identity type, usually written as πΌππ΄(π, π). Usingthe aforementioned interpretation, πΌππ΄(π, π) should be understood as a proposition thatestablishes the equality between π and π. We say that π is propositionally equal to π. Ifwe have a proof π of this equality, then π : πΌππ΄(π, π). That way, π is a witness of πΌππ΄(π, π),establishing the veracity of the proposition that π is propositionally equal to π.
The definitional equality is much simpler than the propositional one. In this equal-ity, the existence of a witness that establishes the equality is not necessary. We denotedefinitional equality using the symbol β‘. For example, take the function π : N β N asπ(π₯) β‘ π₯2 (Univalent Foundations Program, 2013). Suppose one wants to compute π(3). Fromthe definition of π , we can conclude that π(3) β‘ 32. Nevertheless, one cannot concludeby definition that π(3) = 9. To conclude that, one needs to conceive a proof π such thatπ : πΌπN(3, 9). Thus, one could establish that 3 is propositionally equal to 9. To denotethat two terms of type π΄ are definitionally equal we use the notation π β‘ π : π΄.
To better grasp the difference between these two kinds of equalities, consider thefollowing example (HARPER, 2012):
Example 2.1. Define addition as following:
πππ :
β§βͺβ¨βͺβ©π+ 0 = π
π+ π (π) = π (π+ π)
Consider π (π₯) as the successor function. We can analyze the following cases:
β’ 2 + 2 β‘ 4 : N (True): First, we have 2 β‘ π (1). From the definition, we have2 + π (1) β‘ π (2 + 1) β‘ π (π (2 + 0)) β‘ π (π (2)) β‘ π (3) β‘ 4.
β’ 0 + π₯ β‘ π₯ : N (False): Since by definition we only have that π₯ + 0 β‘ π₯, we cannotconclude that 0 + π₯ β‘ π₯. One can easily prove that, but since we need a proof toestablish this, this is a propositional equality.
β’ π (π₯) β‘ (1 + π₯) : N (False): We know that π (π₯) β‘ (1 + π₯), but we need to prove thecommutativity of addition to conclude that π₯+ 1 = 1 +π₯. Thus, this equality is notdefinitional.
β’ (π₯+ π¦) β‘ (π¦ + π₯) : N (False): Same case as before.
This example shows the subtle differences between definitional equality and proposi-tional equality. Every time one needs an external evidence, it is a propositional equality.If the result follows directly from a definition, then it is a definitional equality. That way,
Chapter 2. Type Theory 22
even a simple property as commutativity of addition is established by a propositionalequality.
2.1.2 Type Families
In this subsection, our objective is to show that it is possible to simulate the concept ofpredicate in type theory. To understand that, it is useful to consider a simple example.Given π₯ : N, one wants to decide if π₯ is even. The problem is that if you consider a typethat ππ£ππ(π₯), that is inhabited if π₯ is even, the type would depend of the value of π₯. Sincefor every different value of π₯ one creates a new type ππ£ππ(π₯), we say that it is a typefamily indexed by the values of π₯, i.e., indexed by the natural numbers. Thus, in this typefamily, we would have 0 : ππ£ππ(0). Since 1 is odd, ππ£ππ(1) is not inhabited. Thus, everyππ£ππ(2π) is inhabited and every ππ£ππ(2π+ 1) is not.
As one can see, the concept of type families is equivalent to the concept of predicate.One important property of type families is the following: (HARPER, 2012):
π : π΄[π₯ : π΄]
π΅(π₯) type[π/π₯]π΅(π₯) type
Given a type family π΅(π₯) indexed by a type π΄, then if one has a term π : π΄ then onecan obtain the type [π/π₯]π΅(π₯) β‘ π΅(π). We have another important property: (HARPER,2012):
π β‘ π : π΄[π₯ : π΄]
π΅(π₯) typefunctionality [π/π₯]π΅(π₯) β‘ [π/π₯]π΅(π₯) type
This property establishes that if we have a type family indexed by π΄ and two termsπ β‘ π : π΄, then it is intuitive to think that π΅(π) β‘ π΅(π). For example, we know that2+2 β‘ 1+3 β‘ 4 : N. Thus, by functionality, we have ππ£ππ(1+3) β‘ ππ£ππ(2+2) β‘ ππ£ππ(4).
2.1.3 Function Type
In this subsection we are going to introduce the type that represents functions. Givenany two types π΄,π΅, one can build the function type π΄ β π΅. The first type, π΄, is calleddomain of the function and the type π΅ is called codomain. Of course it is also possibleto construct this type using only π΄, obtaining π΄ β π΄. In that case, π΄ is at the sametime the domain and the codomain of the function. In set theory, a function is built as arelation, i.e., pairs of input and output, whereas in type theory a function is understoodas a primitive element of the theory (Univalent Foundations Program, 2013). Since it is a
Chapter 2. Type Theory 23
primitive element, a function must be understood and interpreted by the way of how itis constructed and utilized.
In a function type π : π΄ β π΅, one can apply π in a term π : π΄ to obtain a term π : π΅.In that case, we write the usual notation π(π) = π : π΅. The notation ππ = π : π΅ can alsobe used sometimes. This behavior defines how the function type can be used. We alsoneed to define how a function can be constructed.
There are two main ways of constructing π΄ β π΅ (Univalent Foundations Program, 2013).The first one is to use directly the definitional equality of π(π₯). In that case, π΄ β π΅
is constructed from an expression π(π₯) β‘ π. The necessary conditions are that π₯ musta term of type π΄, i.e., π₯ : π΄ and that π : π΅. The second way is defining a functionusing π notation. In that case, a function is defined using an abstraction ππ₯, obtaining(π(π₯ : π΄).π) : π΄ β π΅. Using this notation, a function application is similar to how is donein π-calculus: (ππ₯.π)(π) β‘ [π/π₯]π.
As a simple example, one can take a π : N β N that has a input π₯ : N and givesπ₯ + 2 : N as output. One can construct this function using the two aforementionedapproaches. First, take the one using definitional equality. One obtain π(π₯) β‘ π₯ + 2 :N β N, with π(π) β‘ π + 2, π : N. The other way is using π notation. One can defineπ = ππ₯.(π₯ + 2) : N β N. If one applies π : N, one winds up with the same result:(ππ₯.(π₯+ 2))(π) β‘ [π/π₯](π₯+ 2) β‘ π+ 2.
It also should be possible to define multivariable functions. In the previous examples,the function received only one input. Nonetheless, it is possible to define functions receiv-ing 2 or more inputs. Take the case of 2 inputs as example: π(π₯, π¦ : N) β‘ π : π . Thisfunction has type π : N Γ N β N. We have not formally defined the symbol Γ yet, buttake it as the usual cartesian product, which can also be defined in the framework of typetheory. Using π notation, one defines π = (ππ₯.ππ¦.π) : N Γ N β N. To define functionswith more than 2 variables, one can use an analogous process.
One important concept of multivariable functions is the existence of a process knownas currying. Currying is a process to transform a function in π variables into π functionsthat receives only one variable, such that the output of those functions is another function(Univalent Foundations Program, 2013). Letβs explain this process in a function of two vari-ables, since one can analogously extend this process to an arbitrary number of variables.Given a function π(π, π) β‘ π, it is possible to transform π into a function that receives onlyπ and has as output another function that receives only π, giving π as the final output.Doing this, the type π : NΓN β N is transformed in an equivalent type π : N β (N β N).Since parenthesis is right-associative, one can write this type as N β N β N.
To a better understanding of this process, letβs take an example. Letβs take a functionπ(π₯, π¦) β‘ π₯+π¦+ 5. Consider the specific case of an application π₯ = 3 and π¦ = 5. Withoutusing currying, one could do π(3, 5) β‘ 3+5+5 β‘ 8+5 β‘ 13. With currying, π(π₯) outputsπ : N β N that receives π¦ as input. In that case, one would have π(3) β‘ ππ¦.(3 + π¦ + 5).
Chapter 2. Type Theory 24
This function receives π¦ = 5 : π(3)(5) β‘ 3 + 5 + 5 β‘ 13. As one could see, the final resultsof these two approaches is exactly the same.
2.1.4 Dependent Function Type(Ξ )
Sometimes the type of the output of a function depends on the value of the input. Usingonly the function type, it is impossible to do this kind of construction. That way, we needto introduce a new function type called dependent function type. To better understandthat, consider a type πππ(π₯) indexed by the natural numbers. A term of type πππ(π₯) canbe seen as a sequence of naturals from 0 to π₯. Now, a problem arises when we try toconstruct a function that receives π : N as input and {0...π} : πππ(π) as output. Sincethe output depends on the value of the input, the previous function type cannot definea function for this case. To indicate that a type is a dependent function, one can use thefollowing notation: Ξ (π₯:π΄)π΅(π₯), where π₯ is the input and π΅(π₯) a type family indexed bythe type π΄. In the previous example of πππ(π₯), one can construct the dependent functionΞ (π₯:N)πππ(π₯). We also have the following inference rules (HARPER, 2012).
π΄ type[π₯ : π΄]
π΅(π₯) type (Ξ β πΉ )Ξ (π₯:π΄)π΅(π₯) type
[π₯ : π΄]π(π₯) : π΅(π₯) (Ξ β πΌ)
π(π₯ : π΄).π(π₯) : Ξ (π₯:π΄)π΅(π₯)
In the case of dependent function formation (Ξ β πΉ ), given a type π΄ and a typefamily π΅(π₯) indexed by this type, it is formed the type Ξ (π₯:π΄)π΅(π₯). The case of dependentfunction introduction (Ξ β πΌ) is also very simple. Given a term π(π₯) : π΅(π₯), with π₯ : π΄,it is possible to obtain a dependent function that receives type π₯ and gives a term of typeπ(π₯) as output. The elimination rule is the following:
π : π΄ π : Ξ (π₯:π΄)π΅(π₯)(Ξ β πΈ)
π.π : [π/π₯]π΅(π₯)
The dependent function elimination (Ξ βπΈ) boils down to an application of a elementπ in the dependent function. The output is very similar to the non-dependent case, thesole difference is the fact that the type of the output depends on the value of the input.We also have a computation rule:
π : π΄[π₯ : π΄]
π(π₯) : π΅(π₯) (Ξ β πΆ)(π(π₯ : π΄).π).π = [π/π₯]π(π₯) : [π/π₯]π΅(π₯)
Chapter 2. Type Theory 25
If one looks closely, the dependent function computation (Ξ βπΆ) establishes functionapplication the exactly way that was defined in non-dependent functions. The sole dif-ference is that the output depends on π₯. With that, we have all necessary rules to defineand compute dependent functions. Also, when working directly with types that representpropositions, one should can semantically interpret a type Ξ (π₯:π΄)π΅(π₯) as β(π₯ : π΄)π΅(π₯).
2.1.5 Product type (Γ)
Previously we have mentioned the existence of multivariable functions, that receives twoor more inputs. But how can we represent a function that, for instance, receives twonatural numbers? In set theory, one could use the cross product to do that. That way,this function receives NΓN as input. In this sense, it is essential to define cross productin the framework of type theory.
Intuitively, for any types π΄ and π΅ one should be able to construct the type π΄ Γ π΅.A term of π΄ Γ π΅ is a pair (π, π) : π΄ Γ π΅, with π : π΄ and π : π΅. This is formalized in thefollowing rules (QUEIROZ; OLIVEIRA; GABBAY, 2011):
π΄ type π΅ type (Γ β πΉ )π΄Γπ΅ type
π : π΄ π : π΅ (Γ β πΌ)(π, π) : π΄Γπ΅
If one looks closely, if π΄ and π΅ are propositions, π΄Γ π΅ can be interpreted as π΄ β§ π΅.That way, one should be able to infer π΄ and π΅ from π΄ Γ π΅. To do that, we introducefunctions πΉππ and πππ· (QUEIROZ; OLIVEIRA; GABBAY, 2011):
β¨π, πβ© : π΄Γπ΅ (Γ β πΈ1)πΉππ ((π, π)) : π΄
(π, π) : π΄Γπ΅ (Γ β πΈ2)πππ·((π, π)) : π΅
Using πΉππ and πππ· functions, we want to be able to retrieve the first and sec-ond elements of a pair β¨π, πβ© respectively. Thus, we have the following computation rules(QUEIROZ; OLIVEIRA; GABBAY, 2011):
(π, π) : π΄Γπ΅ Γ β πΈ1 Bπ½ π : π΄πΉππ ((π, π)) : π΄
(π, π) : π΄Γπ΅ Γ β πΈ2 Bπ½ π : π΄πππ·((π, π)) : π΅
The above rules are called Γ-reductions. We also have another computation rule calledΓ-induction (QUEIROZ; OLIVEIRA; GABBAY, 2011):
Chapter 2. Type Theory 26
π : π΄Γπ΅ Γ β πΈ1πΉππ (π) : π΄
π : π΄Γπ΅ Γ β πΈ2πππ·(π) : π΅ Γ β πΌ Bπ π : π΄Γπ΅
(πΉππ (π), πππ·(π)) : π΄Γπ΅
2.1.6 Coproduct (+)
In the previous subsection we have introduced the product type. We saw that Γ can beseen semantically as a cross product in set theory and the connector β§ when dealing withpropositions. Thus, it is natural to think that the dual of the product should also be ableto be formalized in type theory. That is what we do in this section. In set theory, thecoproduct represents the disjoint union. If one is working with propositions, the coproductcan be semantically interpreted as the connector β¨.
In the product, we have seen that from a term of π΄Γπ΅ one should be able to obtainterms of π΄ and π΅ by separate processes. Since the coproduct work as the dual of theproduct, then it is natural to think that one should be able to obtain a term of π΄ + π΅
from a term of π΄ or a term of π΅. That is exactly what happens (QUEIROZ; OLIVEIRA;
GABBAY, 2011):
π΄ type π΅ type (+ β πΉ )π΄+π΅ type
π : π΄ (+ β πΌ1)πππ(π) : π΄+π΅
π : π΅ (+ β πΌ2)πππ(π) : π΄+π΅
The elimination rule follows directly from the fact that if one from π : π΄ is able toconstruct a term π(π) : πΆ and from π : π΅ we also construct π(π) : πΆ, then we should beable to construct one term of type πΆ directly from a term π : π΄+π΅ (QUEIROZ; OLIVEIRA;
GABBAY, 2011):
π : π΄+π΅
[π : π΄]π(π) : πΆ
[π : π΅]π(π) : πΆ (+ β πΈ)
πΆπ΄ππΈ(π, οΏ½ΜοΏ½π(π), οΏ½ΜοΏ½π(π)) : πΆ
One should see π(π) and π(π) as functional expressions dependent on π and π respec-tively. One should also notice the use of βΜ β in οΏ½ΜοΏ½ and οΏ½ΜοΏ½. One should see βΜ β as an abstractorthat binds the occurrences of the variable π and π both introduced in the local assump-tions. We have the following reduction rules (QUEIROZ; OLIVEIRA; GABBAY, 2011):
π : π΄πππ(π) : π΄+π΅
[π : π΄]π(π) : πΆ
[π : π΅]π(π) : πΆ (+ β πΈ) Bπ½
πΆπ΄ππΈ(πππ(π), οΏ½ΜοΏ½π(π), οΏ½ΜοΏ½π(π)) : πΆ
[π : π΄][π/π₯]π(π) : πΆ
Chapter 2. Type Theory 27
π : π΅πππ(π) : π΄+π΅
[π : π΄]π(π) : πΆ
[π : π΅]π(π) : πΆ (+ β πΈ) Bπ½
πΆπ΄ππΈ(πππ(π), οΏ½ΜοΏ½π(π), οΏ½ΜοΏ½π(π)) : πΆ
[π : π΅][π/π₯]π(π) : πΆ
We also have an induction rule (QUEIROZ; OLIVEIRA; GABBAY, 2011):
π : π΄+π΅
[π : π΄] + β πΌ1πππ(π) : π΄+π΅
[π : π΅] + β πΌ2πππ(π¦) : π΄+π΅ + β πΈ Bπ
πΆπ΄ππΈ(π, Β΄(π)πππ(π), οΏ½ΜοΏ½πππ(π)) : π΄+π΅π : π΄+π΅
2.1.7 Dependent Pair Type (Ξ£)
When working with functions, it is sometimes useful to work with ordered pairs (π, π)such that π is a input for the function and π is the respective output. But what happensif one is working with a dependent function? In that case, the type of the output πwould be bounded to the value of the input π. To represent this, one needs to use a typecalled dependent pair. The notation for this type is Ξ£(π₯:π΄)π΅(π₯) and it has the followingrules(HARPER, 2012):
π΄ type[π₯ : π΄]
π΅(π₯) type (Ξ£ β πΉ )Ξ£(π₯:π΄)π΅(π₯) type
π : π΄ π : π΅(π) (Ξ£ β πΌ)β¨π,πβ© : Ξ£(π₯:π΄)π΅(π₯)
The dependent sum formation (Ξ£ β πΉ ) is similar to Ξ β πΉ . For dependent sum intro-duction (Ξ£ β πΌ), an element π : π΄ and an element π : π΅(π) are enough to introduce adependent pair β¨π,πβ© : Ξ£(π₯:π΄)π΅(π₯). We have two elimination rules:
π : Ξ£(π₯:π΄)π΅(π₯)(Ξ£ β πΈ1)
π1(π) : π΄
π : Ξ£(π₯:π΄)π΅(π₯)(Ξ£ β πΈ2)
π2(π) : [π1(π)/π₯]π΅(π₯)
In traditional type theory, the dependent pair has two eliminations. This is explainedby the fact that since the pair is composed by two terms, it is possible to eliminateΞ£ obtaining the first or the second term. From a dependent pair, one can use the firstdependent sum elimination (Ξ£ β πΈ1) and extract the first element. From the seconddependent sum elimination (Ξ£ β πΈ2) one can extract the second element, which typedepends on the value of the first element. Thus, we have two computation rules:
Chapter 2. Type Theory 28
π1(β¨π,πβ©) = π e π2(β¨π,πβ©) = π.
The operators π1 and π2 extract the necessary information from the dependent pair.One obtains π and π respectively. The dependent pair should be understood as the dualof the dependent product.
2.1.8 Alternative Formulation for the Dependent Pair
If one is working within the paradigm of formulae-as-types(HOWARD, 1980), the depen-dent product should be semantically interpreted as the β quantifier. Nevertheless, it hasbeen pointed out by(QUEIROZ; GABBAY, 1995) that the previous formulation for the de-pendent pair leads to problems. The main issue is the fact that the previous formulationdoes not βhideβ the witness in an existential formula. One can apply directly π1 to adependent pair, obtaining the witness and ignoring the fact that it should be hidden.Thus,(QUEIROZ; GABBAY, 1995) argues that this βavailabilityβ does not match with thetrue spirit of indefiniteness of the existential qualifier. To better see this, one could con-sider the fact that the duality between the existential and universal quantifiers are thefirst-order counterpart of the duality between the disjunction and the conjunction. In thelanguage of type theory, when one talks about conjunction one is really talking aboutΓ-product. In the Γ-product, the terms of a pair are readily available:
π : π΄ π : π΅ Γ β πΌ(π, π) : π΄Γπ΅Γ β πΈ1
πΉππ ((π, π)) : π΄
π : π΄ π : π΅ Γ β πΌ(π, π) : π΄Γπ΅Γ β πΈ2
πππ·((π, π)) : π΅
In the case of the disjunction, i.e., the coproduct in type theory, once one of thedisjuncts is used to construct a term of the coproduct, it becomes βhiddenβ, the elimina-tion rule has to proceed by Skolem-like introductions of new local assumptions(QUEIROZ;
GABBAY, 1995):
π : π΄ + β πΌπππ(π) : π΄+π΅
[π₯ : π΄]π(π₯) : πΆ
[π¦ : π΅]π(π¦) : πΆ + β πΈ1
πΆπ΄ππΈ(πππ(π), οΏ½ΜοΏ½π(π₯), π¦π(π¦))
π : π΅ + β πΌπππ(π) : π΄+π΅
[π₯ : π΄]π(π₯) : πΆ
[π¦ : π΅]π(π¦) : πΆ + β πΈ2
πΆπ΄ππΈ(πππ(π), οΏ½ΜοΏ½π(π₯), π¦π(π¦))
In the first case, one has π : π΄ in the start, but after introducing πππ(π) : π΄ + π΅, πbecomes hidden, i.e., one loses direct access to it. The same thing happens to π : π΅ andπππ(π) : π΄ + π΅ in the second case. Thus, one proceeds adding local assumptions π₯ : π΄and π¦ : π΅. With that in mind, (QUEIROZ; GABBAY, 1995) showed that the existential
Chapter 2. Type Theory 29
should mirror this aspect. The witness should be hidden and one should proceed byintroducing Skolem-like local assumptions. Thus, the elimination rule for the dependentpair is reformulated (QUEIROZ; GABBAY, 1995):
π : Ξ£(π₯:π΄)π΅(π₯)[π‘ : π΄, π(π‘) : π΅(π‘)]
β(π‘, π) : πΆ(Ξ£ β πΈ)
πΈ(π, π‘πβ(π‘, π)) : πΆ
This elimination rule eliminates the dependent pair without giving direct access tothe witness. Of course, it generates new computation rules. Here follows the reductionrule(QUEIROZ; GABBAY, 1995):
π : π· π(π) : πΉ (π)Ξ£ β πΌβ¨π, π(π)β© : Ξ£(π₯:π·)πΉ (π₯)
π‘ : π·, π(π‘) : πΉ (π‘)π(π, π‘) : πΆ
Ξ£ β πΈ Bπ½πΈ(β¨π, π(π)β© , ππ‘π(π, π‘)) : πΆ
[π΄ : π·, π(π) : πΉ (π)][π/π, π/π‘]π(π, π‘)
The last rule is the induction(QUEIROZ; GABBAY, 1995):
π : Ξ£(π₯:π·)π (π₯)[π‘ : π·] [π(π‘) : π (π‘)]
Ξ£ β πΌβ¨π‘, π(π‘)β© : Ξ£(π¦:π·)π (π¦)Ξ£ β πΈ Bπ π : Ξ£(π₯:π·)π (π₯)
πΈ(π, ππ‘ β¨π‘, π(π‘)β©) : Ξ£(π¦:π·)π (π¦)
2.1.9 The Natural Numbers
It has been said that one of the main objectives that motivated type theory was thefact that it worked as a foundation for constructive mathematics. Thus, a theory thatproposes to be a foundation for mathematics should at least be able to formalize thenatural numbers. Set theory, for example, is capable of doing that. Thus, the objective ofthis subsection is to show how the natural numbers can be constructed in type theory andto show some basic properties of the naturals. As always, we start with basic constructions:(HARPER, 2012):
(Nβ πΌ0)0 : Nπ : N (Nβ πΌπ )
π π’ππ(π) : N
Chapter 2. Type Theory 30
The natural are constructed in a simple way, from the two rules above. The zerointroduction (Nβ πΌ0) should be understood as the base of the construction. It states theexistence of at least one term called 0 that is a term of N. From a term π : N, one canapply the successor induction (NβπΌπ ) to obtain another term of type π π’ππ(π) : N. Thus, ifone starts from 0 and inductively construct numbers applying π π’ππ, one wind up with theentire set of natural numbers. Nevertheless, those two rules does not give us the tools towork with the natural numbers. Ideally, one wants to construct functions on the naturalsand also apply the inductive principle to construct proofs. Those tools are given by thecomputation rules. Letβs start with the non-dependent case (HARPER, 2012):
π : N πΆ type π0 : πΆ[π₯ : πΆ]ππ : πΆ
πππ(π,π0, ππ₯.ππ ) : πΆ
The inference rule above can be rather confusing. The idea is to use a recursor πππ todefine basic functions on the naturals, such as addition, multiplication and exponentiation.The recursor receives a base case π0, that states how πππ should act when it iterates 0times. Another piece of information is that given π₯ iterations, the recursor needs to knowhow to compute the next iteration. This next iteration is represented by ππ . Thus, basedon the inductive definition of the naturals, this is enough to define how any function on thenaturals works. To better illustrate that, letβs use πππ to define addition. Given π,π : N,we want π+π : N. Starting from π, one can define the base case to be π+0 = π. Thus,one just needs to iterate π times the function π π’ππ starting from π. This is expressed asfollowing:
π : N N type π : N[π : N]
π π’ππ(π) : Nπππ(π,π, ππ.π π’ππ(π)) : N
ππ.πππ(π,π, ππ.π π’ππ(π)) : N β N
This rule used to define recursive functions on the naturals is called the non-dependentcase, since it originates terms of a non-dependent type πΆ. To use the induction principle,one needs to define the dependent case (HARPER, 2012):
π : N[π₯ : N]
πΆ(π₯) type π0 : [0/π₯]πΆ(π₯)[π₯ : N, π¦ : πΆ(π₯)]
ππ : [π π’π(π₯)/π₯]πΆ(π₯)πππ(π,π0, (π₯, ππ¦.ππ )) : [π/π₯]πΆ(π₯)
If one looks closely, one should notice that the non-dependent case is the inductionprinciple of the natural numbers. Basically, it states that given a proof of the base case
Chapter 2. Type Theory 31
π0 : πΆ(0) and the inductive step, i.e., that a proof π¦ : πΆ(π₯) implies a proof of ππ : πΆ(π₯+1),then one should wind up with a proof πΆ(π) for any π : N. With that, we conclude theconstruction and main properties used to work with the naturals in type theory.
2.1.10 Additional Information
We have said that a type can be semantically interpreted in different ways. It can be aproposition, a topological space, a set, among others semantical interpretation. The mainones are summed up in the table below:
Table 1 β Multiple semantical interpretations of a type
Types Logic Sets Homotopyπ΄ proposition set spaceπ : π΄ proof element pointπ΅(π₯) predicate family of sets fibrationπ(π₯) : π΅(π₯) conditional proof family of elements section0,1 β₯,β€ β , {β } β , *π΄ + π΅ π΄ β¨ π΅ disjoint union coproductπ΄ Γ π΅ π΄ β§ π΅ set of pairs product spaceπ΄ β π΅ π΄ β π΅ set of functions function spaceΞ£π₯:π΄π΅(π₯) β(π₯:π΄)π΅(π₯) disjoint sum total spaceΞ π₯:π΄π΅(π₯) β(π₯:π΄)π΅(π₯) product space of sectionsπΌππ equality = {(π₯, π₯) | π₯ β π΄} path space π΄πΌ
Source: Homotopy Type Theory Book (Univalent Foundations Program, 2013).
As one can see, type theory is capable of representing many diverse objects of mathe-matics and logic. In the previous subsections, we have shown the basic constructions thateveryone interested in type theory should be familiar with. Nevertheless, we have nottalked about the identity type yet. Since it is a type of central to the main contributionof this work, the next section is completely focused on explaining it.
2.2 IDENTITY TYPE
After briefly introducing the main concepts and types of type theory, the objective of thissection is to introduce the main entity of this work, the identity type. Here we are goingto introduce the classic approach of type theory. One can check our proposed formulationfor the identity type in chapter 4 of this work.
The identity type is arguably the most interesting concept of type theory. This claimis based on the fact that many results have been achieved using it. One of these wasthe discovery of the Univalent Models in 2005 by Vladimir Voevodsky (VOEVODSKY,2014). From this work, a groundbreaking result has arisen: the connection between type
Chapter 2. Type Theory 32
theory and homotopy theory. The intuitive connection is simple: a term π : π΄ can beconsidered as a point of the space π΄ and π : πΌππ΄(π, π) is a homotopy path between pointsπ, π β π΄(Univalent Foundations Program, 2013). This has given rise to a whole new area ofresearch, known as Homotopy Type Theory. It leads to a new perspective on the study ofequality, as expressed by Voevodsky in a recent talk in The Paul Bernays Lectures (Sept2014, ZΓΌrich): equality (for abstract sets) should be looked at as a structure rather thanas a relation.
2.2.1 Formal Definition of The Identity Type
We start with the formation and introduction rules (QUEIROZ; OLIVEIRA, 2014b):
π΄ type π : π΄ π : π΄πΌππππ‘ β πΉ
πΌππππ‘π΄ (π, π) type
π : π΄πΌππππ‘ β πΌ
π(π) : πΌππππ‘π΄ (π, π)
First, we need to clarify the meaning of πππ‘ that appears in πΌππππ‘. This πππ‘ indicatesthat we are working with the intensional version of the identity type. The differencebetween the intensional and extensional version will be explained in detail in the nextsubsection. For now, letβs postulate that every time πππ‘ or ππ₯π‘ do not appear above πΌππ΄,one should assume that the version being used is the intensional one.
The identity type formation (πΌππππ‘ β πΉ ) is pretty straightforward. Given any termsπ, π : π΄, it is possible to create a type that will only be inhabited if there exits an witnessthat testifies the propositional equality between π and π. Nevertheless, the existence oftype πΌππ΄(π, π) does not dependent on whether it is inhabited or not.
The rule identity type introduction (πΌππππ‘ β πΌ) states that there is only one canonicalproof of equality, the reflexivity. It states that any term π : π΄ is always propositionalequal to itself. This introduces a canonical proof of reflexivity π(π) : πΌππππ‘
π΄ (π, π). Thus, themain idea is that every proof of equality can be constructed inductively from a reflexiveproof of equality (QUEIROZ; OLIVEIRA, 2014b):
π : π΄ π : π΄ π : πΌππππ‘π΄ (π, π)
[π₯ : π΄]π(π₯) : πΆ(π₯, π₯, π(π₯))
[π₯ : π΄, π¦ : π΄, π§ : πΌππ΄(π₯, π¦)]πΆ(π₯, π¦, π§) type
πΌπβ πΈπ½(π, π) : πΆ(π, π, π)
π : π΄[π₯ : π΄]
π(π₯) : πΆ(π₯, π₯, π(π₯))[π₯ : π΄, π¦ : π΄, π§ : πΌππ΄(π₯, π¦)]
πΆ(π₯, π¦, π§) typeπΌπβ πΈπ
π½(π(π), π(π₯)) = π(π/π₯) : πΆ(π, π, π(π))
Chapter 2. Type Theory 33
The identity type elimination (πΌπ β πΈ) introduces the recursor π½ and eliminates theidentity type in the process. The inner details of the recursor π½ are pretty complicatedto understand and uses complex concepts of category theory. Nevertheless, one can tryto intuitively understand π½ . Basically, π½(π, π) : πΆ(π, π, π) works constructing π from areflexive proof π. In this case, as any recursor of type theory, π is constructed based onmultiple iterations that starts from the base π. Since this elimination rule has many terms,constructing some types using π½ can be a cumbersome process, as we are going to seein the next subsection. In this work, we are going to introduce a way of formalizing theidentity type using a new entity known as computational paths. We believe that this wayis simpler and more straightforward to use than the one introduced here. Nevertheless,we leave this discussion to a further chapter of this work.
2.2.2 Basic Constructions
The objective of this subsection is to show the use of the elimination rule of the identitytype in practice. The constructions that we have chosen to build are the reflexive, transitiveand symmetric type of the identity type. Those were not random choices. The main reasonis the fact that reflexive, transitive and symmetric types are essential to the process ofbuilding a groupoid model for the identity type (HOFMANN; STREICHER, 1994).
Before we start the constructions, we think that it is essential to understand how to usethe eliminations rules. The process of building a term of some type is a matter of findingthe right reason. In the case of π½ , the reason is the correct π₯, π¦ : π΄ and π§ : πΌππ΄(π, π) thatgenerates the adequate πΆ(π₯, π¦, π§).
We start proving the reflexivity. We want a witness for Ξ (π:π΄)πΌππ΄(π, π). This case istrivial, since we have the canonical proof of identity:
π : π΄ πΌπβ πΌπ(π) : πΌππ΄(π, π)
The second construction is the symmetry. This one does not follow trivially from theintroduction rule. Thus, we need to use the elimination rule in some way. Our objectiveis to construct a term for the type Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π)).
Looking at the elimination rule of the constructor J, it is clear that our main objectiveis to find a suitable πΆ(π₯, π¦, π§), with π₯ : π΄, π¦ : π΄ and π§ : πΌππ΄(π, π). The main problem isthe fact that, to find the correct reason, we do not have a fixed process or a fixed set ofrules to follow. One needs to rely on oneβs intuition. In this case, one could conclude thatthe correct reason is to look at πΆ(π₯, π¦, , π§) as the type πΌππ΄(π¦, π₯), with π₯ : π΄, π¦ : π΄ and π§
as any term (in the deduction, π§ will be represented by β, to indicate that it can be anyterm). Thus, we obtain the following deduction:
Chapter 2. Type Theory 34
π : π΄ π : π΄ π : πΌππ΄(π, π)[π₯ : π΄]
π(π₯) : πΌππ΄(π₯, π₯)[π₯ : π΄, π¦ : π΄,β : πΌππ΄(π, π)]
πΌππ΄(π¦, π₯) typeπΌπβ πΈ
π½(π, π(π₯)) : πΌππ΄(π, π)β βπΌ
ππ.π½(π, π(π₯)) : πΌππ΄(π, π) β πΌππ΄(π, π)Ξ β πΌ
ππ.ππ.π½(π, π(π₯)) : Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))Ξ β πΌ
ππ.ππ.ππ.π½(π, π(π₯)) : Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))
The third and last construction will be the transitivity. Our objective is to constructa term for the type Ξ (π:π΄)Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π) β πΌππ΄(π, π)).
Letβs now use π½ to build a term for the transitivity. The proof will be based on theone found in (Univalent Foundations Program, 2013). The difference is that instead of defininginduction principles for π½ based on the elimination rules, we will use the rule directly.The complexity is the same, since the proofs are two forms of presenting the same thingand they share the same reasons. As one should expect, the first and main step is tofind a suitable reason. In other words, we need to find suitable π₯, π¦ : π΄ and π§ : πΌππ΄(π, π)to construct an adequate πΆ(π₯, π¦, π§). Similar to the case of symmetry, this first step isalready problematic. Different from our approach, in which one starts from a path andapplies intuitive equality axioms to find a suitable reason, there is no clear point of howone should proceed to find a suitable reason for the construction based on π½ . In thiscase, one should rely on intuition and make attempts until one finds out the correctreason. As one can check in (Univalent Foundations Program, 2013), a suitable reason wouldbe π₯ : π΄, π¦ : π΄,β : πΌππ΄(π₯, π¦) and πΆ(π₯, π¦, π§) β‘ πΌππ΄(π¦, π) β πΌππ΄(π₯, π). Looking closely,the proof is not over yet. The problem is the type of πΆ(π₯, π₯, π(π₯)). With this reason,we have that πΆ(π₯, π₯, π(π₯)) β‘ πΌππ΄(π₯, π) β πΌππ΄(π₯, π). Therefore, we cannot assume thatπ(π₯) : πΌππ΄(π₯, π) β πΌππ΄(π₯, π) is the term π(π₯). The only way to proceed is to apply againthe constructor π½ to build the term π(π₯). It means, of course, that we will need to find yetanother reason to build this type. This second reason is given by π₯ : π΄, π¦ : π΄,β : πΌππ΄(π₯, π¦)and πΆ β²(π₯, π¦, π§) β‘ πΌππ΄(π₯, π¦). In that case, πΆ β²(π₯, π₯, π(π₯)) = πΌππ΄(π₯, π₯). We will not need touse π½ again, since now we have that π(π₯) : πΌππ΄(π₯, π₯). Then, we can construct π(π₯):
π₯ : π΄ π : π΄ π : πΌππ΄(π₯, π)[π₯ : π΄]
π(π₯) : πΌππ΄(π₯, π₯)[π₯ : π΄, π¦ : π΄,β : πΌππ΄(π₯, π¦)]
πΌππ΄(π₯, π¦) typeπΌπβ πΈ
π½(π, π(π₯)) : πΌππ΄(π₯, π)β βπΌ
ππ.π½(π, π(π₯)) : πΌππ΄(π₯, π) β πΌππ΄(π₯, π)
Finally, we obtain the desired term:
Chapter 2. Type Theory 35
π:π΄
π:π΄
π:πΌπ
π΄(π,π
)[π₯
:π΄]
ππ.π½
(π,π
(π₯))
:πΌπ
π΄(π₯,π
)βπΌπ
π΄(π₯,π
)[π₯
:π΄,π¦
:π΄,β
:πΌπ
π΄(π₯,π¦
)]πΌπ
π΄(π¦,π
)βπΌπ
π΄(π₯,π
)ty
peπΌπ
βπΈ
π½(π,ππ.π½
(π,π
(π₯))
):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)β
βπΌ
ππ.π½
(π,ππ.π½
(π,π
(π₯))
):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)Ξ
βπΌ
ππ.ππ.π½
(π,ππ.π½
(π,π
(π₯))
):Ξ
(π:π΄
)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ.π½
(π,ππ.π½
(π,π
(π₯))
):Ξ
(π:π΄
)Ξ (π
:π΄)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ.ππ.π½
(π,ππ.π½
(π,π
(π₯))
):Ξ
(π:π΄
)Ξ (π
:π΄)Ξ
(π:π΄
)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))
Chapter 2. Type Theory 36
This construction is an example that makes clear the difficulties of working withthis approach for the identity type. We had to find two different reasons and use twoapplications of the elimination rule. Another problem is the fact that the reasons werenot obtained by a fixed process, like the applications of axioms in some entity of typetheory. They were obtained purely by the intuition that a certain πΆ(π₯, π¦, π§) should becapable of constructing the desired term. For that reason, obtaining these reasons can betroublesome.
Further in this work we are going to construct those types using computational paths.Thus, we will have some base on which we can compare the two approaches.
2.2.3 Extensionality vs Intensionality
We have seen that functions are extensional in set theory. Functions are considered as pairsof input and output. The way of how those pairs were obtained is ignored completely. Thisdoes not occurs on the aforementioned formulation of the identity type. In that case, theproof of how the equality has been obtained matters. That is the reason way we saidthat this approach is intensional. In the original formulation of type theory, Martin-LΓΆfproposed an intensional approach (MARTIN-LΓF, 1998) and an extensional one (MARTIN-
LΓF, 1982; MARTIN-LΓF, 1984). Since we have already shown the construction of theintensional approach, we show the construction of the extensional one in this subsection.We have the following rules (QUEIROZ; OLIVEIRA; RAMOS, 2016):
π΄ type π : π΄ π : π΄πΌπππ₯π‘ β πΉ
πΌπππ₯π‘π΄ (π, π) type
π = π : π΄πΌπππ₯π‘ β πΌ
π : πΌπππ₯π‘π΄ (π, π)
The extensional identity type formation (πΌπππ₯π‘ β πΉ ) is completely equal to the inten-sional case. The extensional identity type introduction (πΌπππ₯π‘ β πΌ) is also very simple. Ifwe have that π = π : π΄, then one has for sure at least one proof π that establishes thisequality. Naturally, π has type πΌπππ₯π‘
π΄ (π, π). We have now the elimination and equality rules(QUEIROZ; OLIVEIRA; RAMOS, 2016):
π : πΌπππ₯π‘π΄ (π, π)
πΌπππ₯π‘ β πΈπ = π : π΄
π : πΌπππ₯π‘π΄ (π, π)
πΌπππ₯π‘ β πΈππ = π : πΌπππ₯π‘
π΄ (π, π)
The first thing one should notice is that extensional identity type elimination (πΌπππ₯π‘ βπΈ) is much simpler than the intensional version. One does not need to define over-complicated structures like π½ . Given any element πΌπππ₯π‘
π΄ (π, π), since we do not need to
Chapter 2. Type Theory 37
keep track of the equality proof, one can extract directly that π = π : πΆ. At this point,the information that π is responsible for establishing is irrelevant. As one can see, theexistence of the term π is completely excluded of the final inference. The fact that we donot need to keep track of an equality proof is also seen in the extensional identity typeequality (πΌπππ₯π‘ β πΈπ). This rule shows that any two equality proofs π and π are equal.Thus, how π and π are constructed does not matter. The only relevant fact is that theyare both proofs of the equality π = π : π΄.
The approach that we are going to propose based on computational paths will beclearly intensional. This is due to the fact that computation is intrinsically intensional.Two algorithms can solve the same problem, but they can be implemented in completelydifferent ways and have difference space and time complexities. Also, the intensional ver-sion is much more interesting, since it gave rise to homotopy type theory. Thus, this workwill introduce computational paths as an alternative way of formalizing the intensionaltype theory.
2.3 CONCLUSION
In this chapter, we have introduced the basic types of type theory. We showed how toconstruct and compute using those types. We have also highlighted the essential differ-ence between definitional equality and propositional equality. Based on this difference, weshowed how to construct a type based on propositional equality, called identity type.
A good understanding of the basic concepts of this chapter is essential to understandthe main results of this work. In further chapters, we are going to propose a differentway of formalizing intensional identity type. We are going to compare the two approachesusing the basic constructions shown in this chapter. In the next chapter, we are goingto introduce the basic concepts of another theory essential to the results of this work:category theory.
38
3 CATEGORY THEORY
In this chapter, we introduce the theory that we are going to use to develop the math-ematical aspect of computational paths. The theory used to construct this mathematicalmodel will be category theory. We are going to see that this theory is extremely powerful,but it is abstract and complex. With that in mind, we start this chapter defining and ex-posing the main basic concepts of this theory. We then use those basic concepts to arriveat more complicated results, which will be necessary in the construction of our mathemat-ical model for computational paths. Since this model has many details and peculiarities,we leave it to the next chapter of this work.
Category theory appeared for the first time in the works of Eilenberg & Mac Lanein 1945. It was originally proposed as just a tool to study natural transformations andfunctors(MARQUIS, 2014). Functors and natural transformations are basically entities thattransform one mathematical structure into another. For instance, one can transform afunction between sets into a homotopy between topological spaces. Despite being proposedas only a tool, category theory grew quickly and became a well-established theory. Today,it is widely used in mathematics and computer science. Even logic and π-calculus can bemodeled by category theory. It also has been used as foundation of mathematics in placeof ππΉπΆ (MARQUIS, 2014).
Despite its power of abstraction, category theory does not hinder the importance oftype theory. It can be used as a foundation for mathematics, but it shares some problemsthat appears in ZFC, such as the fact that it is hard to be modeled by computers. Thus,the importance of category theory to this work is limited to the fact that it is closelyrelated to type theory. This fact is clear when one realizes that many type theoreticalconstructions can be mathematically modeled using category theory.
It is also important to note that this chapter is not limited to basic category theory. Toobtain the results that we want about computational paths, one also needs to define somebasic concepts of higher category theory. Thus, we are going to introduce those conceptsin the end of this chapter.
3.1 BASIC CONCEPTS
Category theory has a rather interesting aspect when compared directly with set theoryor type theory. It is the fact that set theory and type theory have a fundamental conceptin the core of those theories. One gains nothing asking what is the exact definition of setsor types, but one can ask what results can be obtained from those concepts. In category
Parts of this chapter are based on previous research done by the author and appears in his MasterβsThesis (RAMOS, 2015)
Chapter 3. Category Theory 39
theory, this does not happen. It is possible to prove from rules and well-established entitieswhether some structure is a category or not. Perhaps the best way of introducing categorytheory is to analyze some aspects of functions. The reason for that is that one can affirmthat a category is constructed based on structures called morphisms that are very similarto functions.
Consider that we have sets π΄, π΅ and πΆ and functions π and π such that π : π΄ β π΅
and π : π΅ β πΆ. Thus, it is possible to construct a composite function (π β π) : π΄ β πΆ
defined by (π β π) = π(π(π₯)). We have the following diagram:
π΄ π΅
πΆ
π
πβππ
One should become acquainted with those kinds of diagrams, since they commonlyappear in category theory. Categories are based on objects (in the above diagrams, theobjects are sets) and arrows or morphisms (in the above diagram, the functions). Thus, itis natural to think that those structures are represented by diagrams. They are not justa graphic representation of some structure, since they are frequently used as the mainargument in proofs of important properties.
One interesting property rises from function composition: it is associative. In otherwords, if there is some β : πΆ β π·, then (β β π) β π = β β (π β π). This property isrepresented by the following diagram (AWODEY, 2010):
π΄ π΅
πΆ π·
π
πβππ
ββπ
β
Functions have another interesting property. For any set π΄, there is a identity function1π΄ : π΄ β π΄ defined by 1π΄(π) = π. This function can be considered as the neutral elementof the composition operation, i.e. 1π΅ β π = π = π β 1π΄. In the next subsection we givea formal definition for the concept of category, which will give general versions of thoseproperties.
3.1.1 Categories
Category is the main concept of category theory. Its definition follows:
Definition 3.1 (Categories (AWODEY, 2010)). A category C is a structure with the fol-lowing elements and rules:
Chapter 3. Category Theory 40
β’ Objects: Objects are usually represented by capital letters π΄,π΅,πΆ.... The class of allobjects is called πΆ0.
β’ Arrows(morphisms): Arrows or morphisms are commonly represented by letters whichare used to represent functions, such as π, π, β.... It is importance to notice that ar-rows always appear between two objects. The class of all arrows is called πΆ1.
β’ Domain and range: Given any arrow π : π΄ β π΅, the domain of π is π΄ and iswritten as πππ(π) = π΄. The range of π is π΅ and is written as πππ(π) = π΅.
β’ Composition: Given any arrows π : π΄ β π΅ and π : π΅ β πΆ, there is always anarrow β = (π β π) : π΄ β πΆ. This arrow is the composition of π and π. Moreover, βhas a universal property, i.e., given any π = (π β π), then π = β.
β’ Identity Arrow: For any object π΄ there is an arrow 1π΄ : π΄ β π΄ called identity arrow.
β’ Associativity rule: Given any arrows π : π΄ β π΅, π : π΅ β πΆ and β : πΆ β π·, then(β β π) β π = β β (π β π) always holds.
β’ Identity rule: Given any π : π΄ β π΅, then 1π΅ β π = π = π β 1π΄.
From the above definition, it is clear that a function has a categorical structure. Infact, one of the most common category is Sets. In this category, objects are sets andarrows are functions between sets. As we have just seen, a function follows associativeand identity rules and thus, Sets is clearly a category. Before we define further concepts,it is important to show the use of the above definition in another example. An interestingone is the structure Pos. As we have seen in chapter 1, a set can be ordered by an orderrelation β€. Those ordered sets are known as posets (partially ordered sets). That way, anobject in this structure is a poset and an arrow is a monotone function (AWODEY, 2010).A function is monotone iff π β€ π β π(π) β€ π(π).
Proposition 3.1. Pos is a category.
Proof. A proof that some structure is a category follows a well-defined set of steps. Ini-tially, it is necessary to define what is an arrow, the compositions and the identity arrow.Then, one just needs to check if the rules of associativity and identity hold.
β’ Composition: The composition is similar to the one given in Sets, i.e., given anyπ : π΄ β π΅ and π : π΅ β πΆ, then one can define (π β π) = π(π(π₯)). In the caseof Pos, (π β π) needs to be monotone. Suppose that π β€ π. Since π is monotone,then π(π) β€ π(π). Since π is monotone, then π(π(π)) β€ π(π(π)) and thus, π β π ismonotone.
Chapter 3. Category Theory 41
β’ Identity: The identity arrow will also be similar to the one in Sets, i.e., the identityarrow will be an 1π΄ : π΄ β π΄ defined by 1π΄(π) = π. 1π΄ is clearly monotone, sinceπ β€ π then 1π΄(π) = π β€ π = 1π΄(π).
β’ Associativity rule: Since arrows are functions, the associative rule clearly holds.
β’ Identity rule: Analogous to the associative rule. It has already proved for functionsthat 1π΄ respects the identity rule.
Therefore Pos is a category. Our choice of Pos as an example was intentional, sinceit is a category of great importance to computer science. The reason for that is the factthat Pos is used on the formalization of boolean algebra. Nevertheless, this formalizationis out of the scope of this work. After introducing the concept of category, we can proceedwith other interesting concepts.
3.1.2 Isomorphism
In many areas of mathematics it is rather common to work with two different structuresthat have similar properties. Sometimes one wants to establish a direction connectionbetween those structures. To do this, one establishes an isomorphism. The main problemis that the definition of isomorphism is intrinsically dependent to the structure being used.For example, the concept of isomorphism between sets is different to isomorphism betweenposets, which is different from an isomorphism between groups. Thus, the unification ofthose different definitions for the same concept would be a great feat. Fortunately, thiscan be easily done in category theory. It also showcases how powerful is this theory. Wehave the following definition:
Definition 3.2 (Isomorphism (AWODEY, 2010)). : In a category C, an arrow π : π΄ β π΅
is called isomorphism if there exists an arrow π : π΅ β πΆ such that π β π = 1π΄ andπ β π = 1π΅. When this happens, π is called inverse of π . We say that π΄ is isomorphicto π and the write π΄ βΌ= π΅. The arrow that generated this isomorphism is written as:π : π΄ βΌββ π΅.
Proposition 3.2. Given any isomorphism π and a inverse π of π , then π is unique.
Proof. Let h be an inverse of π To show that π is unique, one needs to show that β = π.The following equations establish this result:
(π β π) β β = π β (π β β)1π΄ β β = π β 1π΅
β = π.
Chapter 3. Category Theory 42
One can see that the first equation comes directly from the associativity of the com-position. The second comes from the fact that π and β are inverses of π . The last equationcomes from the fact that composition respects the identity rule.
Using the above result we can create a notation for an inverse of an isomorphism π .Since an inverse π is unique, we can write it as πβ1.
Using this definition, what would constitute an isomorphism in Sets? One can noticethat sets π΄ and π΅ are isomorphic iff there is a π : π΄ β π΅ and a π : π΅ β π΄ suchthat π(π(π₯)) = π₯. Thus, π = πβ1, i.e., π is the inverse of π . In set theory, a functionhas an inverse iff π is bijective. Thus, π΄ and π΅ are isomorphic in Sets iff there is aninjective function π from π΄ onto π΅. Some interesting results arise from this definition ofisomorphism:
Proposition 3.3. π΄ and π΅ are isomorphic in Sets iff they have the same cardinality(this result can be informally interpreted as both sets having the same size).
Proof. One can prove directly both sides of this proof. In one hand, One knows that if π΄and π΅ are isomorphic, then there is a bijection π : π΄ β π΅. Since two sets by definitionhave the same cardinality if there is a bijection between them, then π΄ and π΅ have thesame cardinality. On the other hand, if two sets have the same cardinality then thereexists a bijection π between them, Thus, they are isomorphic.
In set theory, it is well known that one can prove that N, Z e Q have the samecardinality (HRBACEK; JECH, 1999). Thus, by the above proposition, the naturals areisomorphic to the integers and to the rationals. At a first glance, it can be completelycounterintuitive. The naturals have the same structure as the integers? To answer this, oneshould remember that in Sets the object of the category is only a set. Thus, this categorydoes not consider a set together with a order relation. If one considers the naturals andintegers with their usual orderings, then it is obvious that they are not isomorphic. Onedirect argument is that in their usual orderings, the naturals are well-ordered, but theintegers are not.
What would constitute an isomorphism in Pos? Given two orderings (π΄,β€β²) and(π΅,β€β²β²), one can think of an isomorphism as a bijection π between π΄ and π΅ that respectsthe ordering, i.e., if π, π β π΄ and π β€β² π, then π(π) β€β²β² π(π).
From this definition of isomorphism, one can show that one can pick a suitable orderingto make the naturals isomorphic to the integers:
Proof. Consider the naturals together with its traditional ordering, i.e, (N,β€) = 0, 1, 2, ....For the integers, consider an ordering β€β²β² such that (Z,β€β²β²) = 0,β1, 1,β2, 2,β3, 3..... Oneneeds to find a bijection π such that π(0) = 0, π(1) = β1, π(2) = 1, π(3) = β2, etc. To dothat, one can define π(π₯) = (β1)π₯.
βοΈπ₯2
βοΈ. π is clearly monotone, i.e., π β€ π β π(π) β€β²β² π(π)
and it is also onto. Thus, (N,β€) βΌ= (Z,β€β²β²).
Chapter 3. Category Theory 43
In this subsection, we have seen a way of using category theory to give a generaldefinition for a important concept of mathematics. We have also shown practical examplesusing Sets and Pos. Isomorphism will be an essential concept in the mathematical modelof computational paths.
3.1.3 Groupoid
We can use the concept of isomorphism to define a structure known as groupoid. It hasthe following definition:
Definition 3.3 (Groupoid (AWODEY, 2010)). Given any category C, we say that C is agroupoid iff every arrow π β πΆ1 is an isomorphism. In other words, every pair of objectsare mutually isomorphic.
The concept of groupoid plays a main role in the semantical definition of the identitytype. If a category C is a groupoid, then every object of C has a similar structure. In fact,this concept has achieved great importance due to the discovery of the fact that typesin Martin-LΓΆfβs type theory have a groupoid structure (HOFMANN; STREICHER, 1994). Infact, one can prove that types have a weak groupoid structure. Weak here means that theequalities do not hold on the nose (i.e., the equalities are not definitional), but only up topropositional equality. One will have a better grasp of the concept of a weak structure inthe next chapter, when we introduce the weak groupoid model of computational paths. Infact, one of the objectives of our next chapter is to show that one can use computationalpaths to build a weak structure similar to the one proposed by (HOFMANN; STREICHER,1994), which uses the usual formulation of the intensional identity type to build it. Withthat in mind, one should notice that groupoid plays an important rule in this work.
We leave further details of this topic for the next chapter. Nevertheless, to better illus-trate this concept, we are going to give simple examples. Take a category whose objectsare sets and the arrows are bijections between these sets. Since bijections are isomor-phisms, this category constitutes a groupoid structure. Another example of groupoid isconstructed using Pos. One can take a category whose objects are ordered sets (π΄π,β€π)and arrows are bijections that respect the orderings. Thus, every arrow is an isomorphism.
3.1.4 Functors
The notion of functor is one of the most interesting and important concepts of categorytheory. Functors could be understood as a function that receives a category as input.Therefore, a functor transforms one category into another For example, one could thinkof the transformation of a category C into a category D. To do that, one needs to transformevery object of C into a object of D and the arrows of C into arrows of D. Moreover, theassociativity and identity rule must be preserved. We have the following formal definition:
Chapter 3. Category Theory 44
Definition 3.4 (Functor (AWODEY, 2010)). A functor πΉ : C β D between categories Cand D is a mapping of objects and arrows such that:
β’ π΄ β πΆ0 is mapped to πΉ (π΄) β π·0,
β’ π : π΄ β π΅ β πΆ1 is mapped to πΉ (π) : πΉ (π΄) β πΉ (π΅) β π·1,
β’ πΉ (π β π) = πΉ (π) β πΉ (π),
β’ πΉ (1π΄) = 1πΉ (π΄).
Perhaps a better way of understanding the above definition is to visualize it throughthe help of diagrams (AWODEY, 2012):
Example 3.1. This example is going to show the diagram representation of the action ofa generic functor πΉ : C β D. Let C be a category represented by the following diagram:
π΄ π΅
πΆ
1π΄
π
πβππ
After applying a functor πΉ , one ends up with πΉ (C) = D. This is represented by thefollowing diagram:
πΉ (π΄) πΉ (π΅)
πΉ (πΆ)
πΉ (1π΄)=1πΉ (π΄)πΉ (π)
πΉ (πβπ)=πΉ (π)βπΉ (π)πΉ (π)
Functors are common in practice. A simple example is the functor πΉππ : Pos β Sets.One can define πΉππ explaining its action on the objects and arrows of Pos. As we haveseen, an object of Pos is a pair (π΄,β€), in which π΄ is a set. πΉππ has the following behavior:πΉππ(π΄,β€) = π΄. In the arrows, we have that πΉππ(π : (π΄,β€) β (π΅,β€β²)) = π : π΄ β π΅.Thus, πΉππ can be seen as a forgetful functor that forgets the ordering of a ordered set,returning only the set. For the arrows, πΉππ forgets that π is a monotone function, returningonly the function. Forgetful functors are common in mathematics. Another well knownexample is πΉππ : Grp β Sets. This functor receives a category of groups as input. It thenforgets the group structure, returning only the underlying set. Forgetful functors plays afundamental role in category theory, since it is the basic concept behind the concept ofadjoint.
Further in this chapter we are going to see that the use of functors is needed in thedefinition of a 2-category.
Chapter 3. Category Theory 45
3.1.5 Duality
Duality is a principle of category theory that states that for any category C, there is adual category πΆππ . This category is defined in the following way (AWODEY, 2012):
Definition 3.5. Given any category C, the category Cππ is the dual category of C andis defined in the following way::
β’ Cππ0 = C0.
β’ Cππ1 = C1.
β’ πππ Cππ = πππ C.
β’ πππ Cππ = πππ C.
We can represent this duality using diagrams. Given any category C represented bythe following diagram:
π΄ π΅
πΆ
1π΄
π
πβππ
Thus, πΆππ is given by:
π΄ π΅
πΆ
1Μπ΄=1π΄
π
πΒ―πβπ=πβπ
From a dual category, one can define a new kind of functor known as contravariantfunctor. A contravariant functor is given by πΉ : Cππ β D. Instead of defining a functorthat acts on a category Cππ , one can apply directly a contravariant functor in a categoryC. To do that, one just needs to invert the order of the arrows in the application of thefunctor. To better see this, consider C as the category of the above example. We have thefollowing diagram of an application of a contravariant functor πΉ :
π΄ π΅
πΆ
πΉ (1π΄)πΉ (π)
πΉ (π)πΉ (πβπ)
Chapter 3. Category Theory 46
The use of contravariant functors in category theory is common. Also, duality is a veryuseful principle, since many properties of category theory appears from the dual categoryof some property. For example, if one has a diagram that represents the product of twocategories, one just needs to get the dual category to define the coproduct.
3.1.6 Commutativity
In this subsection, we introduce two kinds of diagrams widely used in category theory,the commutative triangle and commutative square.
Definition 3.6 (Commutative triangle). A commutative triangle is the following diagram:
π΄ π΅
πΆ
π
βπ
Since it commutes, the triangle π΄π΅πΆ respects the following equation: π β π = β.
Definition 3.7 (Commutative square). A commutative square is the following diagram:
π΄ π΅
πΆ π·
π
π‘ π
π
Since it commutes, the square π΄π΅πΆπ· respects the following equation: π β π = π β π‘.
Those two diagrams are used to define and prove many entities and properties ofcategory theory.
3.1.7 Product between two categories
Before we define product between two categories, it is important to notice that there isa significant difference between product between categories and product between objectsof a category. Product between categories is an operation that builds another category,whereas a product between objects of a category builds another object. Moreover, we canalways obtain the product of two categories, but sometimes the product of two objectsdoes not exist. Thus, in this subsection we introduce the product between two categories.We are also going to introduce the product between two objects in the sequel, since it isdirectly connected to the product of two types in type theory.
Chapter 3. Category Theory 47
Definition 3.8 (Product between two categories (AWODEY, 2010)). Given any categoriesC and D, one can obtain a category C Γ D defined by:
β’ Objects: Objects have the form (πΆ,π·), with πΆ β πΆ0 e π· β π·0.
β’ Arrows: Arrows have the form (π, π) : (πΆ,π·) β (πΆ β², π·β²), with π : πΆ β πΆ β² β πΆ1 eπ : π· β π·β² β π·1.
β’ Composition: Composition is defined component-wise, given by (π β², πβ²) β (π, π) =(π β² β π, πβ² β π).
β’ Identity: The identity arrow is also defined component-wise, given by 1(πΆ,π·) =(1πΆ , 1π·).
β’ Two projection functors, represented by the following diagram:
C C Γ D Dπ1 π2
The projections respects the following equations:
π1(πΆ,π·) = πΆ π2(πΆ,π·) = π·
π1(π, π) = π π2(π, π) = π.
This definition will play an important role in the definition of bicategory, as we aregoing to see further in this chapter.
3.1.8 Hom and Small Categories
In category theory, there is a important structure called π»ππ and defined as:
Definition 3.9 (π»ππC(π΄,π΅) (AWODEY, 2012)). π»ππC(π΄,π΅) is a structure that con-tains all arrows from object π΄ to object π΅, both objects of C.
Why we called π»ππ a structure instead of a set? The reason for that is the fact thatsometimes π»ππ is more than just a set. In higher categories, for example, π»ππ can be acategory. Also, when we talk about the size of a category, one has the following definitions:
Definition 3.10 (Large and small category (AWODEY, 2010)). A category C is calledsmall if πΆ0 and πΆ1 are sets. Otherwise the category is called large.
Chapter 3. Category Theory 48
The concept of large category rose up from the fact that in many categories the objectsand arrows cannot be represented by sets. In many cases, each object of a category isanother category. The same thing can happen to the arrows. Moreover, another importantthing to notice is that many properties are only valid in small categories. This happensbecause some properties are directly dependent on the fact that the objects and arrowsare sets. We have one more relevant definition:
Definition 3.11 (Locally small category (AWODEY, 2010)). A category C is locally smallif for any pair of objects π΄,π΅ β πΆ0, then π»ππC(π΄,π΅) is a set.
Sometimes we just need some category C to be locally small. This will become moreclear further in this chapter, when we investigate some properties of higher categories.
3.2 PRODUCT IN A CATEGORY
In the previous section, we have seen the definition of product between categories. In thissection, our objective is to define product between objects of a category. This plays animportant role in this work, since it has a direct connection with product of types, as weare going to show in this section. Based on those connections that we have decided touse category theory to propose a mathematical model for computational paths, as we aregoing to do in the next chapter.
Definition 3.12 (Product in a category (NLAB, 2014)). In a category C, the productbetween two objects π, π β πΆ0 is an object πΓπ equipped with morphisms π : πΓπ β π
and π : π Γ π β π , which are called projections. Moreover, the product has a universalproperty, which states that given any π β πΆ0 and maps π : π β π and π β π β π , thenthere exists a unique map β : π β π Γ π such that π β β = π and π β β = π.
This is represented in the following diagram (AWODEY, 2010):
π
π π Γ π π
πβ
π
π π
In the above diagram, the triangles are commutative. If one pays attention to thedefinition, the projections are easy to understand. Nevertheless, the part that related tothe universal property, i.e., π and the unicity of β might be a little complicated. This partcan be explained in the following way: If there is an arrow π : π β π and π : π β π ,then the unicity of β : π β π Γ π indicates that there is only one way to construct theproduct from these two arrows. Therefore, we can write β uniquely as β = (π, π).
Chapter 3. Category Theory 49
Proposition 3.4. In Sets, the product between two objects π΄,π΅ β πππ‘π 0 is the cartesianproduct between two sets.
Proof. To show that the product between two sets is the cartesian product, the first thingone needs to do is to show the projects. Thus, one just needs to define π : π΄ Γ π΅ β π΄
as π(π, π) = π and define π : π΄ Γ π΅ β π΅ as π(π, π) = π. Now, one needs to show theuniversal property. Let π : π β π΄ and π : π β π΅. One can define a β : π β π΄ Γ π΅
in the following way: β(π₯) = (π(π₯), π(π₯)). To end this proof, one needs to check thatπ ββ = π and π ββ = π. Indeed, (π ββ)(π₯) = π(β(π₯)) = π(π(π₯), π(π₯)) = π(π₯). Analogously,(π β β)(π₯) = π(β(π₯)) = π(π(π₯), π(π₯)) = π(π₯). Therefore, the cartesian product of two setsshould be seen a the product between two objects of Sets.
A natural questions arises. Is it possible to find another definition for the product oftwo objects in Sets. The following proposition answers this question (AWODEY, 2010):
Proposition 3.5. If Γ and Γβ² are products of a category C, then π΄Γπ΅ βΌ= π΄Γβ² π΅.
Proof. This is one case that the a proof with the help of diagrams is much easier to see(AWODEY, 2010):
π΄Γπ΅
π΄ π΄Γβ² π΅ π΅
π΄Γπ΅
π1 (π1,π2) π2
π1
(π1,π2)
π2
π1 π2
The main point here is that from the universal property of the products, one canobtain the arrows (π1, π2) and (π1, π2). Moreover, all triangles in the above diagram arecommutative. Looking at the diagram, the following equations are obtained from thetriangles (π΄Γπ΅)(π΄Γπ΅)π΄ and (π΄Γπ΅)(π΄Γπ΅)π΅:
π1 β (π1, π2) β (π1, π2) = π1
π2 β (π1, π2) β (π1, π2) = π2
Indeed, (π1, π2) β (π1, π2) acts as the identity arrow of π΄ Γ π΅. By the unicity of thosearrows, one knowns that (π1, π2)β(π1, π2) = 1π΄Γπ΅. Using the symmetry of the diagram, oneobtains (π1, π2) β (π1, π2) = 1π΄Γβ²π΅. Therefore (π1, π2) and (π1, π2) are inverses and establishthe isomorphism between the two products.
Based on this proof, it is possible to state that every category has only one definitionfor the product of two objects since all possible definitions are mutually isomorphic.
Chapter 3. Category Theory 50
3.2.1 Product in Type Theory and Category Theory
This section is going to show the close relation between type theory and category theory.To see that, we are going to show some type theoretic constructions together with therespective diagrams in type theory. We start with product formation (Γ β πΉ ) (NLAB,2014):
π΄ type π΅ type Γ β πΉπ΄Γπ΅ type
Product formation is intuitive. Given any types π΄ and π΅, it is possible to obtain π΄Γπ΅.In categories, there is an equivalent proposition: If π΄,π΅ β πΆ0, then π΄ Γ π΅πππΆ0. Now wehave product introduction (Γ β πΌ) (NLAB, 2014):
π : π΄ π : π΅ Γ β πΌβ¨π, πβ© : π΄Γπ΅
π
π΄ π΄Γπ΅ π΅
π (π,π) π
Indeed, given any terms π : π΄ and π : π΅, it is possible to construct β¨π, πβ© : π΄ Γ π΅.In categories, it is represented by arrows π and π. Given those arrows, it is possible toobtain a unique β¨π, πβ© given by the universal property of the product. Now follows thefirst product elimination (Γ β πΈ1) and the second product elimination (Γ β πΈ2) (NLAB,2014):
π‘ : π΄Γπ΅ Γ β πΈ1π1(π‘) : π΄
π‘ : π΄Γπ΅ Γ β πΈ2π2(π‘) : π΅
π
π΄ π΄Γπ΅ π΅
π‘
π1 π2
The eliminations are done using the projections. This is exactly that the above diagramrepresents. We also have diagram representations of the computation rules π1(β¨π, πβ©) = π
and π2(β¨π, πβ©) = π:
π
π΄ π΄Γπ΅ π΅
π β¨π,πβ© π
π1 π2
Chapter 3. Category Theory 51
That way, one can see that we can translate type theoretic constructions to the lan-guage of category theory. In this subsection, we have shown the specific case of the prod-uct, but using a similar process one can translate any entity of type theory, includingpath-induction and the constructor π½ .
3.2.2 Coproduct
The objective of this section is not to give a detailed construction of the coproduct, butto show that it is possible to use duality on the constructions of the product to obtaindirect constructions of the coproduct. Given any a category C and objects π΄,π΅ β πΆ0, thecoproduct of two objects is represented by π΄+π΅ and given by the following diagram:
π
β²π΄ π΄+π΅ π΅
π
π1
[π,π] π
π2
As one can see, the coproduct is exactly the dual category of the product. The projec-tions are replaced by injections. It also has a universal product, that states the following:if there are π : π΄ β π and π : π΅ β π, then there is a unique β : π΄ + π΅ β π. We canalso use duality to prove the following proposition:
Proposition 3.6. If + and +β² are coproducts of a category C, then π΄+π΅ βΌ= π΄+β² π΅.
Proof. The proof is directly connected to the fact that the dual of an isomorphism is alsoan isomorphism. The duality only changes the direction of the arrow. Thus, if an arrowis an isomorphism in the original category, then it will also be in the dual. Since theisomorphism has been proved for the product, the duality keeps it
Using the same process that we have established for the product, one can translatethe construction of the coproduct in type theory to the language of category theory.
3.3 NATURAL TRANSFORMATIONS
Natural transformations are one of the most important concepts of category theory. As wehave said in the introduction of this chapter, category theory was originally proposed tostudy natural transformations. Moreover, we are going to use this concept in the definitionof bicategory. Perhaps a good way of introducing natural transformations is the followingexample: Suppose thatπ΄,π΅ and πΆ are objects of a category with products. Then, (π΄Γπ΅)ΓπΆ βΌ= π΄Γ(π΅ΓπΆ) (AWODEY, 2010). We will not show the proof of this proposition, since it ispretty straightforward. One just needs to draw the diagram and establishes the equationsusing the commutative triangles. Nevertheless, the important piece o information is the
Chapter 3. Category Theory 52
fact that there exists an isomorphism π : (π΄Γπ΅) ΓπΆβΌββ π΄Γ (π΅ΓπΆ). This isomorphism
π has a limitation though. It establishes only the isomorphism for objects π΄,π΅ and πΆ.Ideally, one wants a general result that does not depend on the choice of objects π΄,π΅ orπΆ. To do that, one needs the concept of natural transformations.
Intuitively, a natural transformation is a morphism between functors. We can use theassociativity of the product as our first example of natural transformation. First, one canconceive the following functors: πΉ : C Γ C Γ C β C defined by πΉ = (β1 Γ β2) Γ β3 andthe functor πΊ : C Γ C Γ C β C defined by πΊ = β1 Γ (β2 Γ β3). With that in mind,one needs to find a natural transformation π : πΉ β πΊ. Moreover, one also needs to showthat π is an entity known as natural isomorphism. Thus, one finishes the proof that theisomorphism (π΄Γπ΅) ΓπΆ βΌ= π΄Γ (π΅ΓπΆ) does not depend on the choice of the objects. Inthat case, it is said that the isomorphism is natural on π΄,π΅ and πΆ. Here follows a formaldefinition for natural transformation:
Definition 3.13 (Natural transformation (AWODEY, 2010)). Given any categories Cand D and functors πΉ,πΊ : C β D, a natural transformation π : πΉ β πΊ is a family ofarrows in D given by: (ππΆ : πΉπΆ β πΊπΆ)πΆβπΆ0. Moreover, given a π : πΆ β πΆ β² β πΆ1, thenππΆβ² βπΉ (π) = πΊ(π) β ππΆ. This equality is represented by the following commutative square:
πΉπΆ πΊπ΅
πΉπΆ β² πΊπ·
ππΆ
πΉ (π) πΊ(π)
ππΆβ²
The arrows ππΆ are called components π in πΆ.
Looking at the above definition, one can conclude that to find a natural transformationbetween two functors, one just needs to find a suitable morphism for the components.This morphism needs to be natural, i.e, it must obey the commutative square. From thedefinition of natural transformation, one can define the following category:
Definition 3.14 (Category πΉπ’π(C,D) (AWODEY, 2010)). Given any categories C andD, it is possible to construct the category πΉπ’π(C,D) defined by:
β’ Objects: Objects are functors πΉ : C β D.
β’ Arrows: Arrows are natural transformations π : πΉ β πΊ.
β’ Composition: Given any two arrows π : πΉ β πΊ e π : πΊ β π», it is possible to define(π β π) component-wise: (π β π)πΆ = ππΆ β ππΆ.
Chapter 3. Category Theory 53
β’ Identity: Given any functor πΉ , the arrow 1πΉ is defined component-wise: (1πΉ )πΆ =1πΉ πΆ : πΉπΆ β πΉπΆ.
Therefore, we can now define natural isomorphism:
Definition 3.15 (Natural isomorphism (AWODEY, 2010)). A natural isomorphism isa natural transformation π : πΉ β πΊ such that π is an isomorphism in the categoryπΉπ’π(C,D).
There is a easier way to check if a natural transformation is an isomorphism (AWODEY,2010):
Proposition 3.7. A natural transformation π : πΉ β πΊ is a natural isomorphism iff everycomponent ππΆ : πΉπΆ β πΊπΆ is an isomorphism.
Proof. (β) To prove this direction, one needs to prove that given any natural isomorphismπ : πΉ β πΊβ then every component ππΆ is also an isomorphism. Since π is an isomorphism,then π has an inverse π : πΊ β πΉ . Thus, one has that π β π = 1πΊ and π β π = 1πΉ . Thus,if one takes any component in πΆ, one concludes that (π β π)πΆ = (1πΊ)πΆ and (π β π)πΆ =(1πΉ )πΆ . By the definition of composition and identity in πΉπ’π, one obtains ππΆ β ππΆ = 1πΉ πΆ
and ππΆ β ππΆ = 1πΊπΆ . Therefore, ππΆ is inverse to ππΆ . Therefore, every component is anisomorphism.
(β) To prove the opposite direction, one needs to show that if every component ππΆ
of a natural transformation π is an isomorphism, then π is also an isomorphism. If eachcomponent is an isomorphism then for each ππΆ there exists an inverse arrow ππΆ such thatππΆ β ππΆ = 1πΊπΆ and ππΆ β ππΆ = 1πΉ πΆ . By the definition of composition and identity of πΉπ’π,one has that ππΆ βππΆ = (π βπ)πΆ = 1πΊπΆ = (1πΊ)πΆ . Thus, π βπ = 1πΊ. Analogously, one showsthat π β π = 1πΉ . Therefore, π is a natural transformation inverse to π. One concludes thatπ is natural isomorphism.
The above proposition makes the notion of natural isomorphism easier to work with,since one only needs to show that every component is an isomorphism. To show howone can use natural transformations and natural isomorphisms in practice, consider thefollowing proposition:
Proposition 3.8. Let C be a category that has binary products and π΄,π΅ β πΆ0, thenπ΄Γπ΅ βΌ= π΅ Γ π΄ and the isomorphism is natural in π΄ and in π΅.
If we limited the above proposition to a proof of π΄Γ π΅ βΌ= π΅ Γ π΄, then it would be amatter of showing diagrams of the product to establish this isomorphism. Nevertheless,we also need to show that this isomorphism is natural in π΄ and in π΅. There is only oneway of doing that: using natural transformations. Here is the proof (AWODEY, 2010):
Chapter 3. Category Theory 54
Proof. To prove this natural isomorphism, one needs to define the functors first. The firstfunctor is Γ : CΓC β C, defined by Γ = (β1,β2). The second is given by ΓΜ : CΓC β Cdefined by ΓΜ : (β2,β1). Thus, in objects π΄ΓΜπ΅ = π΅Γπ΄ and in arrows πΌΓΜπ½ = π½ΓπΌ. thatway, one now needs to conceive a natural transformation π between those two functors.One can define π by its behavior when applied in terms (π΄,π΅). Thus, one can defineπ(π΄,π΅)(π, π) = (π, π), with π and π arrows of a product (i.e., given a π, they are arrowsπ β π΄ e π β π΅ respectively). One also needs to show that π is a natural transformation.In other words, to show that the following diagram commutes:
π΄Γπ΅ π΅ Γ π΄
π΄β² Γπ΅β² π΅β² Γ π΄β²
π(π΄,π΅)
πΌΓπ½ π½ΓπΌ
π(π΄β²,π΅β²)
To show that the above diagram commutes, one only needs to take any (π, π) from π,π : π β π΄ and π : π β π΅. Thus, we obtain the following equations:
(π½ Γ πΌ)π(π΄,π΅)(π, π) = (π½ Γ πΌ)(π, π)(π½ Γ πΌ)(π, π) = (π½π, πΌπ)
(π½π, πΌπ) = π(π΄β²,π΅β²)(πΌπ, π½π)(πΌπ, π½π) = π(π΄β²,π΅β²)(πΌΓ π½)(π, π)
Therefore, (π½ Γ πΌ)π(π΄,π΅)(π, π) = π(π΄β²,π΅β²)(πΌ Γ π½)(π, π), proving that the square is com-mutative. Thus, one concludes that π is a natural transformation. Nonetheless, one stillneeds to show that π is an isomorphism. To do that, one can use proposition 3.7, i.e.,one just needs to show that every component is an isomorphism. The isomorphism foreach component is simple to show, since for each π(π΄,π΅) there is an inverse π(π΄,π΅) = π(π΅,π΄).Here follows:
(π(π΄,π΅) β π(π΄,π΅))(π΅ Γ π΄) = π(π΄,π΅)(π΄Γπ΅) = π΅ Γ π΄
(π(π΄,π΅) β π(π΄,π΅))(π΄Γπ΅) = π(π΅,π΄)(π΅ Γ π΄) = π΄Γπ΅
Therefore, one concludes:
(π(π΄,π΅) β π(π΄,π΅)) = 1ΓΜ(π΄,π΅)
(π(π΄,π΅) β π(π΄,π΅)) = 1Γ(π΄,π΅).
Thus, each component π em (π΄,π΅) is an isomorphism. Therefore, π is an isomorphism.Thus, one concludes this proof.
Chapter 3. Category Theory 55
3.3.1 Adjoints
After introducing the concept of natural transformations, we can talk about adjoints. Itis one of the most important concepts of this theory, since it has many applications.
We have talked about functions and how one can transform a structure into another.A question arises: what is the best way of making this transformation? In other words,we have an optimization problem in our hands. This subsection proposes a solution tothis question. It introduces a concept that it is possible to optimize those transformationsand its inverse process. For example, we talked about a forgetful functor that forgets thegroup structure and returns only the underlying set. As a matter of fact, it is the optimalway of transforming a group into a set. We also have an inverse process, we take a setand obtain a group freely generated by it. This is also optimal, thus we are going to saythat those two functors form a pair of adjoints.
Perhaps one of the best way of introducing adjoints is to use the concept of monoid,the forgetful functor on a monoid and the functor that generates a free monoid. First,letβs recall the classic definition of monoid:
Definition 3.16 (Monoid (NLAB, 2017)). A monoid is a set π equipped with a binaryoperation π : π Γπ β π and a special element 1 β π (the neutral element) such that1 and π₯.π¦ = π(π₯, π¦) satisfies the associative law:
(π₯.π¦).π§ = π₯.(π¦.π§)
and the left and right unit laws:
1.π₯ = π₯ = π₯.1
Thus, from a monoid, one can clearly apply a forgetful functor to obtain the underlyingset. From a set, one can freely generate a monoid using the elements of this set. Intuitively,a free generation works using the elements of the set as as letters and the operation ofthe monoid as compositions. Also, all equalities must come from the monoid axioms.Nevertheless, one can use category theory to precisely define a free monoid. Before wedefine that, it is important to notice some facts. If one have a monoid π , then one alsohave an underlying set βπβ. Also, from every monoid homomorphism π : π β π , onehave a forgetful functor βπβ : βπβ β βπβ. Thus, one can define a free monoid in thefollowing way:
Definition 3.17 (Free Monoid (AWODEY, 2010)). A free monoid π(π΄) on a set π΄ is themonoid with the following universal mapping property: Thereβs a function π : π΄ β βπ(π΄)βand given any monoid π and any function π΄ β βπβ, thereβs a unique monoid homo-morphism π : π(π΄) β π such that βπβ β π = π . This is given by the following diagrams:
In the category of monoids:
Chapter 3. Category Theory 56
π(π΄) ππ
in the category of Sets:
π΄ π(π΄)
βπβ
π
π βπβ
Since we have considered the forgetful functor as the optimal way of obtaining a setfrom a monoid, one can consider a free monoid as the optimal way of obtaining a monoidfrom a set. Together, those two functors makes a pair of adjoints.
Based on that, we can define adjoints formally already:
Definition 3.18 (Adjunction (AWODEY, 2010)). An adjuction between categories C andD are a pair of functors:
πΉ : πΆ π· : ππ
π‘
and a natural transformation:
π : 1πΆ β π β πΉ
that follows the diagrams:
πΉ (πΆ) π·π
πΆ π(πΉ (πΆ))
π(π·)
ππΆ
ππ(π)
In the above definition, πΉ is called the left adjoint, π the right adjoint and π is the unitof the adjunction. In the monoid example, the left adjoint is the free monoid generatorand the right adjoint is the forgetful functor.
Chapter 3. Category Theory 57
3.4 HIGHER CATEGORIES
In this section, we introduce only the concepts of higher category theory that will benecessary to prove our results in the next chapter.
Previously in this chapter, we have said that sometimes the arrows between two objectsdo not form only a set, but a category instead. In that case, we have categories betweenevery pair of objects. In this sense, we can think that we have added a new dimension tothe category. Indeed, this process can continue. We can take a category, then a categorybetween pair of objects and go even further, taking a category between pairs of objects ofthis inner category. This process can add infinitely many dimensions. When this processgoes up to the infinity, we have an β β ππππ’ππππ.
Another important concept is the fact that sometimes the equalities of a categorydoes not hold "on the nose", but only in a weak sense. For example, we have seen thedifference between definitional and propositional equalities in type theory. In this theory,the equalities of a category induced by a type do not hold in the strict sense of definitionalequalities, but only hold up to propositional equality, thus they are weak structures. Infact, weak structures are much more common in mathematics than strict ones. Thus, weare going to be interested in weak higher order categories.
Moreover, it is important to notice that we are going to limit the scope of this workto weak categories of the second order, called bicategories. Obtaining a weak β-groupoidwould be a great achievement, but since it involves many highly complex concepts ofhigher category theory, trying to achieve this result would be unpractical.
With that said, we can finally define some basic concepts of higher category theory.
3.4.1 Globular Sets
The first important concept is globular set:
Definition 3.19 (Globular Sets (LEINSTER, 2004)). Let π β N. A globular set π is thefollowing diagram of sets and functions:
π(π) π(πβ 1) ... π(0)π
π‘
π
π‘
π
π‘
The diagram must respect the following equations for any π β {2, ...., π} and π₯ βπ(π):
π (π (π₯)) = π (π‘(π₯)), π‘(π (π₯)) = π‘(π‘(π₯))
The terms π₯ β π(π) are called π-cells.
Chapter 3. Category Theory 58
3.4.2 Horizontal Composition
Given any globular set, a 0-cell is simply an object and is represented by the followingdiagram:
π
An 1-cell is a morphism between objects, represented by:
π ππ
2-cells are morphisms between 1-cells. Therefore, are represented by the followingdiagram:
π π
π
π‘
πΌ
Since a 2-cell has a higher dimension that 1-cells, it is possible to compose 2-cells intwo different ways. The first way is the traditional composition written as β. The diagram
π π
π
t
π₯
πΌ
π
can be represented by:
π π
π
π₯
π β πΌ
Chapter 3. Category Theory 59
In a 2-cell, the traditional composition is also known as vertical composition. For 2-cells, we have an additional composition written as ββ. It is called horizontal composition(LEINSTER, 2004). It is represented by transforming the following diagram
π π π
π
π₯
π‘
π¦
πΌ π
into the diagram:
π π
π‘ β π
π¦ β π₯
π ββ πΌ
Thus, when one works with categories of order higher than 1, one needs to take intoaccount those new kind of compositions. In the case of 2-categories, the 2-cells will havethose two compositions. Moreover, the horizontal composition must also respects asso-ciativity and the identity laws. Analogously, 3-cells, in addition of the two compositionspresent in 2-cells, has a third one. Indeed, a π-cell has π compositions. Formally, π com-positions of a π-cell β π΄(π) is represented by (LEINSTER, 2004):
π΄(π) Γπ΄(π) π΄(π) = {(π₯β², π₯) β π΄(π) Γ π΄(π) | π‘πβπ(π₯) = π πβπ(π₯β²)}, with π β€ π
3.4.3 Bicategories
Bicategories are weak second order categories. They are defined as follows:
Definition 3.20 (Bicategories (LEINSTER, 1998)). A bicategory Ξ is a structure with thefollowing data and axioms:Data:
β’ Objects collection ob Ξ (Elements are 0-cells π΄,π΅, ...)
β’ Categories Ξ(π΄,π΅) (1-cells π, π, ... are the objects of those categories and arrows are2-cells πΌ, π½, ...)
β’ Functors:
Chapter 3. Category Theory 60
ππ΄π΅πΆ : Ξ(π΅,πΆ) Γ Ξ(π΄,π΅) β Ξ(π΄,πΆ)
(π, π) β π β π = ππ
(π½, πΌ) β π½ ββ πΌ
and πΌπ΄ : 1 β Ξ(π΄,π΄) (thus, πΌπ΄ is an 1-cell π΄ β π΄)
β’ The following natural isomorphisms:
Thus, we have 2-cells:
πβππ : (βπ)π βΌββ β(ππ)
ππ : π β πΌπ΄βΌββ π
ππ : πΌπ΅ β π βΌββ π
Axioms:Consider the following configuration of 1-cells
π π π π ππ π π π’
The following diagrams commute:
Chapter 3. Category Theory 61
((π’ β π) β π) β π
(π’ β π) β (π β π )
(π’ β (π β π)) β π
π’ β ((π β π) β π )
π’ β (π β (π β π ))
π
π ββ 1
π
π 1 ββ π
(π β ππ) β π π β (ππ β π )
π β π
π
ππ ββ 1 1 ββ ππ
In the literature of higher order category theory, the axioms of a weak higher ordercategory are called coherence laws (LEINSTER, 2004).
3.5 CONCLUSION
In this chapter, we have seen the basic concepts of category theory. Most will play animportant role in the next chapter. The concepts of isomorphism and groupoid, for in-stance, will be the base for mathematical model for computational paths. We have alsoseen concepts of higher category theory, since in the sequel we are going to show thatcomputational paths forms a higher structure.
62
4 COMPUTATIONAL PATHS
In this chapter, we introduce the main concept of this work, an entity known ascomputational paths. In chapter 2, we have seen that it is possible to interpret theidentity type semantically, considering the terms as homotopical paths between two pointsof a space. Nevertheless, there is no entity that represents those paths in the syntax oftype theory. Thus, we add computational paths to fill this gap. In this sense, our objectiveis to formulate the identity type using this new entity.
This work has also been motivated by the fact that although beautifully defined, wehave noticed that proofs that uses the identity type can be sometimes a little too complex.The elimination rule of the intensional identity type encapsulates lots of information,sometimes making too troublesome the process of finding the reason that builds the correcttype. We have also seen this in chapter 2. We proposed constructions for the symmetryand transitivity of the identity type. Although one could expect those constructions to bepretty straightforward, the process of obtaining the right reason to construct those typeswas troublesome.
Thus, inspired by the path-based approach of the homotopy interpretation, we believethat a similar approach can be used to define the identity type in type theory. To achievethat, we have been using a notion of computational paths. The interpretation will besimilar to the homotopy one: a term π : πΌππ΄(π, π) will be a computational path betweenterms π, π : π΄, and such path will be the result of a sequence of rewrites. In the sequel, weshall define formally the concept of a computational path. The main idea, i.e. proofs ofequality statements as (reversible) sequences of rewrites, is not new, as it goes back to apaper entitled βEquality in labeled deductive systems and the functional interpretation ofpropositional equality ", presented in December 1993 at the 9th Amsterdam Colloquium,and published in the proceedings in 1994(QUEIROZ; GABBAY, 1994).
In the previous chapter, we have seen the concept of higher structures such as highercategories. Indeed, one of the most interesting aspects of the identity type is the fact that itcan be used to construct higher structures. This is a rather natural consequence of the factthat it is possible to construct higher identities. For any π, π : π΄, we have type πΌππ΄(π, π). Ifthis type is inhabited by any π, π : πΌππ΄(π, π), then we have type πΌππΌππ΄(π,π)(π, π). If the lattertype is inhabited, we have a higher equality between π and π(HARPER, 2012). This conceptis also present in computational paths. One can show the equality between two computa-tional paths π and π‘ by constructing a third one between π and π‘. We show in this chapter a
This chapter is based on two papers published by the author (jointly with his advisor and co-advisor):Propositional equality, identity types, and computational paths in South American Joournal of Logic,2016 (QUEIROZ; OLIVEIRA; RAMOS, 2016) and On the Identity Type as the Type of ComputationalPaths in Logic Journal of the IGPL, 2017 (RAMOS; QUEIROZ; OLIVEIRA, 2017).
Chapter 4. Computational Paths 63
system of rules used to establish equalities between computational paths(OLIVEIRA, 1995).Then, we show that these higher equalities go up to the infinity, forming a β-globular-set.We also show that computational paths naturally induce a groupoid structure. We alsogo a step further, showing that computational paths are capable of inducing a highergroupoid structure.
Another important question we want to answer is one that arises naturally whentalking about equality: Is there a canonical proof for an expression π‘1 = π‘2? In the languageof computational paths, is there a normal path between π‘1 = π‘2 such that every other pathcan be reduced to this one? In fact, we are going to prove that the answer is negative.Our model also refute the Uniquiness of Identity Proofs (UIP)).
4.1 INTRODUCING COMPUTATIONAL PATHS
Before we enter in details of computational paths, letβs recall what motivated the intro-duction of computational paths to type theory. In type theory, our types are interpretedusing the so-called Brower-Heyting-Kolmogorov Interpretation. That way, a semantic in-terpretation of types are not given by truth-values, but by the concept of proof as aprimitive notion. Thus, we have (QUEIROZ; OLIVEIRA; RAMOS, 2016):
a proof of the proposition: is given by:π΄ β§π΅ a proof of π΄ and a proof of π΅π΄ β¨π΅ a proof of π΄ or a proof of π΅π΄ β π΅ a function that turns a proof of π΄ into a proof of π΅βπ₯π·.π (π₯) a function that turns an element π into a proof of π (π)βπ₯π·.π (π₯) an element π (witness) and a proof of π (π)
Also, based on the Curry-Howard functional interpretation of logical connectives, onehave (QUEIROZ; OLIVEIRA; RAMOS, 2016):
a proof of the proposition: has the canonical form of:π΄ β§π΅ β¨π, πβ© where π is a proof of π΄ and π is a proof of π΅π΄ β¨π΅ π(π) where π is a proof of π΄ or π(π) where π is a proof of π΅
(βπβ and βπβ abbreviate βinto the left/right disjunctβ)π΄ β π΅ ππ₯.π(π₯) where π(π) is a proof of B
provided π is a proof of Aβπ₯π΄.π΅(π₯) Ξπ₯.π(π₯) where π(π) is a proof of π΅(π)
provided π is an arbitrary individual chosenfrom the domain π΄
βπ₯π΄.π΅(π₯) ππ₯.(π(π₯), π) where π is a witnessfrom the domain π΄, π(π) is a proof of π΅(π)
Chapter 4. Computational Paths 64
If one looks closely, there is one interpretation missing in the BHK-Interpretation.What constitutes a proof of π‘1 = π‘2? In other words, what is a proof of an equalitystatement? We answer this by proposing that an equality between those two terms shouldbe a sequence of rewrites starting from π‘1 and ending at π‘2. Thus, we would have (QUEIROZ;
OLIVEIRA; RAMOS, 2016):
a proof of the proposition: is given by:
π‘1 = π‘2 ?(Perhaps a sequence of rewritesstarting from π‘1 and ending in π‘2?)
We call computational path the sequence of rewrites between these terms.
4.1.1 Formal Definition
Since computational path is a generic term, it is important to emphasize the fact thatwe are using the term computational path in the sense defined by(QUEIROZ; OLIVEIRA,2014a). A computational path is based on the idea that it is possible to formally definewhen two computational objects π, π : π΄ are equal. These two objects are equal if one canreach π from π by applying a sequence of axioms or rules. This sequence of operationsforms a path. Since it is between two computational objects, it is said that this path isa computational one. Also, an application of an axiom or a rule transforms (or rewrite)an term in another. For that reason, a computational path is also known as a sequenceof rewrites. Nevertheless, before we define formally a computational path, we can take alook at one famous equality theory, the ππ½π β πππ’ππππ‘π¦(HINDLEY; SELDIN, 2008):
Definition 4.1. The ππ½π-equality is composed by the following axioms:
(πΌ) ππ₯.π = ππ¦.π [π¦/π₯] if π¦ /β πΉπ (π);
(π½) (ππ₯.π)π = π [π/π₯];
(π) π = π ;
(π) (ππ₯.ππ₯) = π (π₯ /β πΉπ (π)).
And the following rules of inference:
π = π β²(π)
ππ = ππ β²π = π π = π(π)
π = π
Chapter 4. Computational Paths 65
π = π β²(π)
ππ = π β²ππ = π(π)π = π
π = π β²(π)
ππ₯.π = ππ₯.π β²
Definition 4.2. (HINDLEY; SELDIN, 2008) π is π½-equal or π½-convertible to π (notationπ =π½ π) iff π is obtained from π by a finite (perhaps empty) series of π½-contractionsand reversed π½-contractions and changes of bound variables. That is, π =π½ π iff thereexist π0, . . . , ππ (π β₯ 0) such that π0 β‘ π , ππ β‘ π, (βπ β€ πβ 1)(ππ β1π½ ππ+1 or ππ+1 β1π½
ππ or ππ β‘πΌ ππ+1).
(Note that equality has an existential force, which will show in the proof rules for theidentity type.)
The same happens with ππ½π-equality:
Definition 4.3. (ππ½π-equality(HINDLEY; SELDIN, 2008)) The equality-relation determinedby the theory ππ½π is called =π½π; that is, we define
π =π½π π β ππ½π β’ π = π.
Example 4.1. Take the term π β‘ (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£. Then, it is π½π-equal to π β‘ π§π£
because of the sequence:(ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£, (ππ₯.(ππ¦.π¦π₯)π§)π£, (ππ¦.π¦π£)π§, π§π£
which starts from π and ends with π , and each member of the sequence is obtained via1-step π½- or π-contraction of a previous term in the sequence. To take this sequence intoa path, one has to apply transitivity twice, as we do in the example below.
Example 4.2. The term π β‘ (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£ is π½π-equal to π β‘ π§π£ because ofthe sequence:(ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£, (ππ₯.(ππ¦.π¦π₯)π§)π£, (ππ¦.π¦π£)π§, π§π£
Now, taking this sequence into a path leads us to the following:The first is equal to the second based on the grounds:π((ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£, (ππ₯.(ππ¦.π¦π₯)π§)π£)The second is equal to the third based on the grounds:π½((ππ₯.(ππ¦.π¦π₯)π§)π£, (ππ¦.π¦π£)π§)Now, the first is equal to the third based on the grounds:π(π((ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£, (ππ₯.(ππ¦.π¦π₯)π§)π£), π½((ππ₯.(ππ¦.π¦π₯)π§)π£, (ππ¦.π¦π£)π§))Now, the third is equal to the fourth one based on the grounds:π½((ππ¦.π¦π£)π§, π§π£)Thus, the first one is equal to the fourth one based on the grounds:π(π(π((ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£, (ππ₯.(ππ¦.π¦π₯)π§)π£), π½((ππ₯.(ππ¦.π¦π₯)π§)π£, (ππ¦.π¦π£)π§)), π½((ππ¦.π¦π£)π§, π§π£))).
Chapter 4. Computational Paths 66
The aforementioned theory establishes the equality between two π-terms. Since weare working with computational objects as terms of a type, we need to translate theππ½π-equality to a suitable equality theory based on Martin LΓΆfβs type theory. We obtain:
Definition 4.4. The equality theory of Martin LΓΆfβs type theory has the following basicproof rules for the Ξ -type:
π : π΄[π₯ : π΄]π : π΅(π½) (ππ₯.π)π = π [π/π₯] : π΅[π/π₯]
[π₯ : π΄]π = π β² : π΅(π)
ππ₯.π = ππ₯.π β² : (Ξ π₯ : π΄)π΅
π : π΄(π)π = π : π΄
π = π β² : π΄ π : (Ξ π₯ : π΄)π΅(π)ππ = ππ β² : π΅[π/π₯]
π = π : π΄(π)π = π : π΄
π : π΄ π = π β² : (Ξ π₯ : π΄)π΅(π)ππ = π β²π : π΅[π/π₯]
π = π : π΄ π = π : π΄(π)π = π : π΄
π : (Ξ π₯ : π΄)π΅(π) (π₯ /β πΉπ (π))(ππ₯.ππ₯) = π : (Ξ π₯ : π΄)π΅
We are finally able to formally define computational paths:
Definition 4.5. Let π and π be elements of a type π΄. Then, a computational path π fromπ to π is a composition of rewrites (each rewrite is an application of the inference rules ofthe equality theory of type theory or is a change of bound variables). We denote that byπ =π π.
As we have seen in example 4.2, composition of rewrites are applications of the rule π .Since change of bound variables is possible, each term is considered up to πΌ-equivalence.
4.1.2 Equality Equations
One can use the aforementioned axioms to show that computational paths establishes thethree fundamental equations of equality: the reflexivity, symmetry and transitivity:
π =π‘ π : π΄ π =π’ π : π΄ transitivityπ =π(π‘,π’) π : π΄
π : π΄ reflexivityπ =π π : π΄
π =π‘ π : π΄ symmetryπ =π(π‘) π : π΄
Chapter 4. Computational Paths 67
4.1.3 Identity Type
We have said that it is possible to formulate the identity type using computational paths.As we have seen, the best way to define any formal entity of type theory is by a set ofnatural deductions rules. Thus, we define our path-based approach as the following set ofrules:
β’ Formation and Introduction rules (QUEIROZ; OLIVEIRA; RAMOS, 2016; RAMOS; QUEIROZ;
OLIVEIRA, 2017):
π΄ type π : π΄ π : π΄πΌπβ πΉ
πΌππ΄(π, π) type
π =π π : π΄πΌπβ πΌ
π (π, π) : πΌππ΄(π, π)
One can notice that our formation rule is exactly equal to the traditional identitytype. From terms π, π : π΄, one can form that is inhabited only if there is a proof ofequality between those terms, i.e., πΌππ΄(π, π).
The difference starts with the introduction rule. In our approach, one can noticethat we do not use a reflexive constructor π. In other words, the reflexive path is notthe main building block of our identity type. Instead, if we have a computationalpath π =π π : π΄, we introduce π (π, π) as a term of the identity type. That way, oneshould see π (π, π) as a sequence of rewrites and substitutions (i.e., a computationalpath) which would have started from π and arrived at π
β’ Elimination rule (QUEIROZ; OLIVEIRA; RAMOS, 2016; RAMOS; QUEIROZ; OLIVEIRA,2017):
π : πΌππ΄(π, π)[π =π π : π΄]β(π) : πΆ
πΌπβ πΈπ πΈππ (π, π.β(π)) : πΆ
Letβs recall the notation being used. First, one should see β(π) as a functionalexpression β which depends on π. Also, one should notice the use of βΜ β in π. Oneshould see βΜ β as an abstractor that binds the occurrences of the variable π introducedin the local assumption [π =π π : π΄] as a kind of Skolem-type constant denoting thereason why π was assumed to be equal to π.
We also introduce the constructor π πΈππ . In a sense, it is similar to the constructorπ½ of the traditional approach, since both arise from the elimination rule of the
Chapter 4. Computational Paths 68
identity type. The behavior of π πΈππ is simple. If from a computational path π
that establishes the equality between π and π one can construct β(π) : πΆ, then ifwe also have this equality established by a term π : πΌππ΄(π, π), we can put togetherall this information in π πΈππ to construct πΆ, eliminating the type πΌππ΄(π, π) in theprocess. The idea is that we can substitute π for π in π.β(π), resulting in β(π/π) : πΆ.This behavior is established next by the reduction rule.
β’ Reduction rule (QUEIROZ; OLIVEIRA; RAMOS, 2016; RAMOS; QUEIROZ; OLIVEIRA,2017):
π =π π : π΄πΌπβ πΌ
π(π, π) : πΌππ΄(π, π)[π =π π : π΄]β(π) : πΆ
πΌπβ πΈ Bπ½π πΈππ (π, π.β(π)) : πΆ
[π =π π : π΄]β(π/π) : πΆ
β’ Induction rule:
π : πΌππ΄(π, π)[π =π‘ π : π΄]
πΌπβ πΌπ‘(π, π) : πΌππ΄(π, π)
πΌπβ πΈ Bπ π : πΌππ΄(π, π)π πΈππ (π, π‘.π‘(π, π)) : πΌππ΄(π, π)
Our introduction and elimination rules reassure the concept of equality as an existen-tial force. In the introduction rule, we encapsulate the idea that a witness of a identitytype πΌππ΄(π, π) only exists if there exist a computational path establishing the equality ofπ and π. Also, one can notice that our elimination rule is similar to the elimination ruleof the existential quantifier.
4.1.4 Path-based Examples
The objective of this subsection is to show how to use in practice the rules that we havejust defined. The idea is to show construction of terms of some important types. Theconstructions that we have chosen to build are the reflexive, transitive and symmetrictype of the identity type. Those were not random choices. The main reason is the factthat reflexive, transitive and symmetric types are essential to the process of buildinga groupoid model for the identity type(HOFMANN; STREICHER, 1994). As we shall see,these constructions come naturally from simple computational paths constructed by theapplication of axioms of the equality of type theory.
Before we start the constructions, we think that it is essential to understand how to usethe eliminations rules. The process of building a term of some type is a matter of findingthe right reason. In the case of π½ , the reason is the correct π₯, π¦ : π΄ and π§ : πΌππ΄(π, π) thatgenerates the adequate πΆ(π₯, π¦, π§). In our approach, the reason is the correct path π =π π
that generates the adequate π(π, π) : πΌπ(π, π).
Chapter 4. Computational Paths 69
4.1.4.1 Reflexivity
One could find strange the fact that we need to prove the reflexivity. Nevertheless, justremember that our approach is not based on the idea that reflexivity is the base of theidentity type. As usual in type theory, a proof of something comes down to a constructionof a term of a type. In this case, we need to construct a term of type Ξ (π:π΄)πΌππ΄(π, π).The reason is extremely simple: from a term π : π΄, we obtain the computational pathπ =π π : π΄ (RAMOS; QUEIROZ; OLIVEIRA, 2017):
[π : π΄]π =π π : π΄
πΌπβ πΌπ(π, π) : πΌππ΄(π, π)
Ξ β πΌππ.π(π, π) : Ξ (π:π΄)πΌππ΄(π, π)
4.1.4.2 Symmetry
The second proposed construction is the symmetry. Our objective is to obtain a term oftype Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π)).
We construct a proof using computational paths. As expected, we need to find asuitable reason. Starting from π =π‘ π, we could look at the axioms of definition 4.1 toplan our next step. One of those axioms makes the symmetry clear: the π axiom. If weapply π, we will obtain π =π(π‘) π. From this, we can then infer that πΌππ΄ is inhabitedby (π(π‘))(π, π). Now, it is just a matter of applying the elimination (RAMOS; QUEIROZ;
OLIVEIRA, 2017):
[π : π΄] [π : π΄][π(π, π) : πΌππ΄(π, π)]
[π =π‘ π : π΄]π =π(π‘) π : π΄
πΌπβ πΌ(π(π‘))(π, π) : πΌππ΄(π, π)πΌπβ πΈ
π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : πΌππ΄(π, π)β βπΌ
ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : πΌππ΄(π, π) β πΌππ΄(π, π)Ξ β πΌ
ππ.ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))Ξ β πΌ
ππ.ππ.ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))
4.1.4.3 Transitivity
The third and last construction will be the transitivity. Our objective os to obtain a termof type Ξ (π:π΄)Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π) β πΌππ΄(π, π)).
To build our path-based construction, the first step, as expected, is to find the reason.Since we are trying to construct the transitivity, it is natural to think that we should start
Chapter 4. Computational Paths 70
with paths π =π‘ π and π =π’ π and then, from these paths, we should conclude that thereis a path π§ that establishes that π =π§ π. To obtain π§, we could try to apply the axiomsof definition 4.1. Looking at the axioms, one is exactly what we want: the axiom π . Ifwe apply π to π =π‘ π and π =π’ π, we will obtain a new path π(π‘, π’) such that π =π(π‘,π’) π.Using that construction as the reason, we obtain the following term (RAMOS; QUEIROZ;
OLIVEIRA, 2017):
Chapter 4. Computational Paths 71
[π:π΄
][π
:π΄]
[π€(π,π
):πΌπ
π΄(π,π
)]
[π:π΄
][π
(π,π
):πΌπ
π΄(π,π
)]
[π=
π‘π
:π΄]
[π=
π’π
:π΄]
π=
π(π‘
,π’)π
:π΄πΌπ
βπΌ
(π(π‘,π’
))(π,π
):πΌπ
π΄(π,π
)πΌπ
βπΈ
π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
)):πΌπ
π΄(π,π
)πΌπ
βπΈ
π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)β
βπΌ
ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)β
βπΌ
ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)Ξ
βπΌ
ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)Ξ
(π:π΄
)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)Ξ
(π:π΄
)Ξ (π
:π΄)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))
Chapter 4. Computational Paths 72
As one can see, each step is just straightforward applications of introduction, elimi-nation rules and abstractions. The only idea behind this construction is just the simplefact that the axiom π guarantees the transitivity of paths. If one compares the reason ofthis construction to the one that used π½ (we showed those constructions in chapter 2),one can clearly conclude that the reason of the path-based approach was obtained morenaturally.
4.2 TERM REWRITE SYSTEM
As we have just shown, a computational path establishes when two terms of the same typeare equal. From the theory of computational paths, an interesting case arises. Suppose wehave a path π that establishes that π =π π : π΄ and a path π‘ that establishes that π =π‘ π : π΄.Consider that π and π‘ are formed by distinct compositions of rewrites. Is it possible toconclude that there are cases that π and π‘ should be considered equivalent? The answeris yes. Consider the following examples (RAMOS, 2015):
Example 4.3. Consider the path π =π‘ π : π΄. By the symmetric property, we obtainπ =π(π‘) π : π΄. What if we apply the property again on the path π(π‘)? We would obtain apath π =π(π(π‘)) π : π΄. Since we applied symmetry twice in succession, we obtained a paththat is equivalent to the initial path π‘. For that reason, we conclude the act of applyingsymmetry twice in succession is a redundancy. We say that the path π(π(π‘)) should bereduced to the path π‘.
Example 4.4. Consider the reflexive path π =π π : π΄. It one applies the symmetricaxiom, one ends up with π =π(π) π : π΄. Thus, the obtained path is equivalent to the initialone, since the symmetry was applied to the reflexive path. Therefore, π(π) is a redundantway of expressing the path π. Thus, π(π) should be reduced to π.
Example 4.5. Consider a path π =π‘ π : π΄. Applying the symmetry, one ends up withπ =π(π‘) π : π΄. One can take those two paths and apply the transitivity, ending up withπ =π(π‘,π(π‘)) π. Since one path is the inverse of the other, the composition of those two pathsshould be equivalent to the reflexive path. Thus, π(π‘, π(π‘)) should be reduced to π.
As one could see in the aforementioned examples, different paths should be consideredequal if one is just a redundant form of the other. The examples that we have just seen arejust straightforward and simple cases. Since the equality theory has a total of 7 axioms,the possibility of combinations that could generate redundancies are high. Fortunately,all possible redundancies were thoroughly mapped by(OLIVEIRA, 1995). In that work, asystem that establishes all redundancies and creates rules that solve them was proposed.This system, known as πΏππ·πΈπ βππ π, maps a total of 39 rules that solve redundancies.
Chapter 4. Computational Paths 73
4.2.1 πΏππ·πΈπ β ππ π
In this subsection, we show the rules that compose the πΏππ·πΈπ β ππ π. All those rulescomes from the mapping of redundancies between computational paths, as we have seenin the 3 previous examples.
4.2.1.1 Subterm Substitution
Before we introduce the rewriting rules, it is important to introduce the concept of subtermsubstitution. In Equational Logic, the subterm substitution is given by the followinginference rule(OLIVEIRA; QUEIROZ, 1994):
π = π‘π π = π‘π
One problem is that such rule does not respect the sub-formula property. To deal withthat,(CHENADEC, 1989) proposes two inference rules:
π = π πΆ[π ] = ππΌπΏ
πΆ[π ] = π
π = πΆ[π ] π = ππΌπ
π = πΆ[π]
where M, N and O are terms.As proposed in (QUEIROZ; OLIVEIRA; RAMOS, 2016), we can define similar rules using
computational paths, as follows:
π₯ =π π[π¦] : π΄ π¦ =π π’ : π΄β²
π₯ =subL(π,π ) π[π’] : π΄π₯ =π π€ : π΄β² π[π€] =π π’ : π΄
π[π₯] =subR(π,π ) π’ : π΄
where πΆ is the context in which the sub-term detached by β[ ]β appears and π΄β² could bea sub-domain of π΄, equal to π΄ or disjoint to π΄.
In the rule above, π[π’] should be understood as the result of replacing every occurrenceof π¦ by π’ in πΆ.
4.2.1.2 Rewriting Rules
In this subsection, our objective is to show all rewrite reductions and their associatedrewriting rules. The idea is to analyze all possible occurrences of redundancies in proofswhich involves the rules of rewritings.
We start with the transitivity:
Definition 4.6 (reductions involving π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π¦ : π΄ π¦ =π(π) π₯ : π΄π₯ =π(π,π(π)) π₯ : π΄ βπ‘π π₯ =π π₯ : π΄
π¦ =π(π) π₯ : π΄ π₯ =π π¦ : π΄π¦ =π(π(π),π) π¦ : π΄ βπ‘π π π¦ =π π¦ : π΄
Chapter 4. Computational Paths 74
π’ =π π£ : π΄ π£ =π π£ : π΄π’ =π(π,π) π£ : π΄ βπ‘ππ π’ =π π£ : π΄
π’ =π π’ : π΄ π’ =π π£ : π΄π’ =π(π,π) π£ : π΄ βπ‘ππ π’ =π π£ : π΄
Associated rewriting rules:π(π, π(π)) βπ‘π π
π(π(π), π) βπ‘π π π
π(π, π) βπ‘ππ π
π(π, π) βπ‘ππ π.
These reductions can be generalized to transformations where the reasons π and π(π)(transf. 1 and 2) and π and π (transf. 3 and 4) appear in some context, as illustrated bythe following example: (QUEIROZ; OLIVEIRA; RAMOS, 2016):
Example 4.6.
π₯ =π π¦ : π΄π(π₯) =π1(π) π(π¦) : π΄+π΅
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄
π(π¦) =π1(π(π)) π(π₯) : π΄+π΅
π(π₯) =π(π1(π),π1(π(π))) π(π₯) : π΄+π΅
βπ‘ππ₯ =π π¦ : π΄
π(π₯) =π1(π) π(π¦) : π΄+π΅
Associated rewriting:π(π1(π), π1(π(π))) βπ‘π π1(π).
For the general context π[ ]:Associated rewritings:π(π[π], π[π(π)]) βπ‘π π[π]π(π[π(π)], π[π]) βπ‘π π π[π]π(π[π], π[π]) βπ‘ππ π[π]π(π[π], π[π]) βπ‘ππ π[π]
The transitivity rules are pretty straightforward. We have more complicated cases(QUEIROZ; OLIVEIRA; RAMOS, 2016):
Chapter 4. Computational Paths 75
Definition 4.7.
π : π΄
[π₯ : π΄]...
π(π₯) =π π(π₯) : π΅ππ₯.π(π₯) =π(π) ππ₯.π(π₯) : π΄ β π΅
β -intr
π΄ππ (ππ₯.π(π₯), π) =π(π(π)) π΄ππ (ππ₯.π(π₯), π) : π΅ β -elim
βππ₯ππ : π΄
π(π/π₯) =π π(π/π₯) : π΅
Associated rewriting rule:π(π(π)) βππ₯π π.
Definition 4.8 (reductions involving π and π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π₯ : π΄π₯ =π(π) π₯ : π΄ βπ π π₯ =π π₯ : π΄
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄π₯ =π(π(π)) π¦ : π΄ βπ π π₯ =π π¦ : π΄
Associated rewritings:π(π) βπ π π
π(π(π)) βπ π π
Definition 4.9 (Substitution rules (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π’ =π π[π₯] : π΄ π₯ =π π₯ : π΄β²
π’ =subL(π,π) π[π₯] : π΄ βπ ππ π’ =π π[π₯] : π΄
π₯ =π π₯ : π΄β² π[π₯] =π π§ : π΄π[π₯] =subR(π,π) π§ : π΄ βπ ππ π[π₯] =π π§ : π΄
π§ =π π[π¦] : π΄ π¦ =π π€ : π΄β²
π§ =subL(π ,π) π[π€] : π·π¦ =π π€ : π΄β²
π€ =π(π) π¦ : π·β²
π§ =subL(subL(π ,π),π(π)) π[π¦] : π΄ βπ ππ π§ =π π[π¦] : π΄
Chapter 4. Computational Paths 76
π§ =π π[π¦] : π΄ π¦ =π π€ : π΄β²
π§ =subL(π ,π) π[π€] : π΄π¦ =π π€ : π΄β²
π€ =π(π) π¦ : π΄β²
π§ =subL(subL(π ,π),π(π)) π[π¦] : π΄ βπ ππ π π§ =π π[π¦] : π΄
π₯ =π π€ : π΄β²
π₯ =π π€ : π΄β²
π€ =π(π ) π₯ : π΄β² π[π₯] =π π§ : π΄π[π€] =subR(π(π ),π) π§ : π΄
π[π₯] =subR(π ,subR(π(π ),π)) π§ : π΄ βπ ππ π[π₯] =π π§ : π΄
π₯ =π π€ : π΄β²
π€ =π(π ) π₯ : π΄β²π₯ =π π€ : π΄β² π[π€] =π π§ : π΄
π[π₯] =subR(π ,π) π§ : π΄π[π€] =subR(π(π ),subR(π ,π)) π§ : π΄ βπ πππ π[π€] =π π§ : π΄
Associated rewritings:subL(π[π], π[π]) βπ ππ π[π]subR(π[π], π[π]) βπ ππ π[π]subL(subL(π , π[π]), π[π(π)]) βπ ππ π
subL(subL(π , π[π(π)]), π[π]) βπ ππ π π
subR(π , subR(π[π(π )], π)) βπ ππ π
subR(π[π(π )], subR(π[π ], π)) βπ πππ π
Definition 4.10 ((QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π½πππ€π-Γ-reductionπ₯ =π π¦ : π΄ π§ : π΅
β¨π₯, π§β© =π1(π) β¨π¦, π§β© : π΄Γπ΅Γ -intr
πΉππ (β¨π₯, π§β©) =π1(π1(π)) πΉππ (β¨π¦, π§β©) : π΄ Γ -elim
βππ₯2π π₯ =π π¦ : π΄
π₯ =π π₯β² : π΄ π¦ =π π§ : π΅
β¨π₯, π¦β© =πβ§(π,π ) β¨π₯β², π§β© : π΄Γπ΅Γ -intr
πΉππ (β¨π₯, π¦β©) =π1(πβ§(π,π )) πΉππ (β¨π₯β², π§β©) : π΄ Γ -elim
βππ₯2π π₯ =π π₯β² : π΄
π₯ =π π¦ : π΄ π§ =π π€ : π΅β¨π₯, π§β© =πβ§(π,π ) β¨π¦, π€β© : π΄Γπ΅
Γ -intr
πππ·(β¨π₯, π§β©) =π2(πβ§(π,π )) πππ·(β¨π¦, π€β©) : π΅ Γ -elim
βππ₯2π π§ =π π€ : π΅
π₯ : π΄ π§ =π π€ : π΅β¨π₯, π§β© =π2(π ) β¨π₯,π€β© : π΄Γπ΅
Γ -intr
πππ·(β¨π₯, π§β©) =π2(π2(π )) πππ·(β¨π₯,π€β©) : π΅ Γ -elim
Chapter 4. Computational Paths 77
βππ₯2π π§ =π π€ : π΅
Associated rewritings:π1(π1(π)) βππ₯2π1 π
π1(πβ§(π, π )) βππ₯2π2 π
π2(πβ§(π, π )) βππ₯2π1 π
π2(π2(π )) βππ₯2π2 π
π½πππ€π-+-reductionπ =π π
β² : π΄π(π) =π1(π) π(πβ²) : π΄+π΅
+ -intr [π₯ : π΄]π(π₯) =π π(π₯) : πΆ
[π¦ : π΅]π(π¦) =π’ β(π¦) : πΆ
π·(π(π), οΏ½ΜοΏ½π(π₯), π¦π(π¦)) =π(π1(π),π ,π’) π·(π(πβ²), οΏ½ΜοΏ½π(π₯), π¦β(π¦)) : πΆ + -elim
βππ₯3ππ =π π
β² : π΄π(π/π₯) =π π(πβ²/π₯) : πΆ
π =π πβ² : π΅
π(π) =π2(π) π(πβ²) : π΄+π΅+ -intr [π₯ : π΄]
π(π₯) =π π(π₯) : πΆ[π¦ : π΅]
π(π¦) =π’ β(π¦) : πΆπ·(π(π), οΏ½ΜοΏ½π(π₯), π¦π(π¦)) =π(π2(π),π ,π’) π·(π(πβ²), οΏ½ΜοΏ½π(π₯), π¦β(π¦)) : πΆ + -elim
βππ₯3ππ =π π
β² : π΅π(π/π¦) =π’ β(πβ²/π¦) : πΆ
Associated rewritings:π(π1(π), π , π’) βππ₯3π π
π(π2(π), π , π’) βππ₯3π π’
π½πππ€π-Ξ -reduction
π : π΄
[π₯ : π΄]π(π₯) =π π(π₯) : π΅(π₯)
ππ₯.π(π₯) =π(π) ππ₯.π(π₯) : Ξ π₯ : π΄.π΅(π₯)π΄ππ (ππ₯.π(π₯), π) =π(π(π)) π΄ππ (ππ₯.π(π₯), π) : π΅(π)
βππ₯ππ : π΄
π(π/π₯) =π π(π/π₯) : π΅(π)
Associated rewriting:π(π(π)) βππ₯π π
π½πππ€π-Ξ£-reductionπ =π π
β² : π΄ π(π) : π΅(π)ππ₯.(π(π₯), π) =π1(π) ππ₯.(π(π₯), πβ²) : Ξ£π₯ : π΄.π΅(π₯)
[π‘ : π΄, π(π‘) : π΅(π‘)]π(π, π‘) =π β(π, π‘) : πΆ
πΈ(ππ₯.(π(π₯), π), ππ‘π(π, π‘)) =π(π1(π),π ) πΈ(ππ₯.(π(π₯), πβ²), ππ‘β(π, π‘)) : πΆ
βππ₯ππ =π π
β² : π΄ π(π) : π΅(π)π(π/π, π/π‘) =π β(π/π, πβ²/π‘) : πΆ
π : π΄ π(π) =π π(π) : π΅(π)ππ₯.(π(π₯), π) =π2(π) ππ₯.(π(π₯), π) : Ξ£π₯ : π΄.π΅(π₯)
[π‘ : π΄, π(π‘) : π΅(π‘)]π(π, π‘) =π β(π, π‘) : πΆ
πΈ(ππ₯.(π(π₯), π), ππ‘π(π, π‘)) =π(π2(π),π ) πΈ(ππ₯.(π(π₯), π), ππ‘β(π, π‘)) : πΆ
Chapter 4. Computational Paths 78
βππ₯ππ : π΄ π(π) =π π(π) : π΅(π)π(π/π, π/π‘) =π β(π/π, π/π‘) : πΆ
Associated rewritings:π(π1(π), π ) βππ₯π π
π(π2(π), π ) βππ₯π π
Definition 4.11 (ππππ€π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
ππππ€π- Γ-reductionπ₯ =π π¦ : π΄Γπ΅
πΉππ (π₯) =π1(π) πΉππ (π¦) : π΄ Γ -elim π₯ =π π¦ : π΄Γπ΅
πππ·(π₯) =π2(π) πππ·(π¦) : π΅ Γ -elim
β¨πΉππ (π₯), πππ·(π₯)β© =π(π1(π),π2(π)) β¨πΉππ (π¦), πππ·(π¦)β© : π΄Γπ΅Γ -intr
βππ₯ π₯ =π π¦ : π΄Γπ΅
ππππ€π- +-reduction
π =π‘ π : π΄+π΅
[π1 =π π2 : π΄]π(π1) =π1(π) π(π2) : π΄+π΅
+ -intr [π1 =π π2 : π΅]π(π1) =π2(π ) π(π2) : π΄+π΅
+ -intr
π·(π, π1π(π1), π1π(π1)) =π(π‘,π1(π),π2(π )) π·(π, π2π(π2), π2π(π2))+ -elim
βππ₯π₯ π =π‘ π : π΄+π΅
Ξ -ππππ€π-reduction[π‘ : π΄] π =π π : Ξ π₯ : π΄.π΅(π₯)
π΄ππ (π, π‘) =π(π) π΄ππ (π, π‘) : π΅(π‘)Ξ -elim
ππ‘.π΄ππ (π, π‘) =π(π(π)) ππ‘.π΄ππ (π, π‘) : Ξ π‘ : π΄.π΅(π‘)Ξ -intr
βπ₯ππ π =π π : Ξ π₯ : π΄.π΅(π₯)where π and π do not depend on π₯.
Ξ£-ππππ€π-reduction
π =π π : Ξ£π₯ : π΄.π΅(π₯)[π‘ : π΄] [π(π‘) =π β(π‘) : π΅(π‘)]
ππ¦.(π(π¦), π‘) =π2(π) ππ¦.(β(π¦), π‘) : Ξ£π¦ : π΄.π΅(π¦)Ξ£-intr
πΈ(π, ππ‘ππ¦.(π(π¦), π‘)) =π(π ,π2(π)) πΈ(π, βΜπ‘ππ¦.(β(π¦), π‘)) : Ξ£π¦ : π΄.π΅(π¦)Ξ£-elim
βππ₯ππ π =π π : Ξ£π₯ : π΄.π΅(π₯)
Associated rewritings:π(π1(π), π2(π)) βππ₯ π
π(π‘, π1(π), π2(π )) βππ₯π₯ π‘
π(π(π)) βπ₯ππ π
π(π , π2(π)) βππ₯ππ π
Definition 4.12 (π and π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
Chapter 4. Computational Paths 79
π₯ =π π¦ : π΄ π¦ =π π€ : π΄π₯ =π(π,π ) π€ : π΄π€ =π(π(π,π )) π₯ : π΄ βπ π‘π π
π¦ =π π€ : π΄π€ =π(π ) π¦ : π΄
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄
π€ =π(π(π ),π(π)) π₯ : π΄
Associated rewriting:π(π(π, π )) βπ π‘π π π(π(π ), π(π))
Definition 4.13 (π and sub (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π[π¦] : π΄ π¦ =π π€ : π΄β²
π₯ =subL(π,π ) π[π€] : π΄π[π€] =π(subL(π,π )) π₯ : π΄ βπ π ππ
π¦ =π π€ : π΄β²
π€ =π(π ) π¦ : π΄β²π₯ =π π[π¦] : π΄
π[π¦] =π(π) π₯ : π΄π[π€] =subR(π(π ),π(π)) π₯ : π΄
π₯ =π π¦ : π΄β² π[π¦] =π π€ : π΄π[π₯] =subR(π,π ) π€ : π΄π€ =π(subR(π,π )) π[π₯] : π· βπ π ππ
π[π¦] =π π€ : π΄π€ =π(π ) π[π¦] : π΄
π₯ =π π¦ : π΄β²
π¦ =π(π) π₯ : π΄β²
π€ =subL(π(π ),π(π)) π[π₯] : π΄
Associated rewritings:π(subL(π, π )) βπ π ππ subR(π(π ), π(π))π(subR(π, π )) βπ π ππ subL(π(π ), π(π))
Definition 4.14 (π and π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π¦ : π΄π(π₯) =π1(π) π(π¦) : π΄+π΅
π(π¦) =π(π1(π)) π(π₯) : π΄+π΅βπ π₯
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄
π(π¦) =π1(π(π)) π(π₯) : π΄+π΅
π₯ =π π¦ : π΄ π§ =π π€ : π΅β¨π₯, π§β© =π(π,π ) β¨π¦, π€β© : π΄Γπ΅
β¨π¦, π€β© =π(π(π,π )) β¨π₯, π§β© : π΄Γπ΅βπ π₯π π
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄
π§ =π π€ : π΅π€ =π(π ) π§ : π΅
β¨π¦, π€β© =π(π(π),π(π )) β¨π₯, π§β© : π΄Γπ΅
[π₯ : π΄]π(π₯) =π π(π₯) : π΅(π₯)
ππ₯.π(π₯) =π(π ) ππ₯.π(π₯) : Ξ π₯ : π΄.π΅(π₯)ππ₯.π(π₯) =π(π(π )) ππ₯.π(π₯) : Ξ π₯ : π΄.π΅(π₯) βπ ππ π
[π₯ : π΄]π(π₯) =π π(π₯) : π΅(π₯)π(π₯) =π(π ) π(π₯) : π΅(π₯)
ππ₯.π(π₯) =π(π(π )) ππ₯.π(π₯) : Ξ π₯ : π΄.π΅(π₯)
Chapter 4. Computational Paths 80
Associated rewritings:π(π(π)) βπ π₯ π(π(π))π(π(π, π )) βπ π₯π π π(π(π), π(π ))π(π(π ) βπ ππ π π(π(π ))
Definition 4.15 (π and π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π¦ : π΄Γπ΅
πΉππ (π₯) =π1(π) πΉππ (π¦) : π΄πΉππ (π¦) =π(π1(π)) πΉππ (π₯) : π΄ βπ π
π₯ =π π¦ : π΄Γπ΅
π¦ =π(π) π₯ : π΄Γπ΅
πΉππ (π¦) =π1(π(π)) πΉππ (π₯) : π΄
π₯ =π π¦ : π΄Γπ΅
πππ·(π₯) =π2(π) πππ·(π¦) : π΄πππ·(π¦) =π(π2(π)) πππ·(π₯) : π΄ βπ π
π₯ =π π¦ : π΄Γπ΅
π¦ =π(π) π₯ : π΄Γπ΅
πππ·(π¦) =π2(π(π)) πππ·(π₯) : π΄
π₯ =π π¦ : π΄ π =π π : π΄ β π΅
π΄ππ (π, π₯) =π(π ,π) π΄ππ (π, π¦) : π΅π΄ππ (π, π¦) =π(π(π ,π)) π΄ππ (π, π₯) : π΅
βπ ππ π
π₯ =π π¦ : π΄π¦ =π(π ) π₯ : π΄
π =π π : π΄ β π΅
π =π(π) π : π΄ β π΅
π΄ππ (π, π¦) =π(π(π ),π(π)) π΄ππ (π, π₯) : π΅
π₯ =π π¦ : π΄+π΅
[π : π΄]...
π(π ) =π’ π(π ) : πΆ
[π‘ : π΅]...
π(π‘) =π£ π(π‘) : πΆπ·(π₯, π π(π ), π‘π(π‘)) =π(π,π’,π£) π·(π¦, π π(π ), π‘π(π‘)) : πΆ
π·(π¦, π π(π ), π‘π(π‘)) : πΆ =π(π(π,π’,π£)) π·(π₯, π π(π ), π‘π(π‘)) : πΆ
βπ ππ π π
π₯ =π π¦ : π΄+π΅π¦ =π(π) π₯ : π΄+π΅
[π : π΄]π(π ) =π’ π(π ) : πΆπ(π ) =π(π’) π(π ) : πΆ
[π‘ : π΅]π(π‘) =π£ π(π‘) : πΆπ(π‘) =π(π£) π(π‘) : πΆ
π·(π¦, π π(π ), π‘π(π‘)) =π(π(π),π(π’),π(π£)) π·(π₯, π π(π ), π‘π(π‘)) : πΆ
π =π π : Ξ£π₯ : π΄.π΅(π₯)[π‘ : π΄, π(π‘) : π΅(π‘)]π(π, π‘) =π π(π, π‘) : πΆ
πΈ(π, ππ‘π(π, π‘)) =π(π ,π) πΈ(π, ππ‘π(π, π‘)) : πΆπΈ(π, ππ‘π(π, π‘)) =π(π(π ,π)) πΈ(π, ππ‘π(π, π‘)) : πΆ
βπ ππ π
π =π π : Ξ£π₯ : π΄.π΅(π₯)π =π(π ) π : Ξ£π₯ : π΄.π΅(π₯)
[π‘ : π΄, π(π‘) : π΅(π‘)]π(π, π‘) =π π(π, π‘) : πΆπ(π, π‘) =π(π) π(π, π‘) : πΆ
πΈ(π, ππ‘π(π, π‘)) =π(π(π ),π(π)) πΈ(π, ππ‘π(π, π‘)) : πΆ
Associated rewritings:π(π1(π)) βπ π π1(π(π))
Chapter 4. Computational Paths 81
π(π2(π)) βπ π π2(π(π))π(π(π , π)) βπ ππ π π(π(π ), π(π))π(π(π, π’, π£)) βπ ππ π π π(π(π), π(π’), π(π£))
Definition 4.16 (π and sub (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π π[π¦] : π΄ π¦ =π π€ : π΄β²
π₯ =subL(π,π ) π[π€] : π΄ π[π€] =π‘ π§ : π΄π₯ =π(subL(π,π ),π‘) π§ : π΄
βπ‘π πππ
π₯ =π π[π¦] : π΄π¦ =π π€ : π΄β² π[π€] =π‘ π§ : π΄
π[π¦] =subR(π ,π‘) π§ : π΄π₯ =π(π,subR(π ,π‘)) π§ : π΄
π¦ =π π€ : π΄ π[π€] =π‘ π§ : π΄π[π¦] =subR(π ,π‘) π§ : π΄ π§ =π’ π£ : π΄
π[π¦] =π(subR(π ,π‘),π’) π£ : π΄
βπ‘π πππ
π¦ =π π€ : π·β²π[π€] =π‘ π§ : π΄ π§ =π’ π£ : π΄
π[π€] =π(π‘,π’) π£ : π΄π[π¦] =subR(π ,π(π‘,π’)) π£ : π΄
π₯ =π π[π§] : π΄π[π§] =π π[π§] : π΄ π§ =π π€ : π΄β²
π[π§] =subL(π,π ) π[π€] : π΄π₯ =π(π,subL(π,π )) π[π€] : π΄
βπ‘π ππππ₯ =π π[π§] : π΄ π§ =π π€ : π΄β²
π₯ =subL(π,π ) π[π€] : π΄
π₯ =π π[π€] : π΄π€ =π π§ : π΄β² π[π§] =π π[π§] : π΄
π[π€] =subR(π ,π) π[π§] : π΄π₯ =π(π,subR(π ,π)) π[π§] : π΄
βπ‘π ππππ₯ =π π[π€] : π· π€ =π π§ : π΄β²
π₯ =subL(π,π ) π[π§] : π΄
Definition 4.17 (π and π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).
π₯ =π‘ π¦ : π΄ π¦ =π π€ : π΄π₯ =π(π‘,π) π€ : π΄ π€ =π π§ : π΄
π₯ =π(π(π‘,π),π ) π§ : π΄
βπ‘π‘
π₯ =π‘ π¦ : π΄π¦ =π π€ : π΄ π€ =π π§ : π΄
π¦ =π(π,π ) π§ : π΄π₯ =π(π‘,π(π,π )) π§ : π΄
Associated rewritings:π(subL(π, π ), π‘) βπ‘π πππ π(π, subR(π , π‘))π(subR(π , π‘), π’)) βπ‘π πππ subR(π , π(π‘, π’))
Chapter 4. Computational Paths 82
π(π, subL(π, π )) βπ‘π πππ subL(π, π )π(π, subR(π , π)) βπ‘π πππ subL(π, π )π(π(π‘, π), π ) βπ‘π‘ π(π‘, π(π, π ))
Thus, we put together all those rules to compose our rewrite system:
Definition 4.18 (πΏππ·πΈπ β ππ π (QUEIROZ; OLIVEIRA; RAMOS, 2016)).1. π(π) βπ π π
2. π(π(π)) βπ π π
3. π(π[π], π[π(π)]) βπ‘π π[π]4. π(π[π(π)], π[π]) βπ‘π π π[π]5. π(π[π], π[π]) βπ‘ππ π[π]6. π(π[π], π[π]) βπ‘ππ π[π]7. subL(π[π], π[π]) βπ ππ π[π]8. subR(π[π], π[π]) βπ ππ π[π]9. subL(subL(π , π[π]), π[π(π)]) βπ ππ π
10. subL(subL(π , π[π(π)]), π[π]) βπ ππ π π
11. subR(π[π ], subR(π[π(π )], π)) βπ ππ π
12. subR(π[π(π )], subR(π[π ], π)) βπ πππ π
13. π1(π1(π)) βππ₯2π1 π
14. π1(πβ§(π, π )) βππ₯2π2 π
15. π2(πβ§(π, π )) βππ₯2π1 π
16. π2(π2(π )) βππ₯2π2 π
17. π(π1(π), π , π’) βππ₯3π π
18. π(π2(π), π , π’) βππ₯3π π’
19. π(π(π)) βππ₯π π
20. π(π2(π), π ) βππ₯π π
21. π(π1(π), π2(π)) βππ₯ π
22. π(π‘, π1(π), π2(π )) βππ₯π₯ π‘
23. π(π(π)) βπ₯ππ π
24. π(π , π2(π)) βππ₯1π π
25. π(π(π, π )) βπ π‘π π π(π(π ), π(π))26. π(subL(π, π )) βπ π ππ subR(π(π ), π(π))27. π(subR(π, π )) βπ π ππ subL(π(π ), π(π))28. π(π(π)) βπ π₯ π(π(π))29. π(π(π , π)) βπ π₯π π π(π(π ), π(π))30. π(π(π)) βπ π π(π(π))31. π(π(π , π)) βπ ππ π π(π(π ), π(π))32. π(π(π, π’, π£)) βπ ππ π π π(π(π), π(π’), π(π£))33. π(π, subL(π, π )) βπ‘π πππ subL(π, π )
Chapter 4. Computational Paths 83
34. π(π, subR(π , π)) βπ‘π πππ subL(π, π )35. π(subL(π, π ), π‘) βπ‘π πππ π(π, subR(π , π‘))36. π(subR(π , π‘), π’) βπ‘π πππ subR(π , π(π‘, π’))37. π(π(π‘, π), π ) βπ‘π‘ π(π‘, π(π, π ))38. π(π[π’], π(π[π(π’)], π£)) βπ‘π‘π π£
39. π(π[π(π’)], π(π[π’], π£)) βπ‘π π‘ π’.
4.2.2 Normalization
In the previous subsection, we have seen a system of rewrite rules that resolves reductionsin a computational path. When we talk about these kind of systems, two questions arise:Every computational path has a normal form? And if a computational path has a normalform, is it unique? To show that it has a normal form, one has to prove that everycomputational path terminates, i.e., after a finite number of rewrites, one will end upwith a path that does not have any additional reduction. To show that it is unique, oneneeds to show that the system is confluent. In other words, if one has a path with 2 ormore reductions, one needs to show that the choice of the rewrite rule does not matter.In the end, one will always obtain the same end-path without any redundancies.
4.2.2.1 Termination
We are interested in the following theorem (QUEIROZ; OLIVEIRA; GABBAY, 2011; QUEIROZ;
OLIVEIRA; RAMOS, 2016):
Theorem 4.1 (Termination property for πΏππ·πΈπβππ π). πΏππ·πΈπβππ π is terminating.
The proofs uses a special kind of ordering, known as recursive parth ordering, proposedby (DERSHOWITZ, 1982):
Definition 4.19 (Recursive path ordering (DERSHOWITZ, 1982; QUEIROZ; OLIVEIRA;
RAMOS, 2016)). Let > be a partial ordering on a set of operators F. The recursive pathordering >* on the set T(F) of terms over F is defined recursively as follows:
π = π(π 1, . . . , π π) >* π(π‘1, . . . , π‘π) = π‘,
if and only if
1. π = π and {π 1, . . . , π π} β«* {π‘1, . . . , π‘π}, or
2. π > π and {π } β«* {π‘1, . . . , π‘π}, or
3. π οΏ½ π and {π 1, . . . , π π} β«* or = {π‘}
where β«* is the extension of >* to multisets.
Chapter 4. Computational Paths 84
This definition uses the notion of partial ordering in multisets. A given partial ordering> on a set π may be extended to a partial ordering β« on finite multisets of elements ofπ, wherein a multiset is reduced by removing one or more elements and replacing themwith any finite number of elements, each oh which is smaller than one of the elementsremoved (DERSHOWITZ, 1982).
Thus, one can proof the termination property by showing that all rules π β π of thesystem, one has that π >* π.
We also need to define the precedence ordering on the rewrite operators. We define asfollows (QUEIROZ; OLIVEIRA; RAMOS, 2016; QUEIROZ; OLIVEIRA; GABBAY, 2011):
π > π > π,
π > π,
π > πβ§,
π > π1,
π > π2,
π > π,
π > π1,
π > π2,
π > subL,
π > subR,
π > subL
Thus, one can prove the termination by showing that for every rule of π β π ofπΏππ·πΈπ βππ π, π >* π. For almost every rule it is a straightforward and tedious process.We are not going to show those steps in this work. One can check the full proof in(QUEIROZ; OLIVEIRA; GABBAY, 2011).
4.2.2.2 Confluence
Before we go to the proof of confluence, one needs to notice that πΏππ·πΈπβππ π is a condi-tional term rewriting system. This means that some rules can only be applied if the termsof the associated equation follow some rules. For example, for the rule π1(πβ§(π, π ))βππ₯2π2 π,it is necessary to have an π½-redex like πΉππ β¨π₯, π¦β©. With that in mind, one has the followingdefinition (QUEIROZ; OLIVEIRA; GABBAY, 2011):
Definition 4.20 (Conditional term rewriting system). In conditional term rewriting sys-tems, the rules have conditions attached, which must be true for the rewrite occur. Forexample, a rewrite rule π β π with condition πΆ is expressed as:
πΆ|π β π
Chapter 4. Computational Paths 85
To prove the confluence, one should analyze all possible critical pairs using the su-perposition algorithm proposed by (KNUTH; BENDIX, 1970). Thus, there should not beany divergent critical pair. For example, one can take the superposition of rules 1 and 2,obtaining: π(π(π)). We have two possible rewrites (QUEIROZ; OLIVEIRA; GABBAY, 2011):
β’ π(π(π)) Bπ π π(π) Bπ π π
β’ π(π(π)) Bπ π π.
As one can see, we ended up with the same term π. Thus, no divergence has beengenerated.
One should compare every pair of rules to find all critical pairs and see if there are di-vergences. If some divergence happens, the superposition algorithm proposed by (KNUTH;
BENDIX, 1970) shows how to add new rules to the system in such a way that it be-comes confluent. As a matter of fact, that was the reason why the rules 38 and 39 ofπΏππ·πΈπ βππ π have been introduced to the system (QUEIROZ; OLIVEIRA; RAMOS, 2016):
38. π(π[π’], π(π[π(π’)], π£)) βπ‘π‘π π£
39. π(π[π(π’)], π(π[π’], π£)) βπ‘π π‘ π’.
Those two rules introduced the following reductions to the system (QUEIROZ; OLIVEIRA;
GABBAY, 2011):
π₯ =π π’ : π·
π₯ =π π’ : π·π’ =π(π ) π₯ : π· π₯ =π£ π€ : π·
π’ =π(π(π ),π£) π€ : π·Bπ‘π‘π π₯ =π£ π€
π₯ =π(π ,π(π(π ),π£)) π€ : π·
π₯ =π π€ : π·π€ =π(π ) π₯ : π·
π₯ =π π€ : π· π€ =π£ π§ : π·π₯ =π(π ,π£) π§ : π·
Bπ π π€ =π£ π§π€ =π(π(π ),π(π ,π£)) π§ : π·
One can check a full proof of confluence in (OLIVEIRA, 1995; OLIVEIRA; QUEIROZ,1994; OLIVEIRA; QUEIROZ, 1999; QUEIROZ; OLIVEIRA; GABBAY, 2011).
4.2.2.3 Normalization Procedure
We can now state two normalization theorems:
Theorem 4.2 (normalization (QUEIROZ; OLIVEIRA; GABBAY, 2011)). Every derivationin the πΏππ·πΈπ β ππ π converts to a normal form.
Chapter 4. Computational Paths 86
Proof. Direct consequence of the termination property.
Theorem 4.3 (strong normalization (QUEIROZ; OLIVEIRA; GABBAY, 2011)). Every deriva-tion in the πΏππ·πΈπ β ππ π converts to a unique normal form.
Proof. Direct consequence of the termination and confluence properties.
In this sense, every proof can be reduced to a normal one. To do that, one shouldidentify the redundancies and, based on the rewrite rules, one can construct a proofwithout any redundancies. We show that in an example. It is the following (QUEIROZ;
OLIVEIRA; GABBAY, 2011):
π(π₯, π§) =π π(π€, π¦) : π·π(π€, π¦) =π(π ) π(π₯, π§) : π· π₯ =π π : π·
π(π€, π¦) =π π’ππΏ(π(π ),π) π(π, π§) : π·π(π, π§) =π(π π’ππΏ(π(π ),π)) π(π€, π¦) : π· π¦ =π‘ π : π·
π(π, π§) =π π’ππΏ(π(π π’ππΏ(π(π ),π))) π(π€, π) : π·
This deduction generates the following path: π π’ππΏ(π(π π’ππΏ(π(π ), π))). This path is notin normal form, having two redundancies (QUEIROZ; OLIVEIRA; GABBAY, 2011):
π π’ππΏ(π(π π’ππΏ(π(π ), π))) Bπ π ππ π π’ππΏ(π π’ππ (π(π), π(π(π )), π‘)π π’ππΏ(π π’ππ (π(π), π(π(π )), π‘) Bπ π π π’ππΏ(π π’ππ (π(π), π ), π‘)
Thus, one can identify those reductions and conceive a deduction without any redun-dancies (QUEIROZ; OLIVEIRA; GABBAY, 2011):
π₯ =π π : π·π =π(π) π₯ : π· π(π₯, π§) =π π(π€, π¦) : π·
π(π, π§) =π π’ππ (π(π),π ) π(π€, π¦) : π· π¦ =π‘ π : π·π(π, π§) =π π’ππΏ(π π’ππ (π(π),π ),π‘) π(π€, π) : π·
4.2.3 Rewrite Equality
As we have just seen, the πΏππ·πΈπ β ππ π has 39 rewrite rules. We call each rule as arewrite rule (abbreviation: rw-rule). We have the following definition:
Definition 4.21 (Rewrite Rule (RAMOS; QUEIROZ; OLIVEIRA, 2017)). An ππ€-rule is anyof the rules defined in πΏππ·πΈπ β ππ π.
Similarly to the π½-reduction of π-calculus, we have a definition for rewrite reduction:
Chapter 4. Computational Paths 87
Definition 4.22 (Rewrite reduction (RAMOS; QUEIROZ; OLIVEIRA, 2017)). Let π and π‘ becomputational paths. We say that π B1ππ€ π‘ (read as: π ππ€-contracts to π‘) iff we can obtainπ‘ from π by an application of only one ππ€-rule. If π can be reduced to π‘ by finite numberof ππ€-contractions, then we say that π Bππ€ π‘ (read as π ππ€-reduces to π‘).
We also have rewrite contractions and equality:
Definition 4.23 (Rewrite contraction and equality (RAMOS; QUEIROZ; OLIVEIRA, 2017)).Let π and π‘ be computational paths. We say that π =ππ€ π‘ (read as: π is ππ€-equal to π‘) iff π‘
can be obtained from π by a finite (perhaps empty) series of ππ€-contractions and reversedππ€-contractions. In other words, π =ππ€ π‘ iff there exists a sequence π 0, ...., π π, with π β₯ 0,such that
(βπ β€ πβ 1)(π π B1ππ€ π π+1 or π π+1 B1ππ€ π π)π 0 β‘ π , π π β‘ π‘
A fundamental result is the fact that rewrite equality is an equivalence relation(RAMOS; QUEIROZ; OLIVEIRA, 2017):
Proposition 4.1. Rewrite equality is transitive, symmetric and reflexive.
Proof. Comes directly from the fact that ππ€-equality is the transitive, reflexive and sym-metric closure of ππ€.
Rewrite reduction and equality play fundamental roles in the groupoid model of a typebased on computational paths, as we are going to see in the sequel.
4.2.4 πΏππ·πΈπ β ππ π2
Until now, this subsection has concluded that there exist redundancies which are resolvedby a system called πΏππ·πΈπ β ππ π. This system establishes rules that reduces theseredundancies. Moreover, we concluded that these redundancies are just redundant usesof the equality axioms showed in section 2. In fact, since these axioms just define anequality theory for type theory, one can specify and say that these are redundancies ofthe equality of type theory. As we mentioned, the πΏππ·πΈπ β ππ π has a total of 39rules(OLIVEIRA, 1995; QUEIROZ; OLIVEIRA; RAMOS, 2016). Since the ππ€-equality is basedon the rules of πΏππ·πΈπ β ππ π, one can just imagine the high number of redundanciesthat ππ€-equality could cause. In fact, a thoroughly study of all the redundancies causedby these rules could generate an entire new work. Fortunately, we are only interested inthe redundancies caused by the fact that ππ€-equality is transitive, reflexive and symmetricwith the addition of only one specific ππ€2-rule. Letβs say that we have a system, calledπΏππ·πΈπ βππ π2, that resolves all the redundancies caused by ππ€-equality (the same waythat πΏππ·πΈπβππ π resolves all the redundancies caused by equality). Since we know thatππ€-equality is transitive, symmetric and reflexive, it should have the same redundancies
Chapter 4. Computational Paths 88
that the equality had involving only these properties. Since ππ€-equality is just a sequenceof ππ€-rules (also similar to equality, since equality is just a computational path, i.e., asequence of identifiers), then we could put a name on these sequences. For example, if π and π‘ are ππ€-equal because there exists a sequence π : π 0, ...., π π that justifies the ππ€-equality, then we can write that π =ππ€π
π‘. Thus, we can rewrite, using ππ€-equality, allthe rules that originated the rules involving π , π and π. For example, we have (RAMOS;
QUEIROZ; OLIVEIRA, 2017):
π₯ =ππ€π‘ π¦ : π΄ π¦ =ππ€π π€ : π΄π₯ =ππ€π(π‘,π) π€ : π΄ π€ =ππ€π π§ : π΄
π₯ =ππ€π(π(π‘,π),π ) π§ : π΄
π₯ =ππ€π‘ π¦ : π΄π¦ =ππ€π π€ : π΄ π€ =ππ€π π§ : π΄
π¦ =ππ€π(π,π ) π§ : π΄Bπ‘π‘2 π₯ =ππ€π(π‘,π(π,π )) π§ : π΄
Therefore, we obtain the rule π‘π‘2, that resolves one of the redundancies caused by thetransitivity of ππ€-equality (the 2 in π‘π‘2 indicates that it is a rule that resolves a redundancyof ππ€-equality). In fact, using the same reasoning, we can obtain, for ππ€-equality, all theredundancies that we have shown in definition 4.18. In other words, we have π‘π2, π‘π π2,π‘ππ2, π‘ππ2, π π2, π π 2 and π‘π‘2. Since we have now rules of πΏππ·πΈπ β ππ π2, we can use allthe concepts that we have just defined for πΏππ·πΈπ β ππ π. The only difference is thatinstead of having ππ€-rules and ππ€-equality, we have ππ€2-rules and ππ€2-equality.
There is an important rule specific to this system. It stems from the fact that transi-tivity of reducible paths can be reduced in different ways, but generating the same result.For example, consider the simple case of π(π , π‘) and consider that it is possible to reduceπ to π β² and π‘ to π‘β². There is two possible ππ€-sequences that reduces this case: The first oneis π : π(π , π‘) B1ππ€ π(π β², π‘) B1ππ€ π(π β², π‘β²) and the second πβ² : π(π , π‘) B1ππ€ π(π , π‘β²) B1ππ€ π(π β², π‘β²).Both ππ€-sequences obtained the same result in similar ways, the only difference being thechoices that have been made at each step. Since the variables, when considered individ-ually, followed the same reductions, these ππ€-sequences should be considered redundantrelative to each other and, for that reason, there should be ππ€2-rule that establishes thisreduction. This rule is called independence of choice and is denoted by ππ2. Since wealready understand the necessity of such a rule, we can define it formally:
Definition 4.24 (Independence of choice (RAMOS; QUEIROZ; OLIVEIRA, 2017)). Let πand π be ππ€-equalities expressed by two ππ€-sequences: π : π1, ..., ππ, with π β₯ 1, andπ : π1, ..., ππ, with π β₯ 1. Let π be the set of all possible ππ€-equalities from π(π1, π1)to π(ππ, ππ) described by the following process: π‘ β π is of the form π(ππ1 , ππ1) B1ππ€
π(ππ2 , ππ2) B1ππ€ ... B1ππ€ π(πππ₯ , πππ¦), with π1 = 1, π1 = 1, ππ₯ = π, ππ¦ = π and ππ+1 = 1 + ππ
Chapter 4. Computational Paths 89
and ππ+1 = ππ or ππ+1 = ππ and ππ+1 = 1 + ππ. The independence of choice, denoted by ππ2,is defined as the rule of πΏππ·πΈπ β ππ π2 that establishes the equality between any twodifferent terms of π . In other words, if π₯, π¦ β π and π₯ ΜΈ= π¦, then π₯ =ππ2 π¦ and π¦ =ππ2 π₯.
Analogously to the ππ€-equality, ππ€2-equality is also an equivalence relation (RAMOS;
QUEIROZ; OLIVEIRA, 2017):
Proposition 4.2. ππ€2-equality is transitive, symmetric and reflexive.
Proof. Analogous to Proposition 4.1.
4.3 GROUPOID MODEL
In this section, we use categorical concepts introduced in the previous chapter to show thatwe can use computational paths to induce a groupoid structure of a type. Nevertheless,before we do that, we show that computational paths form a globular structure.
4.3.1 Globular Structure
In the previous section, we have just shown the existence of paths between computationalpaths. Such paths were originated from redundancies caused by ππ€-equality. Analogously,one could think of redundancies caused by ππ€2-equality, which would be resolved by theestablishment of computational paths between two equivalent ππ€2-equalities. With thatin mind, we can extend this process up to the infinity. That way, we obtain an infinitenumber of ππ€π-equalities and πΏππ·πΈπ β ππ ππ systems. We have seen in the previouschapter a mathematical entity suitable to express this fact. It is known as globular set.With that in mind, we have the following definition:
Definition 4.25 (Level of a path (RAMOS; QUEIROZ; OLIVEIRA, 2017)). The πππ£ππ of apath is defined as follows:
β’ If π, π : π΄ are terms such that π and π are not ππ€-equalities, then we say that a pathπ =π π has level 1.
β’ If π, π : π΄ are ππ€π-equalities, then a path π =π π has level π+ 1.
The idea is that if we have two π-level paths π and π and if π can be rewritten into π by a sequence of rewrites established by πΏππ·πΈπ β ππ ππ, then this sequence of rewritesis a (π+ 1)-level path that establishes π =ππ€π π .
Computational paths can form a globular-set structure. To see this, consider π(π)as the set of π-level paths between two (π β 1)-level paths (for π = 0, just consider twonon-path objects) and for any path π₯ =π π¦, consider that π (π) = π₯ and π‘(π) = π¦. Thatway, if π β₯ 2 and π β π(π), then π (π) β π(π β 1) and π‘(π) β π(π β 1). Now, if we
Chapter 4. Computational Paths 90
consider two π-level paths π‘ =π π, and π‘ =πΌ π and a (π + 1)-level path π =π πΌ, thefollowing equations hold (RAMOS; QUEIROZ; OLIVEIRA, 2017):
π (π (π)) = π (π) = π‘ = π (πΌ) = π (π‘(π)).π‘(π (π)) = π‘(π) = π = π‘(πΌ) = π‘(π‘(π)).
All globular-set conditions hold. Then, we can think that computational paths form aglobular set structure all up to infinity, i.e., a β-globular-set.
4.3.2 The Induced Groupoid
The relation between the algebraic structure of groupoid and the identity type was firstnoticed by(HOFMANN; STREICHER, 1994). In this work, the authors claim that it is pos-sible to think of any type of type theory as having a groupoid structure. To do that, onecould think of the terms of a type as objects and the propositional identities betweenthese terms to be morphisms. Using π½ ,(HOFMANN; STREICHER, 1994) showed that thefollowing types, which correspond to the groupoid equations, are inhabited:
β’ πΌππΌππ΄(π₯,π§)(π‘ππππ (π‘ππππ (π, π), π), π‘ππππ (π, π‘ππππ (π, π)))
β’ πΌππΌππ΄(π₯,π¦)(π‘ππππ (ππππ(π₯), π), π)
β’ πΌππΌππ΄(π₯,π¦)(π‘ππππ (π, ππππ(π₯)), π)
β’ πΌππΌππ΄(π¦,π¦)(π‘ππππ (π π¦ππ(π), π), ππππ(π₯))
β’ πΌππΌππ΄(π₯,π₯)(π‘ππππ (π, π π¦ππ(π)), ππππ(π₯))
β’ πΌππΌππ΄(π₯,π¦)(π π¦ππ(π π¦ππ(π)), π)
After this important work, the authors further develop their ideas in (HOFMANN;
STREICHER, 1998), showing how π½ can be interpreted categorically.Since our approach is not based on π½ , but on the fact that identities are established by
computational paths, our objective in this section is to show that computational paths,together with the reduction rules discussed in the last section, are also capable of inducinggroupoidal structures.
Before we conclude that computational paths induces categories with groupoid prop-erties, we need to make clear the difference between a strict and a weak category. As onewill see, the word weak will appear many times. This will be the case because some ofthe categorical equalities will not hold βon the nose", so to say. They will hold up to ππ€-equality or up to higher levels of ππ€-equalities. This is similar to the groupoid model ofthe identity type proposed by(HOFMANN; STREICHER, 1994). In (HOFMANN; STREICHER,1994), the equalities do not hold βon the nose ", they hold up to propositional equality (orup to homotopy if one uses the homotopy interpretation). To indicate that these equalities
Chapter 4. Computational Paths 91
hold only up to some property, we say that the induced structure is a weak categoricalstructure. This will be even more clear in the proof of the following proposition (RAMOS;
QUEIROZ; OLIVEIRA, 2017):
Proposition 4.3. For each type π΄, computational paths induces a weak categorical struc-ture called π΄ππ€.
Proof. Since we are working with categories, a good understanding of the basic conceptof what is a category is essential. If one is not familiarized with the concept, one shouldcheck the chapter 3 of this work. To sum up, a category is a structure with objectsand morphisms between these objects. These morphisms must obey two main laws: theassociative and identity laws. To define a weak categorical structure π΄ππ€, the first step isto define the objects, the morphisms:
β’ Objects: The objects of π΄ππ€ are terms π of the type π΄, i.e., π : π΄.
β’ Morphisms: A morphism (arrow) between terms π : π΄ and π : π΄ are arrows π : π β π
such that π is a computational path between the terms, i.e., π =π π : π΄.
We need now to define the composition of morphisms, the identity morphism and checkthe associative and identity laws. Since we are working in a weak context, the associativeand identity law needs only to hold up to ππ€-equality. Before we check all these conditions,we can represent this structure in the following diagram:
π : π΄ π : π΄
π : π΄ π : π΄
πππ
π(π ,π)
ππ
ππ(π,π‘)
ππ
π‘ ππ
β’ Compositions: Given arrows (paths) π : π β π and π : π β π, we need to find anarrow π‘ : π β π such that π‘ = π β π . To do that, we first need to define the meaningof a composition of paths. Since equality has the transitive axiom, it is natural todefine the composition as an application of the transitivity, i.e. π‘ = π β π = π(π , π).Therefore, for any π : π β π and π : π β π, we always have a π‘ = π β π = π(π , π).
β’ Associativity of the composition: Given arrows π : π β π, π : π β π and π‘ : π βπ, since we are working with a weak categorical structure, we need to concludethat π‘ β (π β π ) =ππ€ (π‘ β π) β π . Substituting the compositions by the correspondingtransitivities, we need to conclude that π(π(π , π), π‘) =ππ€ π(π , π(π, π‘)). This is a direct
Chapter 4. Computational Paths 92
consequence of the rule π‘π‘: π(π(π , π), π‘) Bπ‘π‘ π(π , π(π, π‘)). Therefore, we conclude thatπ(π(π , π), π‘) =ππ€ π(π , π(π, π‘)).
β’ Identity morphism: For any object π, consider the reflexive path π =π π as theidentity arrow 1π. Letβs call this path as ππ (to indicate that it is a reflexive path ofπ).
β’ Identity law: For any arrows (paths) π : π β π, we need to show that π β 1π = π =1π β π . This can be shown (also in a weak sense) with a straightforward applicationof ππ€-rules. We have that π β 1π = π β ππ = π(ππ, π ) Bπ‘ππ π , therefore π(ππ, π ) =ππ€ π .For the other equation, we have that 1π β π = ππ β π = π(π , ππ) Bπ‘ππ π and thus,π(π , ππ) =ππ€ π .
Since all these conditions have been satisfied, we conclude that the structure π΄ππ€ inducedby computational paths is a weak categorical structure.
Is it possible to induce a strict (i.e., one that the equalities will hold βon the nose ")using computational paths? The answer is yes. Since ππ€-equality is transitive, symmetricand reflexive, ππ€-equality is an equivalence relation. If we use equivalent classes of ππ€-equalities as arrows, the equalities will hold βon the nose ". Since we are trying to provesimilar results to the ones obtained for identity types by(HOFMANN; STREICHER, 1994) (in(HOFMANN; STREICHER, 1994), as mentioned before, the equalities only in a weak sense),we are more interested in this weak categorical structure that we have just obtained.
We can now show that π΄ππ€ has a groupoid structure (RAMOS; QUEIROZ; OLIVEIRA,2017):
Proposition 4.4. The induced structure π΄ππ€ has a weak groupoidal structure.
Proof. We need to show that every arrow is an isomorphism. Since we are working ina weak sense, the isomorphism equalities need only to hold up to ππ€-equality. To showthat, for every arrow π : π β π, we need to show a π‘ : π β π such that π‘ β π =ππ€ 1π andπ β π‘ =ππ€ 1π. To do that, recall that every computational path has an inverse path π(π ).Put π‘ = π(π ). Thus, we have that π β π‘ = π β π(π ) = π(π(π ), π ) Bπ‘π π ππ. Since ππ = 1π, weconclude that π β π‘ =ππ€ 1π. We also have that π‘βπ = π(π )βπ = π(π , π(π ))Bπ‘π ππ. Therefore,π‘ β π = 1π. We conclude that every arrow is a weak isomorphism and thus, π΄ππ€ is a weakgroupoidal structure.
If we work with classes of equivalences as arrows, we can obtain a groupoidal struc-ture in the strict sense. With that, we finally conclude that computational paths have agroupoid model. As one could notice, we only needed to use the properties of computa-tional paths, together with rules of the rewrites πΏππ·πΈπ β ππ π. Having these conceptsand rules, we have just needed to show that computational paths induces simple structures
Chapter 4. Computational Paths 93
of category theory. The groupoidal model came naturally from the concept of computa-tional paths, without the need of constructing any complex term of an identity type, asdone in (HOFMANN; STREICHER, 1994). The fact that computational paths have a naturalgroupoidal model is an advantage, since it will automatically imply that the identity typehas a natural groupoidal model (without needing to build any term using a constructor,like the constructor π½ of the traditional identity type).
4.3.3 Higher Structures
We have just shown that computational paths induce a weak groupoidal structure knownas π΄ππ€. We also know that the arrows (or morphisms) of π΄ππ€ are computational pathsbetween two terms of a type π΄. As we saw in the previous subsection, sometimes acomputational path can be reduced to another by rules that we called ππ€-rules. That way,if we have terms π, π : π΄ and paths between these terms, we can define a new structure.This new structure, called π΄2ππ€(π, π), has objects as computational paths between π andπ and there is a morphism between paths π =π π and π =π‘ π iff π =ππ€ π‘. Since ππ€-equalityis transitive, reflexive and symmetric, π΄2ππ€ is a weak categorical structure which theequalities hold up to ππ€2-equality. The proof of this fact is analogous to the proposition4.1. The sole difference is the fact that since the morphisms are ππ€-equalities, insteadof computational paths, all the equalities will hold up to ππ€2-equality. To see this, takethe example of the associativity. Looking at the πΏππ·πΈπ β ππ π2 system, we have thatπ(π(π, π), π) Bπ‘π‘2 π(π, π(π, π)) (π, π and π represent ππ€-equalities between paths from π
to π). Therefore, π(π(π, π), π) =ππ€2 π(π, π(π, π)). The associative law holds up to ππ€2-equality. As one can easily check, the identity law will also hold up to ππ€2-equality.Therefore, π΄2ππ€(π, π) has a weak categorical structure. Analogous to proposition 4.4, thegroupoid law will also hold up to ππ€2-equality.
Instead of considering π΄ππ€ and π΄2ππ€(π, π) as separated structures, we can think of aunique structure with 2-levels. The first level is π΄ππ€ and the second one is the structureπ΄2ππ€(π, π) between each pair of objects π, π β π΄ππ€. We call this structure 2 β π΄ππ€. Themorphisms of the first level are called 1-morphisms and the ones of the second level arecalled 2-morphisms (also known as 2-arrows or 2-cells). Since it has multiple levels, itis considered a higher structure. We want to prove that this structure is a categoricalstructure known as weak 2-category. The main problem is the fact that in a weak 2-category, the last level (i.e., the second level) needs to hold up in a strict sense. This isnot the case for 2βπ΄2ππ€, since each π΄2ππ€(π, π) only holds up to ππ€2-equality. Nevertheless,there still a way to induce this weak 2-category. Since ππ€-equality is an equivalence relation(because it is transitive, symmetric and reflexive), we can consider a special π΄2ππ€(π, π),where the arrows are the arrows of π΄2ππ€(π, π) modulo ππ€2-equality. That way, since theequalities hold up to ππ€2-equality in π΄2ππ€(π, π), they will hold in a strict sense when weconsider the equivalence classes of ππ€2-equality. We call this structure [π΄2ππ€(π, π)]. In this
Chapter 4. Computational Paths 94
structure, consider the composition of arrows defined as: [π]ππ€2 β [π]ππ€2 = [π β π]ππ€2 . Now,we can think of the structure [2βπ΄ππ€]. This structure is similar to 2βπ΄ππ€. The differenceis that the categories of the second level are [π΄2ππ€(π, π)] instead of π΄2ππ€(π, π). We can nowprove that [2 β π΄ππ€] is a weak 2-category (RAMOS; QUEIROZ; OLIVEIRA, 2017):
Proposition 4.5. Computational paths induce a weak 2-category called [2 β π΄ππ€].
Proof. First of all, letβs draw a diagram that represents [2 β π΄ππ€]:
π π π π
π
t
π₯
π
w
π¦
π
q
π§
[πΌ]ππ€2
[π]ππ€2
[π]ππ€2
[π]ππ€2
[π]ππ€2 [π]ππ€2
[π]ππ€2
In this diagram we represent 1-arrows and 2-arrows between these 1-arrows. The factthat 2-arrows are equivalence classes is represented by the brackets.
Since we are working with a higher structures, some new properties should be checked.One of these properties is the fact that 2-arrows can be composed horizontally(LEINSTER,1998). In other words, given 1-morphisms π : π β π, π : π β π, π‘ : π β π, π€ : π β π and2-morphisms [πΌ]ππ€2 : π β π‘ and [π]ππ€2 : π β π€, one should be able to define a horizontalcomposition ββ: ([π]ππ€2 ββ [πΌ]ππ€2) : π β π β π€ β π‘.
Given [πΌ]ππ€2 : [π = πΌ1, ..., πΌπ = π‘] and [π]ππ€2 : [π = π1, ..., ππ = π€], then we define thehorizontal composition ([π]ππ€2ββ[πΌ]ππ€2) as the sequence [π(π = πΌ1, π = π1), ..., π(πΌπ, π1)..., π(πΌπ =π‘, ππ = π€)]ππ€2 .
We also need to verify the associative and identity law for ββ. Since we are working witha weak 2-category, these laws should hold up to natural isomorphism (LEINSTER, 1998).To verify these laws, the idea is that every 2-morphism of [π΄ππ€2 ] is an isomorphism. To seethat, remember that ππ€-equality is transitive, symmetric and reflexive. Therefore, if wehave [π]ππ€2 , we can think of the inverse [π(π)]ππ€2 . If we compose them, we have that [π]ππ€2 β[π(π)]ππ€2 = [πβπ(π)]ππ€2 . Since we have in πΏππ·πΈπβππ π2 that (πβπ(π)) = π(π(π), π))Bπ‘π π2
ππ, then π βπ(π) =ππ€2 ππ and thus, [π βπ(π)]ππ€2 = [ππ]ππ€2 . Analogously, one can prove that[π(π) β π]ππ€2 = [ππ€]ππ€2 . Therefore, every 2-morphism of [π΄ππ€2 ] is an isomorphism. Since anatural transformation is a natural isomorphism iff every component is an isomorphism(as one can check in the chapter 3), we conclude that finding isomorphisms for theassociative and identity laws is just a matter of finding the correct morphisms.
For the associative law, we need to check that there is a natural isomorphism between(([π]ππ€2 ββ [π]ππ€2) ββ [πΌ]ππ€2) and ([π]ππ€2 ββ ([π]ππ€2 ββ [πΌ]ππ€2)). To do this, by the defini-tion of horizontal composition, a component of (([π]ππ€2 ββ [π]ππ€2) is a term of the formπ(πΌπ₯, π(ππ¦, ππ§)), with π₯, π¦, and π§ being suitable natural numbers that respect the order ofthe horizontal composition. Analogously, the same component of ([π]ππ€2 ββ([π]ππ€2 ββ[πΌ]ππ€2))
Chapter 4. Computational Paths 95
is just a suitable term π(π(πΌπ₯, ππ¦), ππ§). The isomorphism between these component isclearly established by the inverse π‘π‘ rule, i.e., π(πΌπ₯, π(ππ¦, ππ§)) =ππ€π(π‘π‘) π(π(πΌπ₯, ππ¦), ππ§)
The identity laws use the same idea. We need to check that ([πΌ]ππ€2 ββ [πππ ]ππ€2) = [πΌ]ππ€2 .To do that, we need to take components (πππ , πΌπ¦) and πΌπ¦ and establish their isomorphism:(πππ , πΌπ¦) =ππ€π‘ππ
πΌπ¦.The other natural isomorphism, i.e., the isomorphism between ([πππ
]ππ€2 ββ [πΌ]ππ€2) and[πΌ]ππ€2 can be established in an analogous way, just using the rule π‘ππ instead of π‘ππ. Justfor purpose of clarification, πππ comes from the reflexive property of ππ€-equality. Since ππ
is the identity path, using the reflexivity we establish that ππ =ππ€ ππ, generating πππ .We call the associative morphism generated by π(π‘π‘) as ππ π ππ (sometimes also called
simply π), the morphism generate by π‘ππ as π*π and the one generated by π‘ππ as π*π . With the
associative and identity isomorphisms established, we now need to check the interchangelaw(LEINSTER, 1998). We need to check that:
([π]ππ€2 β [π]ππ€2) ββ ([π]ππ€2 β [πΌ]ππ€2) = ([π]ππ€2 ββ [π]ππ€2) β ([π]ππ€2 ββ [πΌ]ππ€2)
From (([π]ππ€2 β [π]ππ€2) ββ ([π]ππ€2 β [πΌ]ππ€2)), we have:
(([π]ππ€2 β [π]ππ€2) ββ ([π]ππ€2 β [πΌ]ππ€2)) =[π(π, π)]ππ€2 ββ [π(πΌ, π)]ππ€2 =
[π1, ..., ππ = π1, ..., ππβ² ]ππ€2 ββ [(πΌ1, ..., πΌπ = π1, ...ππβ² ]ππ€2 =[π(πΌ1, π1), ..., π(πΌπ = π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ² = π1), ..., π(ππ, ππβ²)]ππ€2
From (([π]ππ€2 ββ [π]ππ€2) β ([π]ππ€2 ββ [πΌ]ππ€2))):
(([π]ππ€2 ββ [π]ππ€2) β ([π]ππ€2 ββ [πΌ]ππ€2))(π β π ) =([π(π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ²)]ππ€2 β [π(πΌ1, π1), ..., π(πΌπ, π1), ..., π(πΌπ, ππβ²)]ππ€2 =
[π(πΌ1, π1), ..., π(πΌπ, π1), ..., π(πΌπ, ππβ²), ..., π(π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ²)]ππ€2
If one looks closely, one can notice that this is a suitable to apply ππ2. Individu-ally, every variable that appears in the sequence of transitivities follows the same expan-sion in both cases. The only difference is how the choices have been made. That way,if we construct π , as defined in Definition 4.6, one can check that π(πΌ1, π1), ..., π(πΌπ =π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ² = π1), ..., π(ππ, ππβ²) β π and π(πΌ1, π1), ..., π(πΌπ, π1), ..., π(πΌπ, ππβ²), ..., π(π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ²) βπ For that reason, we establish:
[π(πΌ1, π1), ..., π(πΌπ = π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ² = π1), ..., π(ππ, ππβ²)]ππ€2 =ππ2
[π(πΌ1, π1), ..., π(πΌπ, π1), ..., π(πΌπ, ππβ²), ..., π(π1, π1), ..., π(ππ, π1), ..., π(ππ, ππβ²)]ππ€2 .
Since we are working with equivalence classes, this equality holds strictly.To end the proof, there is one more thing that we should verify. Since we are working
with a weak structure, there is some laws that should hold. These laws are known ascoherence laws. In a weak 2-category, the coherence laws are the following fact(LEINSTER,1998):
Chapter 4. Computational Paths 96
Given the following diagram of 1 βππππβππ ππ :
π π π π ππ π π π’
The following diagrams should commute:
((π’ β π) β π) β π
(π’ β π) β (π β π )
(π’ β (π β π)) β π
π’ β ((π β π) β π )
π’ β (π β (π β π ))
ππ π ππ
ππ π ππ ββ [ππ ]ππ€2
ππ π ππ
ππ π ππ [ππ’]ππ€2 ββ ππ π ππ
(π β ππ) β π π β (ππ β π )
π β π
ππ π ππ
π*π ββ [ππ ]ππ€2 [ππ]ππ€2 ββ π
*π
The proofs are straightforward. Remember that ππ π ππ is just an application of π(π‘π‘), π*π
is an application of π‘ππ and π*π an application of π‘ππ. First, letβs start with ((π’βπ)β π)β π =π(π , π(π, π(π, π’))) going to the right of the diagram:
(ππ π ππ ββ [ππ ]ππ€2)(π(π , π(π, π(π, π’)))) = π(π , ππ π ππ(π(π, π(π, π’)))) =π(π , π(π(π, π), π’))
ππ π ππ(π(π , π(π(π, π), π’))) = π(π(π , π(π, π)), π’)([ππ’]ππ€2 ββ ππ π ππ)(π(π(π , π(π, π)), π’)) = π(ππ π ππ(π(π , π(π, π))), π’) =
π(π(π(π , π), π)), π’) = π’ β (π β (π β π ))
Now, starting from the same π(π , π(π, π(π, π’))) and going bottom left:
ππ π ππ(π(π , π(π, π(π, π’)))) = π(π(π , π), π(π, π’))ππ π ππ(π(π(π , π), π(π, π’))) = π(π(π(π , π), π), π’) = π’ β (π β (π β π ))
Therefore, the first diagram commutes. We now need to check the second one. Letβsstart from ((π β ππ) β π ) = π(π , π(ππ, π)) and going to the right of the diagram:
Chapter 4. Computational Paths 97
ππ π ππ(π(π , π(ππ, π))) = π(π(π , ππ), π)([ππ]ππ€2 ββ π
*π )π(π(π , ππ), π) = π(π*π (π(π , ππ)), π) =
π(π , π) = π β π
Now, starting from the same π(π , π(ππ, π)) and going right bottom:
(π*π ββ [ππ ]ππ€2)π(π , π(ππ, π)) = π(π , π*
π(π(ππ, π))) =π(π , π) = π β π
Thus, the second diagram commutes. The coherence laws hold. We finally finish theproof that [2 β π΄ππ€] is a weak 2-category.
We can also conclude that [2 β π΄ππ€] has a weak 2-groupoid structure. That is thecase because we already know (from proposition 4.4 ) that the groupoid laws are satisfiedby 1-morphisms up to the isomorphism of the next level, i.e., up to ππ€-equality and the2-morphisms, as we have just seen, are isomorphisms (that hold in a strict way, since thesecond level is using classes of equivalence). With that, we showed that computationalpaths induces a 2-weak groupoid. If one compares this groupoid with the one obtainedby the homotopy interpretation, this 2-weak category is similar to the fundamental weak2-groupoid of a space π, denoted by Ξ 2π (that Ξ 2π forms a weak 2-category can be seenin (LEINSTER, 2004)).
Since we could induce a weak 2-categorical structure using computational paths, wouldbe possible to induce even higher structures? The answer is π¦ππ , since we have infinitelevels of ππ€-rules established by infinite πΏππ·πΈπ βππ ππ systems. For example, we couldadd a new level π΄3ππ€(π, πΌ). where π and πΌ are 2-morphisms. We would have a structurewith 3 levels and we could try to prove that this structure is a weak 3-category. Theproblem is, as one could see in the proof of proposition 4.5, working with higher structurescan be difficult. A weak 3-weak category has more types of compositions than the 2-weakone, since we have an additional level. Moreover, since it is weak, there are coherencelaws that must be checked. For a 3-weak category, these laws are much more complicatedthan the ones for 2-weak categories. For that reason, we will leave the study of higherstructures induced by computational paths with more than 2 levels for the future, since itis still work in progress. In fact, our aim is to prove, in a future work, that computationalpath induces a weak category with infinite levels, known as weak π-category. In fact,we want to show that this weak infinite category forms a weak π-groupoid. We believethat it is possible to achieve these results, since it was proved by(LUMSDAINE, 2009;BERG; GARNER, 2011) that the identity type induces such structure. Given the connectionbetween computational paths and terms of identity types, we should be able to prove thatcomputational paths also induces a weak π-groupoid.
Chapter 4. Computational Paths 98
4.4 UNIQUENESS OF IDENTITY PROOFS
One of the main results that arises from the groupoid interpretation of(HOFMANN; STRE-
ICHER, 1998) is that it refutes the uniqueness of identity proofs, also known as ππΌπ .(HOFMANN;
STREICHER, 1998) defines UIP as the following property:
Definition 4.26. Let π and π be objects of a type π΄. ππΌπ is the following property:given any proofs π and π of proposition π equals to π, then there is always another proofestablishing the equality of π and π.
In terms of computational paths, ππΌπ asks if, for every pair of objects π‘ and π betweenπ and π of a type π΄, there is an ππ€-equality π‘ =ππ€π
π . To better see this situation, a concreteexample is given by(QUEIROZ; OLIVEIRA; RAMOS, 2016):
Example 4.7. Consider the term (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£. We want to reduce this term tothe term π§π£. To achieve this goal, we can follow 3 different paths:
β’ (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£ Bπ (ππ₯.(ππ¦.π¦π₯)π§)π£ Bπ½ (ππ¦.π¦π£)π§ Bπ½ π§π£.
β’ (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£ Bπ½ (ππ₯.(ππ€.π§π€)π₯)π£ Bπ (ππ₯.π§π₯)π£ Bπ½ π§π£.
β’ (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£ Bπ½ (ππ₯.(ππ€.π§π€)π₯)π£ Bπ½ (ππ€.π§π€)π£ Bπ π§π£.
Thus, if ππΌπ holds, those 3 paths are just different ways of expressing the same thing.In other words, it would be possible to find ππ€-equalities establishing equalities betweenthem.
The objective of this section is to show that, similarly to the traditional approach forthe identity type, our path-based one also refutes ππΌπ . Given a type π΄, by the definitionof ππΌπ , one can conceive a type ππΌπ (π΄) that is inhabited iff for any terms π, π : π΄ andpaths π =π π and π =π‘ π, then π =ππ€ π‘.
As stated by(HOFMANN; STREICHER, 1998), if ππΌπ holds, then every type π΄ is a trivialgroupoid structure in which there is only one morphism between every pair of objects. Toshow that ππΌπ is false, one only needs to construct an π΄ such that there is more thanone morphism between a pair of objects (i.e., there is at least one pair of objects π, π : π΄and a pair of paths π and π‘ between them such that π π‘βππ‘ π ΜΈ=ππ€ π‘). To achieve that,we can take advantage of our previous example, and consider (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£ : π΄.Therefore (RAMOS; QUEIROZ; OLIVEIRA, 2017; QUEIROZ; OLIVEIRA; RAMOS, 2016):
Theorem 4.4. The type ππΌπ is empty.
Proof. We construct π΄ππ€:
Chapter 4. Computational Paths 99
(ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£
(ππ₯.(ππ¦.π¦π₯)π₯)π£
(ππ¦.π¦π£)π§
π§π£
(ππ₯.(ππ€.π§π€)π₯)π£
(ππ€.π§π€)π£
π
π½
π½
π(π(π, π½), π½) π(π(π½, π½), π)
π½
π½
π
As depicted above, there are (at least) two possible paths between (ππ₯.(ππ¦.π¦π₯)(ππ€.π§π€))π£and π§π£. The first path is given by π(π(π, π½), π½) and the second by π(π(π½, π½), π). Moreover,looking at all ππ€-rules (check definition 4.18), there is no rule that establishes the ππ€-equality between these two paths. That way, π΄ππ€ is not a trivial groupoid and thus, ππΌπis empty.
With that, we conclude that our approach based on computational paths refutes theuniqueness of identity proofs.
4.5 CONCLUSION
Inspired by a recent discovery that the propositional equality between terms can be inter-preted as the type of homotopy paths, we have revisited the formulation of the intensionalidentity type, proposing a approach based on an entity known as computational path. Wehave proposed that a computational path π =π π : π΄ gives grounds to building a termπ (π, π) of the identity type, i.e., π (π, π) : πΌππ΄(π, π), and is formed by a composition ofbasic rewrites, each with their identifiers taken as constants. We have also developedour approach, showing how the path-based identity type can be rather straightforwardlyused in deductions. In particular, we have shown the simplicity of our elimination rule,demonstrating that it is based on path constructions, which are built from applicationsof simple axioms of the equality for type theory. To make our point even clearer, we haveexposed three path-based constructions. More specifically, constructions that prove thetransitivity, reflexivity and symmetry of the propositional equality. We have also arguedthat, for these constructions, the process of finding the reason that allows for buildingthe desired term was simple and straightforward in our approach. At the same time, in
Chapter 4. Computational Paths 100
the traditional (or pathless) approach, this is not entirely true, since finding the correctreason was a cumbersome process.
After establishing the foundations of our approach, we analyzed one important struc-ture that the traditional identity type induces: the algebraic structure known as groupoid.Our objective was to show that our approach is on a par with the pathless one, i.e., ourpath-based identity also induces a groupoid structure. To prove that, we have shown thatthe axioms of equality generate redundancies, which are resolved by paths between paths.We mentioned that there already exists a system called πΏππ·πΈπ β ππ π that maps andresolves these redundancies. We have gone further, proposing the existence of a higherπΏππ·πΈπ β ππ π2 which resolves redundancies generated by the πΏππ·πΈπ β ππ π system.Using πΏππ·πΈπ β ππ π, we have proved that a computational path is capable of induc-ing a weak groupoid structure. Using the higher rewriting system, we have induced astructure known as weak 2-groupoid. With that, we believe we have opened the way, ina future work, for a possible proof establishing that computational paths induces a weakπ-groupoid.
We have also shown that, using our groupoid of computational paths, it is possibleto refute the principle of uniqueness of identity proofs for the path-based approach. Thisresult ties in with the one obtained by (HOFMANN; STREICHER, 1998) for the traditionalidentity type.
101
5 HOMOTOPY TYPE THEORY
In chapter 2, we said that one of the most interesting concepts of type theory isthe identity type. We have also said that the reason for that is the fact one can seethe identity type as a homotopical path between two points of a space, giving rise toa homotopical interpretation of type theory. The connection between those two theoriescreated a whole new area of research known as homotopy type theory. In this work, weintroduced computational paths as the syntactic counterpart of those homotopical paths,since they only exist in a semantical sense. Nevertheless, we have not talked yet how onecan use computational paths in homotopy type theory.
Thus, in this chapter, we develop one of the main objectives of this work.We want to show that some of the foundational definitions, propositions and theorems
of homotopy type theory still hold in our path-based approach. In other words, we useour approach to construct the building blocks of more complex results.
One important fact to notice is that every proof that does not involve the identity typeis valid in the path-based approach. This is obvious, since the only difference between thetraditional approach and ours is the formulation of the identity type. If a proof uses it,we need to reformulate this proof using our path-based approach, instead of using theinduction principle of the traditional one. Thus, every part of a proof that is not directlyor indirectly related to identity type is still valid in our approach.
In a path-based proof, we are going to use the formulation proposed in the previouschapter. We also are going to use the reduction rules of πΏππ·πΈπ β ππ π. In the processof developing the theory of this section, we noticed that πΏππ·πΈπ β ππ π, as proposed inthe previous chapter is still incomplete. We state this based on the fact that we foundnew reduction rules that are not part of the original πΏππ·πΈπ βππ π. That way, we addedthese new rules to the system, expanding it.
5.1 GROUPOID LAWS
In the previous chapter we have seen that computational paths form a groupoid structure.Letβs check again those rules using our π πΈππ constructor directly:
Lemma 5.1. The type Ξ (π:π΄)πΌππ΄(π, π) is inhabited.
Proof. We construct an witness for the desired type:
Parts of this chapter were introduced by the author in the talk Computational paths, transport andthe univalence axiom at XVIII Brazilian Logic Conference in 2017. (RAMOS, 2017). This chapteralso yielded an still unpublished paper, "Explicit Computational Paths". Preprint version available in(RAMOS; QUEIROZ; OLIVEIRA, 2018)
Chapter 5. Homotopy Type Theory 102
[π : π΄]π =π π : π΄
πΌπβ πΌ1π(π, π) : πΌππ΄(π, π)
Ξ β πΌππ.π(π, π) : Ξ (π:π΄)πΌππ΄(π, π)
Lemma 5.2. The type Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π)) is inhabited.
Proof. Similar to the previous lemma, we construct an witness:
[π : π΄] [π : π΄][π(π, π) : πΌππ΄(π, π)]
[π =π‘ π : π΄]π =π(π‘) π : π΄
πΌπβ πΌ(π(π‘))(π, π) : πΌππ΄(π, π)πΌπβ πΈ
π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : πΌππ΄(π, π)Ξ β πΌ
ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : πΌππ΄(π, π) β πΌππ΄(π, π)Ξ β πΌ
ππ.ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))Ξ β πΌ
ππ.ππ.ππ.π πΈππ (π(π, π), π‘.(π(π‘))(π, π)) : Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π))
Lemma 5.3. The type Ξ (π:π΄)Ξ (π:π΄)Ξ (π:π΄)(πΌππ΄(π, π) β πΌππ΄(π, π) β πΌππ΄(π, π)) is inhabited.
Proof. We construct the following witness:
Chapter 5. Homotopy Type Theory 103
[π:π΄
][π
:π΄]
[π€(π,π
):πΌπ
π΄(π,π
)]
[π:π΄
][π
(π,π
):πΌπ
π΄(π,π
)]
[π=
π‘π
:π΄]
[π=
π’π
:π΄]
π=
π(π‘
,π’)π
:π΄πΌπ
βπΌ
(π(π‘,π’
))(π,π
):πΌπ
π΄(π,π
)πΌπ
βπΈ
π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
)):πΌπ
π΄(π,π
)πΌπ
βπΈ
π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)Ξ
βπΌ
ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)Ξ
βπΌ
ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)Ξ
βπΌ
ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)Ξ
(π:π΄
)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))Ξ
βπΌ
ππ.ππ.ππ.ππ€.ππ .π πΈππ
(π€(π,π
),π‘π πΈππ
(π (π,π
),π’(π
(π‘,π’
))(π,π
))):
Ξ (π
:π΄)Ξ
(π:π΄
)Ξ (π
:π΄)(πΌπ
π΄(π,π
)βπΌπ
π΄(π,π
)βπΌπ
π΄(π,π
))
Chapter 5. Homotopy Type Theory 104
Lemmas 1, 2 and 3 correspond respectively to the reflexivity, symmetry and transitiv-ity of the identity type. From now on, the reflexivity will be represented by π, symmetryby π and transitivity by π .
Lemma 5.4. For any type π΄, π₯, π¦, π§, π€ : π΄ and π : πΌππ΄(π₯, π¦) and π : πΌππ΄(π¦, π§) andπ : πΌππ΄(π§, π€), the following types are inhabited:
1. Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π, ππ¦ β π) and Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π, π β ππ₯).
2. Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π(π)βπ, ππ₯) and Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(πβπ(π), ππ¦)
3. Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π(π(π)), π)
4. Ξ (π₯,π¦,π§,π€:π΄)Ξ (π:πΌππ΄(π₯,π¦))Ξ (π:πΌππ΄(π¦,π§))Ξ (π:πΌππ΄(π§,π€))πΌππΌππ΄(π₯,π€)(π β (π β π), (π β π) β π)
Proof. The proof of each statement follows from the same idea. We just need to look forsuitable reduction rules already present in the original πΏππ·πΈπ β ππ π.
1. The first thing to notice is that a composition in our path-based approach corre-sponds to a transitive operation, i.e., (π β ππ₯) can be written as π(ππ₯, π). The termsfollow from rules number 5 and 6:
π₯ =π π¦ : π΄ π¦ =π π¦ : π΄Bπ‘ππ π₯ =π π¦ : π΄
π₯ =π(π,π) π¦ : π΄
π₯ =π π₯ : π΄ π₯ =π π¦ : π΄Bπ‘ππ π₯ =π π¦ : π΄
π₯ =π(π,π) π¦ : π΄
Thus, we have:
π(π, ππ¦) =π‘ππ π : πΌππ΄(π₯, π¦)(π‘ππ)(π(π, ππ¦), π) : πΌππΌππ΄(π₯,π¦)(π, ππ¦ β π)
ππ₯.ππ¦.ππ.(π‘ππ)(π(π, ππ¦), π) : Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π, ππ¦ β π)
π(ππ₯, π) =π‘ππ π : πΌππ΄(π₯, π¦)(π‘ππ)(π(ππ₯, π), π) : πΌππΌππ΄(π₯,π¦)(π, π β ππ₯)
ππ₯.ππ¦.ππ.(π‘ππ)(π(ππ₯, π), π) : Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π, π β ππ₯)
Chapter 5. Homotopy Type Theory 105
2. We use rules 3 and 4:
π₯ =π π¦ : π΄ π¦ =π(π) π₯ : π΄Bπ‘π π₯ =π π₯ : π΄
π₯ =π(π,π(π)) π₯ : π΄
π¦ =π(π) π₯ : π΄ π₯ =π π¦ : π΄Bπ‘π π π¦ =π π¦ : π΄
π¦ =π(π(π),π) π¦ : π΄
Thus:
π(π, π(π)) =π‘π ππ₯ : πΌππ΄(π₯, π¦)(π‘π)(π(π, π(π)), ππ₯) : πΌππΌππ΄(π₯,π¦)(π(π) β π, ππ₯)
ππ₯.ππ¦.ππ.(π‘π)(π(π, π(π), ππ₯) : Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π(π) β π, ππ₯)
π(π(π), π) =π‘π π ππ¦ : πΌππ΄(π₯, π¦)(π‘π π)(π(π(π), π), ππ¦) : πΌππΌππ΄(π₯,π¦)(π β π(π), ππ¦)
ππ₯.ππ¦.ππ.(π‘π π)(π(π, π(π), ππ¦) : Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π β π(π), ππ¦)
3. We use rule 2:
π₯ =π π¦ : π΄π¦ =π(π) π₯ : π΄
Bπ π π₯ =π π¦ : π΄π₯ =π(π(π)) π¦ : π΄
Thus:
π(π(π)) =π π π : πΌππ΄(π₯, π¦)(π π )(π(π(π), π)) : πΌππΌππ΄(π₯,π¦)(π(π(π)), π)
ππ₯.ππ¦.ππ.(π π )(π(π(π), π)) : Ξ (π₯,π¦:π΄)Ξ (π:πΌππ΄(π₯,π¦))πΌππΌππ΄(π₯,π¦)(π(π(π)), π)
4. We use rule 37:
π₯ =π‘ π¦ : π΄ π¦ =π π€ : π΄π₯ =π(π‘,π) π€ : π΄ π€ =π π§ : π΄
π₯ =π(π(π‘,π),π ) π§ : π΄
π₯ =π‘ π¦ : π΄π¦ =π π€ : π΄ π€ =π π§ : π΄
π¦ =π(π,π ) π§ : π΄Bπ‘π‘
π₯ =π(π‘,π(π,π )) π§ : π΄
Thus:
Chapter 5. Homotopy Type Theory 106
π(π
(π,π
),π)
=π‘π‘π(π,π
(π,π
)):πΌπ
π΄(π₯,π€
)(π‘π‘)
(π(π
(π,π
),π)
=π‘π‘π(π,π
(π,π
))):πΌπ
πΌπ
π΄(π₯
,π€)(π
β(π
βπ),(π
βπ)
βπ)
ππ₯.ππ¦.ππ§.ππ€.ππ.ππ.ππ.
(π π )
(π(π
(π),π)
):Ξ
(π:πΌ
ππ΄
(π₯,π¦
))Ξ
(π:πΌ
ππ΄
(π¦,π§
))Ξ
(π:πΌ
ππ΄
(π§,π€
))πΌπ
πΌπ
π΄(π₯
,π€)(π
β(π
βπ),(π
βπ)
βπ)
With the previous lemma, we showed that our path-based approach yields the groupoidstructure of a type up to propositional equality using the syntax introduced in the previouschapter.
Chapter 5. Homotopy Type Theory 107
5.2 FUNCTORIALITY
We want to show that functions preserve equality(Univalent Foundations Program, 2013).
Lemma 5.5. The type Ξ (π₯,π¦:π΄)Ξ (π :π΄βπ΅)(πΌππ΄(π₯, π¦) β πΌππ΅(π(π₯), π(π¦))) is inhabited.
Proof. It is a straightforward construction:
[π₯ =π π¦ : π΄] [π : π΄ β π΅]π(π₯) =ππ (π ) π(π¦) : π΅
ππ (π )(π(π₯), π(π¦)) : πΌππ΅(π(π₯), π(π¦)) [π : πΌππ΄(π₯, π¦)]π πΈππ (π, ππ .ππ (π )(π(π₯), π(π¦))) : πΌππ΅(π(π₯), π(π¦))
ππ₯.ππ¦.ππ.ππ.π πΈππ (π, ππ .ππ (π )(π(π₯), π(π¦))) : Ξ (π₯,π¦:π΄)Ξ (π :π΄βπ΅)(πΌππ΄(π₯, π¦) β πΌππ΅(π(π₯), π(π¦)))
Lemma 5.6. For any functions π : π΄ β π΅ and π : π΅ β πΆ and paths π : π₯ =π΄ π¦ andπ : π¦ =π΄ π§, we have:
1. ππ (π(π, π)) = π(ππ (π), ππ (π))
2. ππ (π(π)) = π(ππ (π))
3. ππ(ππ (π)) = ππβπ (π)
4. ππΌππ΄(π) = π
Proof. 1. For the first time, we need to add a new rule to the original 39 rules ofπΏππ·πΈπ β ππ π. We introduce rule 40:
π₯ =π π¦ : π΄ [π : π΄ β π΅]π(π₯) =ππ (π) π(π¦) : π΅
π¦ =π π§ : π΄ [π : π΄ β π΅]π(π¦) =ππ (π) π(π§) : π΅
π(π₯) = π(ππ (π), ππ (π))π(π§) : π΅
π₯ =π π¦ : π΄ π¦ =π π§ : π΄Bπ‘π
π₯ =π(π,π) π§ : π΄ π : π΄ β π΅
π(π₯) =ππ (π(π,π)) π(π§) : π΅
Thus, we have ππ (π(π, π)) =π(π‘π) π(ππ (π), ππ (π))
2. This one follows from rule 30:
Chapter 5. Homotopy Type Theory 108
π₯ =π π¦ : π΄ [π : π΄ β π΅]π(π₯) =ππ (π) π(π¦) : π΅π(π¦) =π(ππ (π)) π(π₯) : π΅
π₯ =π π¦ : π΄Bπ π
π¦ =π(π) π₯ : π΄ [π : π΄ β π΅]π(π¦) =ππ (π(π)) π(π₯) : π΅
We have ππ (π(π)) =π(π π) π(ππ (π))
3. We introduce rule 41:
π₯ =π π¦ : π΄ [π : π΄ β π΅]π(π₯) =ππ (π) π(π¦) : π΅ [π : π΅ β πΆ]
π(π(π₯)) =ππ(ππ (π)) π(π(π¦)) : πΆ
π₯ =π π¦ : π΄
[π₯ : π΄] [π : π΄ β π΅]π(π₯) : π΅ [π : π΅ β πΆ]
π(π(π₯)) : πΆππ₯.π(π(π₯)) β‘ (π β π) : π΄ β πΆ
Bπππ(π(π₯)) =ππβπ (π) π(π(π¦)) : πΆ
Then, ππ(ππ (π)) =ππ ππβπ (π)
4. We introduce rule 42:
π₯ =π π¦ : π΄ [πΌππ΄ : π΄ β π΄]πΌππ΄(π₯) = ππΌππ΄(π)πΌππ΄(π¦) : π΄
Bππ π₯ =π π¦ : π΄π₯ =ππΌππ΄
(π) π¦ : π΄
It follows that ππΌππ΄(π) =ππ π
Chapter 5. Homotopy Type Theory 109
5.3 TRANSPORT
As stated in (QUEIROZ; OLIVEIRA, 2014a), substitution can take place when no quantifieris involved. In this sense, there is a βquantifier-lessβ notion of substitution. In type theory,this βquantifier-lessβ substitution is given by a operation known as transport (Univalent
Foundations Program, 2013). In our path-based approach, we formulate a new inference ruleof βquantifier-lessβ substitution (QUEIROZ; OLIVEIRA, 2014a):
π₯ =π π¦ : π΄ π(π₯) : π (π₯)π(π₯, π¦) β π(π₯) : π (π¦)
We use this transport operation to solve one essential issue of our path-based approach.We know that given a path π₯ =π π¦ : π΄ and function π : π΄ β π΅, the application of axiomπ yields the path π(π₯) =ππ (π) π(π¦) : π΅. The problem arises when we try to apply the sameaxiom for a dependent function π : Ξ (π₯:π΄)π (π₯). In that case, we want π(π₯) = π(π¦), but wecannot guarantee that the type of π(π₯) : π (π₯) is the same as π(π¦) : π (π¦). The solution isto apply the transport operation and thus, we can guarantee that the types are the same:
π₯ =π π¦ : π΄ π : Ξ (π₯:π΄)π (π₯)π(π₯, π¦) β π(π₯) =ππ (π) π(π¦) : π (π¦)
Lemma 5.7. (Leibnizβs Law) The type Ξ (π₯,π¦:π΄)(πΌππ΄(π₯, π¦) β π (π₯) β π (π¦)) is inhabited.
Proof. We construct the following tree:
[π₯ =π π¦ : π΄] [π(π₯) : π (π₯)]π(π₯, π¦) β π(π₯) : π (π¦)
ππ(π₯).π(π₯, π¦) β π(π₯) : π (π₯) β π (π¦) [π§ : πΌππ΄(π₯, π¦)]π πΈππ (π§, ππ.ππ(π₯).π(π₯, π¦) β π(π₯)) : π (π₯) β π (π¦)
ππ₯.ππ¦.ππ§.π πΈππ (π§, ππ.ππ(π₯).π(π₯, π¦) β π(π₯)) : Ξ (π₯,π¦:π΄)(πΌππ΄(π₯, π¦) β π (π₯) β π (π¦))
The function ππ(π₯).π(π₯, π¦)βπ(π₯) : π (π₯) β π (π¦) is usually written as π‘ππππ ππππ‘π(π,β)and π‘ππππ ππππ‘π(π, π(π₯)) : π (π¦) is usually written as π*(π(π₯)).
Lemma 5.8. For any π (π₯) β‘ π΅, π₯ =π π¦ : π΄ and π : π΅, there is a path π‘ππππ ππππ‘π (π, π) =π.
Chapter 5. Homotopy Type Theory 110
Proof. The first to notice is the fact that in our formulation of transport, we always needa functional expression π(π₯), and in this case we have only a constant term π. To addressthis problem, we consider a function π = π.π and then, we transport over π(π₯) β‘ π:
π‘ππππ ππππ‘π (π, π(π₯) β‘ π) =π(π) (π(π¦) β‘ π).
Thus, π‘ππππ ππππ‘π (π, π) =π(π) π. We sometimes call this path π‘ππππ ππππ‘ππππ π‘π΅π (π).
Lemma 5.9. For any π : π΄ β π΅ and π₯ =π π¦ : π΄, we have
π(π)(π*(π(π₯)), π(π¦)) = π(π‘ππππ ππππ‘ππππ π‘π΅π , ππ (π))(π*(π(π₯)), π(π¦))
Proof. The first thing to notice is that in this case, π‘ππππ ππππ‘ππππ π‘π΅π is the path π(π)(π *(π(π₯), π(π₯)) by lemma 8. As we did to the rules of πΏππ·πΈπ β ππ π, we establishes thisequality by getting to the same conclusion from the same premises by two different trees:
In the first tree, we consider π(π₯) β‘ π : π΅ and transport over π : π΅:
π₯ =π π¦ : π΄ π(π₯) β‘ π : π΅π(π₯, π¦) β (π(π₯) β‘ π) : π΅π*(π(π₯)) =ππ (π) π β‘ π(π₯)
π₯ =π π¦ : π΄ π : π΄ β π΅
π(π₯) =ππ (π) π(π¦) : π΅π*(π(π₯)) =π(ππ (π),ππ (π)) π(π¦) : π΅
In the second one, we consider π(π₯) as an usual functional expression and thus, wetransport the usual way:
π₯ =π π¦ : π΄ π(π₯) : π΅π(π₯, π¦) β π(π₯) : π΅
π*(π(π₯)) =ππ (π) π(π¦) : π΅
Lemma 5.10. For any π₯ =π π¦ : π΄ and π : π¦ =π΄ π§ : π΄, π(π₯) : π (π₯), we have
π*(π*(π(π₯))) = (π β π)*(π(π₯))
Proof. We develop both sides of the equation and wind up with the same result:
π*(π*π(π₯)) =π(π) π*(π(π¦)) =π(π) π(π§)(π β π)*(π(π₯)) =π(πβπ) π(π§)
Lemma 5.11. For any π : π΄ β π΅, π₯ =π π¦ : π΄ and π’ : π (π(π₯)), we have:
Chapter 5. Homotopy Type Theory 111
π‘ππππ ππππ‘π βπ (π, π’) = π‘ππππ ππππ‘π (ππ (π), π’)
Proof. This lemma hinges on the fact that there is two possible interpretations of π’ thatstems from the fact that (π βπ)(π₯) β‘ π(π(π₯)). Thus, we can see π’ as functional expressionπ on π(π₯) or an expression π β π on π₯:
Chapter 5. Homotopy Type Theory 112
π₯=
ππ¦
:π΄π’
β‘(π
βπ
)(π₯):
(πβπ
)(π₯)
π(π₯,π¦
)β(π
βπ
)(π₯):
(πβπ
)(π¦)
π(π₯,π¦
)β(π
βπ
)(π₯)=
π(π
)(π
βπ
)(π¦):
(πβπ
)(π¦)
π(π₯,π¦
)β(π
βπ
)(π₯)=
π(π
)π(π
(π¦))
:π(π
(π¦))
π₯=
ππ¦
:π΄π
(π₯)=
π’π
(π)π
(π¦):π΅
π’β‘π(π
(π₯))
:π(π
(π₯))
ππ(π
)(π
(π₯),π
(π¦))
βπ(π
(π₯))
:π(π
(π¦))
ππ(π
)(π
(π₯),π
(π¦))
βπ(π
(π₯))
=π
(π)π(π
(π¦))
:π(π
(π¦))
π(π
(π¦))
=π
(π(π
))π
π(π
)(π
(π₯),π
(π¦))
βπ(π
(π₯))
:π(π
(π¦))
π(π₯,π¦
)β(π
βπ
)(π₯)=
π(π
(π),
π(π
(π))
)π
π(π
)(π
(π₯),π
(π¦))
βπ(π
(π₯))
:π(π
(π¦))
π‘ππππ ππππ‘π
βπ(π,π’
)=π
(π(π
),π
(π(π
)))π‘ππππ ππππ‘π
(ππ(π
),π’)
Chapter 5. Homotopy Type Theory 113
Lemma 5.12. For any π : Ξ (π₯:π΄)π (π₯) β π(π₯), π₯ =π π¦ : π΄ and π’(π₯) : π (π₯), we have:
π‘ππππ ππππ‘π(π, π(π’(π₯))) = π(π‘ππππ ππππ‘π (π, π’(π₯)))
Proof. We proceed the usual way, constructing a derivation tree that establishes the equal-ity:
π₯ =π π¦ : π΄ π(π’(π₯)) : π(π₯)π(π₯, π¦) β π(π’(π₯)) : π(π¦)
π(π₯, π¦) β π(π’(π₯)) =π(π) π(π’(π¦)) : π(π¦)
π₯ =π π¦ : π΄ π’(π₯) : π (π₯)π(π₯, π¦) β π’(π₯) : π (π¦)
π(π₯, π¦) β π’(π₯) =π(π) π’(π¦) : π (π¦) π : Ξ (π₯:π΄)π (π₯) β π(π₯)π(π(π₯, π¦) β π’(π₯)) =ππ (π(π)) π(π’(π¦)) : π(π¦)π(π’(π¦)) =π(ππ (π(π))) π(π(π₯, π¦) β π’(π₯)) : π(π¦)
π(π₯, π¦) β π(π’(π₯)) =π(π(π),π(ππ (π(π)))) π(π(π₯, π¦) β π’(π₯))π‘ππππ ππππ‘π(π, π(π’(π₯))) =π(π(π),π(ππ (π(π)))) π(π‘ππππ ππππ‘π (π, π’(π₯)))
5.4 HOMOTOPIES
In Homotopy Type Theory, a homotopy is defined as follows (Univalent Foundations Program,2013):
Definition 5.1. For any π, π : Ξ (π₯:π΄)π (π₯), a homotopy from π to π is a dependent functionof type:
(π βΌ π) β‘ Ξ (π₯:π΄)(π(π₯) = π(π₯))
In our path-based approach, we have a homotopy π, π : Ξ (π₯:π΄)π (π₯) if for every π₯ : π΄we have a computational path between π(π₯) = π(π₯). Thus, if we have a homotopy π»π,π :π βΌ π, we derive the following rule:
π»π,π : π βΌ π π, π : Ξ (π₯:π΄)π (π₯) π₯ : π΄π(π₯) =π»π,π(π₯) π(π₯) : π (π₯)
And:
π, π : Ξ (π₯:π΄)π (π₯) π₯ : π΄[π, π : Ξ (π₯:π΄)π (π₯), π₯ : π΄]
π(π₯) =π π(π₯)π»π
π,π : π βΌ π
Chapter 5. Homotopy Type Theory 114
Lemma 5.13. For any π, π, β : π΄ β π΅, the following types are inhabited:
1. π βΌ π
2. (π βΌ π) β (π βΌ π)
3. (π βΌ π) β (π βΌ β) β (π βΌ β)
Proof. 1. We construct the following term:
π : π΄ β π΅ π₯ : π΄
[π₯ : π΄]π₯ =π π₯ [π : π΄ β π΅]π(π₯) =ππ (π) π(π₯) : π΅
π»ππ (π)π,π : π βΌ π
2. We construct:
π, π : π΄ β π΅ π₯ : π΄
[π»π,π : π βΌ π] [π, π : π΄ β π΅] [π₯ : π΄]π(π₯) =π»π,π(π₯) π(π₯) : π΅π(π₯) =π(π»π,π(π₯)) π(π₯) : π΅
π»π(π»π,π(π₯))π,π : π βΌ π
ππ»π,π.π»π(π»π,π(π₯))π,π : (π βΌ π) β (π βΌ π)
3. We construct:
π, β : π΄ β π΅ π₯ : π΄
[π»π,π : π βΌ π] [π, π : π΄ β π΅] [π₯ : π΄]π(π₯) =π»π,π(π₯) π(π₯) : π΅
[π»π,β : π βΌ β] [π, β : π΄ β π΅] [π₯ : π΄]π(π₯) =π»π,β(π₯) β(π₯) : π΅
π(π₯) =π(π»π,π(π₯),π»π,π§(π₯)) β(π₯) : π΅
π»π(π»π,π(π₯),π»π,π§(π₯))π,β : π βΌ β
ππ»π,π.ππ»π,β.π»π(π»π,π(π₯),π»π,π§(π₯))π,β : (π βΌ π) β (π βΌ β) β (π βΌ β)
Lemma 5.14. For any π»π,π : π βΌ π and functions π, π : π΄ β π΅ and a path π₯ =π π¦ : π΄we have:
π(π»π,π(π₯), ππ(π)) = π(ππ (π), π»π,π(π¦))
Chapter 5. Homotopy Type Theory 115
Proof. To establish this equality, we need to add a new rule to our πΏππ·πΈπ β ππ π. Weintroduce rule 43:
π»π,π : π βΌ π π₯ : π΄ π, π : π΄ β π΅
π(π₯) =π»π,π(π₯) π(π₯) : π΅π₯ =π π¦ : π΄
π(π₯) =ππ(π) π(π¦) : π΅π(π₯) =π(π»π,π(π₯),ππ(π)) π(π¦) : π΅
Bβπ
π₯ =π π¦ : π΄π(π₯) =ππ (π) π(π¦) : π΅
π»π,π : π βΌ π π₯ : π΄ π, π : π΄ β π΅
π(π¦) =π»π,π(π¦) π(π¦) : π΅π(π₯) =π(ππ (π),π»π,π(π¦) π(π¦) : π΅
And thus:
π(π»π,π(π₯), ππ(π)) =βπ π(ππ (π), π»π,π(π¦))
After this section, we start to study specific lemmas and theorems involving basictypes of type theory. Nevertheless, several of those theorems are statements about thenotion of equivalence (notation: β). Before we define equivalence, we need the followingdefinition (Univalent Foundations Program, 2013):
Definition 5.2. A quasi-inverse of a function π : π΄ β π΅ is a triple (π, πΌ, π½) such thatπ is a function π : π΅ β π΄ and πΌ and π½ are homotopies such that πΌ : π β π βΌ πΌππ΅ andπ½ : π β π βΌ πΌππ΄
A quasi-inverse of π is usually written as ππππ£(π).
Definition 5.3. A function π : π΄ β π΅ is an equivalence if there is a quasi-inverseππππ£(π) : π΅ β π΄.
5.5 CARTESIAN PRODUCT
We start proving some important lemmas and theorems for the Cartesian product type.As we did in previous subsections, we proceed using our path-based approach. Before weprove our first theorem, it is important to remember that given a term π₯ : π΄Γπ΅, we canextract two projections, πΉππ (π₯) : π΄ and πππ·(π₯) : π΅. Thus, given a path π₯ =π π¦ : π΄Γπ΅,we extract paths πΉππ (π₯) = πππ·(π¦) : π΄ and πππ·(π₯) = πππ·(π¦) : π΅.
Theorem 5.1. The function (π₯ =π π¦ : π΄Γπ΅) β (πΉππ (π₯) = πΉππ (π¦) : π΄) Γ (πππ·(π₯) =πππ·(π¦) : π΅) is an equivalence for any π₯ and π¦.
Proof. To show the equivalence, we need to show the following
Chapter 5. Homotopy Type Theory 116
1. From π₯ =π π¦ : π΄ Γ π΅ we want to obtain (πΉππ (π₯) = πΉππ (π¦) : π΄) Γ (πππ·(π₯) =πππ·(π¦) : π΅) and from that, we want to go back to π₯ =π π¦ : π΄Γπ΅.
2. We want to do the inverse process. From (πΉππ (π₯) = πΉππ (π¦) : π΄) Γ (πππ·(π₯) =πππ·(π¦) : π΅) we want to obtain π₯ =π π¦ : π΄ Γ π΅ and then go back to (πΉππ (π₯) =πΉππ (π¦) : π΄) Γ (πππ·(π₯) = πππ·(π¦) : π΅).
To show the first part, we need rule 21:
π₯ =π π¦ : π΄Γπ΅
πΉππ (π₯) =π1(π) πΉππ (π¦) : π΄π₯ =π π¦ : π΄Γπ΅
πππ·(π₯) =π2(π) πππ·(π¦) : π΅β¨πΉππ (π₯), πππ·(π₯)β© =π(π1(π),π2(π)) β¨πΉππ (π¦), πππ·(π¦)β© : π΄Γπ΅
Bππ₯ π₯ =π π¦ : π΄Γπ΅.
Thus, applying rule ππ₯ we showed the first part of our proof. For the second part, weneed rules 14 and 15:
π₯ =π π₯β² : π΄ π¦ =π π§ : π΅
β¨π₯, π¦β© =πβ§(π,π ) β¨π₯β², π§β© : π΄Γπ΅
πΉππ (β¨π₯, π¦β©) =π1(πβ§(π,π )) πΉππ (β¨π₯β², π§β©) : π΄
Bππ₯2π π₯ =π π₯β² : π΄.
And:
π₯ =π π¦ : π΄ π§ =π π€ : π΅β¨π₯, π§β© =πβ§(π,π ) β¨π¦, π€β© : π΄Γπ΅
πΉππ (β¨π₯, π§β©) =π2(πβ§(π,π )) πΉππ (β¨π¦, π€β©) : π΅
Bππ₯2π π§ =π π€ : π΅.
We also use the π-reduction for the Cartesian product:
β¨πΉππ (π₯), πππ·(π₯)β© : π΄Γπ΅ Bπ π₯ : π΄Γπ΅
We construct the following derivation tree:
β¨πΉππ (π₯) =π πΉππ (π¦), πππ·(π₯) =π‘ πππ·(π¦)β©πΉππ (π₯) =π πΉππ (π¦) : π΄
β¨πΉππ (π₯) =π πΉππ (π¦), πππ·(π₯) =π‘ πππ·(π¦)β©πππ·(π₯) =π‘ πππ·(π¦) : π΅
β¨πΉππ (π₯), πππ·(π₯)β© =πβ§(π ,π‘) β¨πΉππ (π¦), πππ·(π¦)β© : π΄Γπ΅Bπ
π₯ =π(π ,π‘) π¦ : π΄Γπ΅
Chapter 5. Homotopy Type Theory 117
From π₯ =π(π ,π‘) π¦ : π΄Γπ΅, we have:
π₯ =π(π ,π‘) π¦ : π΄Γπ΅
πΉππ (π₯) =π1(πβ§(π ,π‘) πΉππ (π¦) : π΄π₯ =π(π ,π‘) π¦ : π΄Γπ΅
πππ·(π₯) =π2(πβ§(π ,π‘) πππ·(π¦) : π΅β§ β πΌβ¨πΉππ (π₯) =π1(πβ§(π ,π‘) πΉππ (π¦), πππ·(π₯) =π2(πβ§(π ,π‘) πππ·(π¦)β©
Bππ₯2π,ππ₯2πβ¨πΉππ (π₯) =π πΉππ (π¦), πππ·(π₯) =π‘ πππ·(π¦)β©
Thus, we showed part 2 and concluded the proof of this theorem.
Theorem 5.2. For any type families Ξ (π§:π)π΄,Ξ (π§:π)π΅ and a type family defined by (π΄Γπ΅)(π§) β‘ π΄(π§) Γπ΅(π§), a path π§ =π π€ : π and π(π§) : π΄(π§) Γπ΅(π§), we have:
π‘ππππ ππππ‘π΄Γπ΅(π, π(π§)) = β¨π‘ππππ ππππ‘π΄(π, πΉππ (π(π§))), π‘ππππ ππππ‘π΅(π, πππ·(π(π§)))β© :π΄(π€) Γπ΅(π€)
Proof. We construct a derivation tree that establishes the equality:
Chapter 5. Homotopy Type Theory 118
π§=
ππ€
:ππ
(π§):π΄
(π§)Γ
π΅(π§
)π(π§,π€
)βπ
(π§):π΄
(π€)Γ
π΅(π€
)π(π§,π€
)βπ
(π§)=
π(π
)π
(π€):π΄
(π€)Γ
π΅(π€
)π(π§,π€
)βπ
(π§)=
π(π
(π),
π)
β¨πΉππ
(π(π€
)),πππ·
(π(π€
))β©:π΄
(π€)Γ
π΅(π€
)
π§=
ππ€
:ππΉππ
(π(π§
)):π΄
(π§)
π(π§,π€
)βπΉππ
(π(π§
)):π΄
(π€)
π§=
ππ€
:ππππ·
(π(π§
)):π΅
(π§)
π(π§,π€
)βπππ·
(π(π§
)):π΅
(π€)
β¨π(π§,π€
)βπΉππ
(π(π§
)),π
(π§,π€
)βπππ·
(π(π§
))β©:π΄
(π€)Γ
π΅(π€
)β¨π
(π§,π€
)βπΉππ
(π(π§
)),π
(π§,π€
)βπππ·
(π(π§
))β©=
π(π
)β¨πΉππ
(π(π€
)),πππ·
(π(π€
))β©
β¨πΉππ
(π(π€
)),πππ·
(π(π€
))β©=
π(π
(π))
β¨π(π§,π€
)βπΉππ
(π(π§
)),π
(π§,π€
)βπππ·
(π(π§
))β©
π(π§,π€
)βπ
(π§)=
π(π
(π(π
),π
),π
(π(π
)))
β¨π(π§,π€
)βπΉππ
(π(π§
)),π
(π§,π€
)βπππ·
(π(π§
))β©:π΄
(π€)Γ
π΅(π€
)π‘ππππ ππππ‘π΄
Γπ΅
(π,π
(π§))
=π
(π(π
(π),
π),
π(π
(π))
)β¨π‘ππππ ππππ‘π΄
(π,πΉππ
(π(π§
))),π‘ππππ ππππ‘π΅
(π,πππ·
(π(π§
)))β©
:π΄(π€
)Γπ΅
(π€)
Chapter 5. Homotopy Type Theory 119
Theorem 5.3. For any π₯, π¦ : π΄Γπ΅, πΉππ (π₯) =π πΉππ (π¦) : π΄, πππ·(π₯) =π πππ·(π¦) : π΅,functions π : π΄ β π΄β², β : π΅ β π΅β² and π : π΄ Γ π΅ β π΄β² Γ π΅β² defined by π(π₯) β‘β¨π(πΉππ (π₯)), β(πππ·(π₯)β©, we have:
ππ (πβ§(π, π)) = πβ§(ππ(π), πβ(π))
Proof. We introduce rule 44:
πΉππ (π₯) =π πΉππ (π¦) : π΄ πππ·(π₯) =π πππ·(π¦) : π΅β¨πΉππ (π₯), πππ·(π₯)β© =πβ§(π,π) β¨πΉππ (π¦), πππ·(π¦)β© : π΄Γπ΅ =π
π₯ =πβ§(π,π) π¦ : π΄Γπ΅
π(π₯) =ππ (πβ§(π,π)) π(π¦) : π΄β² Γπ΅β²
Bππ₯π
πΉππ (π₯) =π πΉππ (π¦) : π΄π(πΉππ (π₯)) =ππ(π) π(πΉππ (π¦)) : π΄β²
πππ·(π₯) =π πππ·(π¦) : π΅β(πππ·(π₯)) =πβ(π) β(πππ·(π¦)) : π΅β²
β¨π(πΉππ (π₯), β(πππ·(π₯))β© =πβ§(ππ(π),πβ(π)) β¨π(πΉππ (π¦)), β(πππ·(π¦))β© : π΄β² Γπ΅β²
π(π₯) =πβ§(ππ(π),πβ(π)) π(π¦) : π΄β² Γπ΅β²
And thus:
ππ (πβ§(π, π)) =ππ₯π πβ§(ππ(π), πβ(π))
5.6 UNIT TYPE
For the unit type 1, our objective is to show the following theorem:
Theorem 5.4. For any π₯, π¦ : 1, there is a path π‘ such that π₯ =π‘ π¦. Moreover, π‘ = π.
Proof. To show that there is such π‘, we need to use the induction for the unit type(Univalent Foundations Program, 2013):
* Bπ π₯ : 1
Therefore, given π₯, π¦ : 1, we have:
π₯ =π(π) * : 1 * =π π¦ : 1π₯ =π(π(π),π) π¦ : 1
Chapter 5. Homotopy Type Theory 120
Moreover, by rule 4, we have:
π(π(π), π) =π‘π π π.
Thus, π‘ β‘ π(π(π), π) and π‘ =π‘π π π.
5.7 FUNCTION EXTENSIONALITY
In this subsection, we are interested in the property of function extensionality. In otherwords, we want to conclude that given any two functions π, π, if for any π₯ we have thatπ(π₯) = π(π₯), then π = π. That π = π implies π(π₯) = π(π₯) by rules of basic type theoryis shown in the sequel. Nonetheless, basic type theory is insufficient to derive functionextensionality (Univalent Foundations Program, 2013). Our approach using computationalpaths also cannot derive full function extensionality. Nevertheless, we end up proving aweakened version which says that if π΄ is non-empty, then the above principle of functionextensionality over π΄ β π΅ holds (QUEIROZ; OLIVEIRA; RAMOS, 2016):
π΄ β (Ξ ππ΄βπ΅Ξ ππ΄βπ΅(Ξ π₯π΄Idπ΅(π΄ππ (π, π₯), π΄ππ (π, π₯)) β Idπ΄βπ΅(π, π)))
The proof is as follows (QUEIROZ; OLIVEIRA; RAMOS, 2016):
Chapter 5. Homotopy Type Theory 121
[π§:π΄
]
[π:π΄
βπ΅
][π
:π΄β
π΅]
[π£:Ξ
π₯π΄πΌπ
π΅(π΄ππ
(π,π₯
),π΄ππ
(π,π₯
))]
π΄ππ
(π£,π§
):πΌπ
π΅(π΄ππ
(π,π§
),π΄ππ
(π,π§
))
[π:π΄
βπ΅
]ππ§π΄ππ
(π,π§
)=ππ
:π΄β
π΅
π=
π(π
)ππ§.π΄ππ
(π,π§
):π΄
βπ΅
[π΄ππ
(π,π§
)=π‘π΄ππ
(π,π§
):π΅
]ππ§π΄ππ
(π,π§
)=π(π‘
)ππ§.π΄ππ
(π,π§
):π΄
βπ΅
π=
π(π
(π),
π(π‘
))ππ§.π΄ππ
(π,π§
):π΄
βπ΅
[π:π΄
βπ΅
]ππ§.π΄ππ
(π,π§
)=ππ
:π΄β
π΅
π=
π(π
(π(π
),π(π‘
)),π
)π
:π΄β
π΅
(π(π
(π(π
),π(π‘)
),π))
(π,π
):πΌπ
π΄β
π΅(π,π
)π πΈππ
(π΄ππ
(π£,π§
),π‘.
(π(π
(π(π
),π(π‘)
),π))
(π,π
)):πΌπ
π΄β
π΅(π,π
)ππ£.π πΈππ
(π΄ππ
(π£,π§
),π‘.
(π(π
(π(π
),π(π‘)
),π))
(π,π
)):Ξ
π₯π΄.πΌπ
π΅(π΄ππ
(π,π₯
),π΄π
(π,π₯
))β
πΌπ
π΄β
π΅(π,π
)ππ.ππ£.π πΈππ
(π΄ππ
(π£,π§
),π‘.
(π(π
(π(π
),π(π‘)
),π))
(π,π
)):Ξ
ππ΄
βπ΅
(Ξ π₯
π΄.πΌπ
π΅(π΄ππ
(π,π₯
),π΄π
(π,π₯
))β
πΌπ
π΄β
π΅(π,π
))ππ.ππ.ππ£.π πΈππ
(π΄π
(π£,π§
),π‘.
(π(π
(π(π
),π(π‘)
),π))
(π,π
)):Ξ
ππ΄
βπ΅
Ξ π
π΄β
π΅(Ξ π₯
π΄.πΌπ
π΅(π΄ππ
(π,π₯
),π΄π
(π,π₯
))β
πΌπ
π΄β
π΅(π,π
))ππ§.ππ.ππ.ππ£.π πΈππ
(π΄ππ
(π£,π§
),π‘.
(π(π
(π(π
),π(π‘)
),π))
(π,π
)):π΄
β(Ξ π
π΄β
π΅Ξ π
π΄β
π΅(Ξ π₯
π΄.πΌπ
π΅(π΄ππ
(π,π₯
),π΄π
(π,π₯
))β
πΌπ
π΄β
π΅(π,π
)))
Chapter 5. Homotopy Type Theory 122
Nevertheless, if we want full function extensionality and not just a weak version, weneed to add a new rule to type theory. First, we letβs prove the following lemma:
Lemma 5.15. The following function exists:
(π = π) β Ξ (π₯:π΄)(π(π₯) = π(π₯) : π΅(π₯))
Proof. The construction is straightforward:
[π =π π] [π₯ : π΄]π(π₯) =π(π ) π(π₯) : π΅(π₯)
ππ .ππ₯.(π(π₯) =π(π ) π(π₯)) : (π = π) β Ξ (π₯:π΄)(π(π₯) = π(π₯) : π΅(π₯))
Now, to add function extensionality to our system, we need to add the followinginference rule:
ππ₯.(π(π₯) =π‘ π(π₯)) : Ξ (π₯:π΄)π΅ππ₯π‘
π =ππ₯π‘(π‘) π
This rule is only needed if one wants to work with an extensional system. In that case,together with this inference rule, we also need to introduce two important reduction rulesrelated to extensionality:
ππ₯π‘(π(π )) =ππ₯π‘π π
π(ππ₯π‘(π‘)) =ππ₯π‘π π‘
Since these rules are connected only to extensionality, we do not consider them as partof the basic rules of our rewriting system. Nevertheless, we can now prove the following:
Lemma 5.16. (π = π) β Ξ (π₯:π΄)(π(π₯) = π(π₯) : π΅(π₯))
Proof. This theorem is the direct application of the aforementioned extensionality rules.We have:
π =π π : Ξ (π₯:π΄)π΅ π₯ : π΄π(π₯) =π(π ) π(π₯) : π΅(π₯)
Bππ₯π‘π π =π π : Ξ (π₯:π΄)π΅ππ₯.(π(π₯) =π(π ) π(π₯)) : Ξ (π₯:π΄)π΅
π =ππ₯π‘(π(π )) π : Ξ (π₯:π΄)π΅
Chapter 5. Homotopy Type Theory 123
We also have:
ππ₯.(π(π₯) =π‘ π(π₯)) : Ξ (π₯:π΄)π΅
π =ππ₯π‘(π‘) π : Ξ (π₯:π΄)π΅ [π₯ : π΄]Bππ₯π‘π ππ₯.(π(π₯) =π‘ π(π₯)) : Ξ (π₯:π΄)π΅
π(π₯) =π(ππ₯π‘(π‘)) π(π₯) : π΅(π₯)ππ₯.(π(π₯) =π(ππ₯π‘(π‘)) π(π₯)) : Ξ (π₯:π΄)π΅
Those two derivations tree establish the equivalence.
Before we prove the next theorem, we need to revisit transport. For any functionπ : π΄(π₯) β π΅(π₯), it is possible to transport along this function π , resulting in π*(π) :π΄(π¦) β π΅(π¦). In our approach, one should think of π*(π) as a function that has transportof a term π : π΄(π₯) as input, i.e., π*(π) : π΄(π¦). Thus, we define π*(π) point-wise:
π*(π)(π*(π)) β‘ π*(π(π))
Lemma 5.17. For any path π₯ =π π¦ : π and functions π : π΄(π₯) β π΅(π₯) and π : π΄(π¦) βπ΅(π¦), we have the following equivalence:
(π*(π) = π) β Ξ (π:π΄(π₯))(π*(π(π)) = π(π*(π)))
Proof. We give two derivations tree, using the rules that we have established in the pre-vious theorem:
π*(π) =π π [π : π΄(π₯)]π*(π)(π*(π)) =π(π) π(π*(π)) : π΅(π¦)
ππ.(π*(π)(π*(π) β‘ π(π)) =π(π) π(π*(π))) : Ξ (π:π΄(π₯))(π*(π(π)) = π(π*(π)))π*(π) =ππ₯π‘(π(π)) π Bππ₯π‘ππ*(π) =π π
And:
ππ.(π*(π(π)) =π‘ π(π*(π)))ππ.(π*(π)(π*(π)) =π‘ π(π*(π)))
π*(π) =ππ₯π‘(π‘) π [π : π΄(π₯)]π*(π)(π*(π)) =π(ππ₯π‘(π‘)) π(π*(π))π*(π(π)) =π(ππ₯π‘(π‘)) π(π*(π))
Bππ₯π‘ππ*(π(π)) =π‘ π(π*(π))
ππ.(π*(π(π)) =π‘ π(π*(π)))
Chapter 5. Homotopy Type Theory 124
5.8 UNIVALENCE AXIOM
The first thing to notice is that in our approach the following lemma holds:
Lemma 5.18. For any types π΄ and π΅, the following function exists:
πππ‘ππππ£ : (π΄ = π΅) β (π΄ β π΅)
Proof. The idea of the proof is similar to the one shown in (Univalent Foundations Program,2013). We define πππ‘ππππ£ to be π* : π΄ β π΅. Thus, to end this proof, we just need to showthat π* is an equivalence.
For any path π, we can form a path π(π) and thus, we have (π(π))* : π΅ β π΄. Now,we show that (π(π)))* is a quasi-inverse of π*.
We need to check that:
1. π*((π(π)*(π)) = π
2. (π(π))*(π*(π)) = π
Both equations can be shown by an application of lemma 5.10:
1. π*((π(π)*(π)) = (π(π) β π)*(π) = π(π, π(π))*(π) =π‘π π*(π) =π(π) π.
2. (π(π))*(π*(π)) = (π β π(π))Ε₯*(π) = π(π(π), π)*(π) =π‘π π π*(π) =π(π) π
As we did in the previous section in lemma 5.15, we showed that a function exists, butwe did not show that it is an equivalence. In fact, basic type theory cannot conclude thatπππ‘ππππ£ is an equivalence(Univalent Foundations Program, 2013). If we want this equivalenceto be a property of our system, we must add a new axiom. This axiom is known asVoevodskyβs univalence axiom(Univalent Foundations Program, 2013):
Axiom 5.1. For any types π΄,π΅, πππ‘ππππ£ is an equivalence, i.e., we have:
(π΄ = π΅) β (π΄ β π΅)
Lemma 5.19. For any π₯, π¦ : π΄, π’(π₯) : π΅(π₯) and path π₯ =π π¦ : π΄, we have:
π‘ππππ ππππ‘π΅(π, π’(π₯)) = π‘ππππ ππππ‘πβπ(ππ΅(π), π’(π₯)) = πππ‘ππππ£(ππ΅(π))(π’(π₯))
Proof. We develop every term of the equation and show that they arrive at the sameconclusion:
Chapter 5. Homotopy Type Theory 125
π₯ =π π¦ : π΄ π’(π₯) : π΅(π₯)π(π₯, π¦) β π’(π₯) : π΅(π¦)
π(π₯, π¦) β π’(π₯) =π(π) π’(π¦) : π΅(π¦)
π΅(π₯) =ππ΅(π) π΅(π¦) π’(π₯) : π΅(π₯)ππ΅(π)(π΅(π₯), π΅(π¦)) β π’(π₯) : π΅(π¦)
ππ΅(π)(π΅(π₯), π΅(π¦)) β π’(π₯) =π(π) π’(π¦) : π΅(π¦)
Since πππ‘ππππ£ β‘ π*, we have that πππ‘ππππ£(ππ΅(π))(π’(π₯)) is the same as π*(ππ΅(π))(π’(π₯))that is the same as π‘ππππ ππππ‘πβπ(ππ΅(π), π’(π₯)).
5.9 IDENTITY TYPE
In this section, we investigate specific lemmas and theorems related to the identity type.We start with the following theorem:
Theorem 5.5. if π : π΄ β π΅ is an equivalence, then for π₯, π¦ : π΄ we have:
ππ : (π₯ = π¦ : π΄) β (π(π₯) = π(π¦) : π΅)
Proof. We will omit the specific details of this proof, since it is equal to the one oftheorem 2.11.1 presented in (Univalent Foundations Program, 2013). This is the case becausethis proof is independent of the usage of the induction principle of the identity type. Theonly difference is that at some steps we need to cancel inverse paths. In our approach,this is done by straightforward applications of rules 3,4,5 and 6.
Lemma 5.20. For any π : π΄, with π₯1 =π π₯2
1. π‘ππππ ππππ‘π₯β(π=π₯)(π, π(π₯1)) = π(π(π₯1), π), for π(π₯1) : π = π₯1
2. π‘ππππ ππππ‘π₯β(π₯=π)(π, π(π₯1)) = π(π(π), π(π₯1), for π(π₯1) : π₯1 = π
3. π‘ππππ ππππ‘π₯β(π₯=π₯)(π, π(π₯1)) = π(π(π), π(π(π₯1), π)) for π(π₯1) : π₯1 = π₯1
Proof. 1. We start establishing the following reduction:
π =π(π₯1) π₯1 π₯1 =π π₯2 B π =π(π₯2) π₯2π =π(π(π₯1,π)) π₯2
Thus, we just need to show that π‘ππππ ππππ‘π₯β(π=π₯)(π, π(π₯1)) also reduces to π =π(π₯(2))
π₯2:
Chapter 5. Homotopy Type Theory 126
π₯1 =π π₯2 π(π₯1) : π = π₯1 =π(π) (π =π(π₯2) π₯2)π(π₯1, π₯2) β π(π₯1) : π = π₯2
2. We use the same idea:
π₯2 =π(π) π₯1 π₯1 =π(π₯1) π B π₯2 =π(π₯2) ππ₯2 =π(π(π),π(π₯1)) π
π₯1 =π π₯2 π(π₯1) : π₯1 = π =π(π) (π₯2 =π(π₯2) π)π(π₯1, π₯2) β π(π₯1) : π₯2 = π
3. Same as the previous cases:
π₯2 =π(π) π₯1 π₯1 =π(π₯1) π₯1π₯2 =π(π(π),π(π₯1)) π₯1 π₯1 =π π₯2 B π₯2 =π(π₯2) π₯2π₯2 =π(π(π(π),π(π₯1)),π) π₯2
π₯1 =π π₯2 π(π₯1) : π₯1 = π₯1 =π(π) (π₯2 =π(π₯2) π₯2)π(π₯1, π₯2) β π(π₯1) : π₯2 = π₯2
Theorem 5.6. For any π, π : π΄ β π΅, with π =π πβ² : π΄ and π(π) =π(π) π(π) : π΅, we have:
π‘ππππ ππππ‘π₯β(π(π₯)=π(π₯)):π΅(π, π) = π(π(π(ππ(π)), π(π)), ππ(π)) : π(πβ²) = π(πβ²)
Proof. This proof is analogous to the proof of the previous lemma:
π =π πβ² : π΄
π(π) =ππ (π) π(πβ²)π(πβ²) =π(ππ (π)) π(π) π(π) =π(π)π(π)
π(π) =π(π(ππ (π)),π(π)) π(π)π =π π
β²
π(π) =ππ(π) π(πβ²)B π(πβ²) =π(πβ²) π(πβ²)
π(πβ²) =π(π(π(ππ(π)),π(π)),ππ(π)) π(πβ²)
And:
Chapter 5. Homotopy Type Theory 127
π =π πβ² π(π) : π(π) = π(π) =π(π) (π(πβ²) =π(πβ²) π(πβ²))
π(π, πβ²) β π(π) : π(πβ²) = π(πβ²)
Theorem 5.7. For any π, π : Ξ (π₯:π΄)π΅(π₯), with π =π πβ² : π΄ and π(π) =π(π) π(π) : π΅(π), we
have:
π‘ππππ ππππ‘π₯β(π(π₯)=π(π₯):π΅(π₯))(π, π) = π(π(π(ππππ (π)), ππ‘ππππ ππππ‘π΅π(π)), ππππ(π))
where ππππ (π) β‘ (π(π, πβ²) β π(π) =π(π) π(πβ²)) and ππππ β‘ (π(π, πβ²) β π(π) =π(π) π(πβ²))
Proof. Similar to previous theorem:
π(π, πβ²) β π(π) =π(π) π(πβ²)π(πβ²) =π(π(π)) π(π, πβ²) β π(π)
π(π) =π(π) π(π)π(π, πβ²) β π(π) =π
π‘ππππ π΅π(π(π)) π(π, πβ²) β π(π)
π(πβ²) =π(π(π(π)),ππ‘ππππ π΅π
(π(π))) π(π, πβ²) β π(π) π(π, πβ²) β π(π) =π(π) π(πβ²)π(πβ²) =π(π(π(π(π)),π
π‘ππππ π΅π(π(π))),π(π) π(πβ²)
B π(πβ²) =π(πβ²) π(πβ²)
And:
π =π πβ² π(π) : π(π) = π(π)
Bπ(π) π(πβ²) =π(πβ²) π(πβ²)π(π, πβ²) β π(π) : π(πβ²) = π(πβ²)
Theorem 5.8. For any π =π πβ² : π΄, π =π π and πβ² =π π
β², we have:
(π‘ππππ ππππ‘π₯β(π₯=π₯)(π, π) = π) β (π(π, π) = π(π, π))
Proof. We use lemma 5.20 to prove this theorem, together with rules 3,4,5,6 and 37. Wealso consider functions π(π₯) β‘ π(π, π₯) : (πβ² = π§) β (π = π§) and πβ1(π₯) β‘ π(π(π), π₯) : (π =π§) β (πβ² = π§). We proceed the same way as we have done to prove previous equivalences.In other words, we show two derivations trees. They are as follows:
π‘ππππ ππππ‘π₯β(π₯=π₯)(π, π) = πlemma 5.20
π(π(π), π(π, π)) = πππ
π(π, π(π(π), π(π, π))) = π(π, π)π(π(π, π(π)), π(π, π)) = π(π, π)
π(π, π(π, π)) = π(π, π)π(π, π) = π(π, π)
Chapter 5. Homotopy Type Theory 128
And:
π(π, π) = π(π, π)ππβ1
π(π(π), π(π, π)) = π(π(π), π(π, π))π(π(π), π(π, π)) = π(π(π(π), π), π)
π(π(π), π(π, π)) = π(π(π, π)π(π(π), π(π, π)) = π
lemma 5.20π‘ππππ ππππ‘π₯β(π₯=π₯)(π, π) = π
5.10 COPRODUCT
One essential thing to remember is that a productπ΄+π΅ has a left injection πππ : π΄ β π΄+π΅and πππ : π΅ β π΄+π΅. As described in (Univalent Foundations Program, 2013), it is expectedthat π΄+π΅ contains copies of π΄ and π΅ disjointly. In our path based approach, we achievethis by constructing every path πππ(π) = πππ(π) and πππ(π) = πππ(π) by applications ofaxiom π on paths π = π. Thus we show that we get the following equivalences:
1. (πππ(π1) = πππ(π2)) β (π1 = π2)
2. (πππ(π1) = πππ(π2)) β (π1 = π2)
3. (πππ(π) = πππ(π)) β 0
To prove this, we use the same idea as in (Univalent Foundations Program, 2013). Wecharacterize the type:
(π₯ β (πππ(π0) = π₯)) : Ξ (π₯:π΄+π΅)(πππ(π0 = π₯))
To do this, we define a type ππππ:
π₯ : π΄+π΅ β’ ππππ(π₯) type
Our main objective is to prove the equivalence Ξ (π₯:π΄+π΅)((πππ(π0) = π₯) β ππππ(π₯)).Using the recursion principle of the coproduct, we can define ππππ by two equations:
ππππ(πππ(π)) β‘ (π0 = π)ππππ(πππ(π)) β‘ 0
Theorem 5.9. For any π₯ : π΄+π΅, we have πππ(π0 = π₯) β ππππ(π₯)
Proof. To show this equivalence, we use the same method as the one shown in (Univalent
Foundations Program, 2013). The main idea is to define functions
Chapter 5. Homotopy Type Theory 129
ππππππ : Ξ (π₯:π΄+π΅)Ξ (π:πππ(π0)=π₯)ππππ(π₯)ππππππ : Ξ (π₯:π΄+π΅)Ξ (π:ππππ(π₯))(πππ(π0) = π₯))
such that ππππππ acts as a quasi-inverse of ππππππ.We start defining ππππππ:
ππππππ(π₯, π ) β‘ π‘ππππ ππππ‘ππππ(π , ππ0)
We notice that ππ0 : ππππ(πππ(π0)), since ππππ(πππ(π0)) β‘ (π0 =π π0) We also noticethat for ππππππ, it is only possible for the argument π₯ to be of the form π₯ β‘ πππ(π), sincethe other possibility is π₯ β‘ πππ(π), but that case is not possible, because we would havea function to ππππ(πππ(π)) β‘ 0.
For ππππππ, when π₯ β‘ πππ(π), we have that ππππ(π₯) β‘ π0 =π π and thus, we definedecode as (πππ(π0) =π(π) πππ(π)). When π₯ β‘ πππ(π), then ππππ(π₯) β‘ 0 and thus, we defineππππππ as having any value, given by the elimination of the type 0. Now, we can finallyprove the equivalence.
Starting with ππππππ, we have π₯ β‘ πππ(π), πππ(π0) =π π₯. Sinceππππππ(π₯, π ) β‘ π‘ππππ ππππ‘ππππ(π , ππ0), we have:
πππ(π0) =π πππ(π) ππ0 : ππππ(πππ(π0))π (πππ(π0), πππ(π)) β ππ0 : ππππ(πππ(π)) =π(π )
ππ : ππππ(πππ(π)) β‘ ππππ(π₯)
Now, we can go back to πππ(π0) = πππ(π) by an application of ππππππ, since:
ππππππ(ππ : ππππ(π₯)) β‘ πππ(π0) =πππππππ(π)
And we conclude this part, since in our approach πππ(π0) =π πππ(π) is constructed byapplications of axiom π.
Now, we start from decode. Let π : ππππ(π₯). If π₯ β‘ πππ(π), then π : π0 = π and thus,ππππππ(π) β‘ πππ(π0) =π(π) πππ(π). Now, we apply ππππππ. We have:
ππππππ(π₯, ππ) = π‘ππππ ππππ‘ππππ(ππ, ππ0)= π‘ππππ ππππ‘πβ(π0=π)(π, ππ0) (Lemma 11)= π(ππ0 , π) (Lemma 20)= π (Rule 6)
If π₯ β‘ πππ(π), we have that π : 0 and thus, as stated in (Univalent Foundations Program,2013), we can conclude anything we wish.
Chapter 5. Homotopy Type Theory 130
5.11 REFLEXIVITY
In this section, our objective is to conclude an important result related to the reflexivepath π:
Theorem 5.10. For any type A and a path π₯ =π π₯ : π΄, if a path π is obtained by a series(perhaps empty) of applications of axioms and rules of inference of ππ½π-equality theoryfor type theory to the path π, then there is a path π‘β² such that π =π‘β² π.
Proof. β’ Base Case:
We can start only with a path π₯ =π. In that case, it is easy, since we have π =π π.Now, we consider the inductive steps. Starting from a path π and applying π , π, we
already have rules yield the desired path:
β’ π = π(π β²), with π β² =π‘β² π.
In this case, we have π = π(π β²) = π(π) =π π π.
β’ π = π(π β², π β²β²), with π β² =π‘β² π and π β²β² =π‘β²β² π.
We have that π = π(π β², π β²β²) = π(π, π) =π‘ππ π
The cases for applications of π, π and π remain to be proved. We introduce threenew rules that handle these cases.
β’ π = π(π β²), with π β² =π‘β² π.
We introduce rule 45:
π₯ =ππ₯ π₯ : π΄ [π : π΄ β π΅]Bππ₯π π(π₯) =ππ(π₯) π(π₯) : π΅(π₯)
π(π₯) =π(ππ₯) π(π₯) : π΅(π₯)
This rule is also valid for the dependent case:
π₯ =ππ₯ π₯ : π΄ [π : Ξ (π₯:π΄)π΅(π₯)]Bππ₯π π(π₯) =ππ(π₯) π(π₯) : π΅(π₯)
π(π₯, π₯) β π(π₯) =π(ππ₯) π(π₯) : π΅(π₯)
Thus, we have π = π(π β²) = π(π) =ππ₯π π.
β’ π = π(π β²), with π β² =π‘β² π.
We introduce rule 46:
π =π π : Ξ (π₯:π΄)π΅(π₯)Bππ₯π π(π₯) =ππ(π₯) π(π₯)
π(π₯) =π(ππ₯) π(π₯) : π΅(π₯)
Chapter 5. Homotopy Type Theory 131
Thus, π = π(π β²) = π(π) =ππ₯π π.
β’ π = π(π β²), with π β² =π‘β² π.
We introduce rule 47:
π(π₯) =π π(π₯) : π΅ π₯ : π΄Bπ₯π₯π ππ₯.π(π₯) =π ππ₯.π(π₯)
ππ₯.π(π₯) =π(π) ππ₯.π(π₯) : π΄ β π΅
Thus, π = π(π β²) = π(π) =π₯π₯π π.
If we consider function extensionality, this theorem still holds:
β’ π = ππ₯π‘(π β²), with π β² =π‘β² π.
We introduce a new rule to handle this case. Since it is related only to extensionality(i.e., when one admits the inference rule ππ₯π‘ to the system), we do not add this tothe basic rules of our system.
ππ₯.(π(π₯) =π π(π₯)) : Ξ (π₯:π΄)π΅(π₯)Bππ₯π π =π π
π =ππ₯π‘(π) π
Thus, π = ππ₯π‘(π β²) = ππ₯π‘(π) =ππ₯π π.
5.12 NATURAL NUMBERS
The Natural Numbers is a type defined inductively by an element 0 : N and a functionπ π’ππ : N β N. In our approach, the path space of the naturals is also characterizedinductively. We start from the reflexive path 0 =π 0. All subsequent paths are constructedby applications of the inference rules of ππ½π-equality. We show that this characterizationis similar to the one constructed in (Univalent Foundations Program, 2013). To do this, we useππππ, ππππππ and ππππππ. For N, we define ππππ recursively (Univalent Foundations Program,2013):
ππππ(0, 0) β‘ 1ππππ(π π’ππ(π), 0) β‘ 0ππππ(0, π π’ππ(π)) β‘ 0
ππππ(π π’ππ(π), π π’ππ(π)) β‘ ππππ(π,π)
We also define a dependent function π : Ξ (π:N)ππππ(π,π), with:
Chapter 5. Homotopy Type Theory 132
π(0) β‘ *π(π π’ππ(π)) β‘ π(π)
Theorem 5.11. For any π,π : N, if there is a path π =π‘ π : N, then π‘B π.
Proof. Since all paths are constructed from the reflexive path 0 =π 0, this is a directapplication of theorem 5.10.
Theorem 5.12. For any π,π : N, we have (π = π) β ππππ(π,π)
Proof. We need to define ππππππ and ππππππ and prove that they are quasi-inverses. Wedefine ππππππ : Ξ (π,π:N)(π = π) β ππππ(π,π) as:
ππππππ(π,π, π) β‘ π‘ππππ ππππ‘ππππ(π,β)(π, π(π))
We define ππππππ : Ξ (π,π:N)ππππ(π,π) β (π = π) recursively:
ππππππ(0, 0, π) β‘ 0 =π 0ππππππ(π π’ππ(π), 0, π) β‘ 0ππππππ(0, π π’ππ(π), π) β‘ 0)
ππππππ(π π’ππ(π), π π’ππ(π), π) β‘ ππ π’ππ(ππππππ(π,π, π))
We now prove that if π =π π, then ππππππ(ππππ(π,π)) = π. We prove by induction.The base is trivial, since ππππππ(0, 0, π) β‘ π. Now, consider ππππππ(π π’ππ(π), π π’ππ(π), π).We have that ππππππ(π π’ππ(π), π π’ππ(π), π) β‘ ππ π’ππ(ππππππ(π,π, π)). By the inductive hy-pothesis, ππππππ(π,π, π) β‘ π. Thus, we need to prove that ππ π’ππ = π. This last step is astraightforward application of rule 47. Therefore, ππ π’ππ =ππ₯π π. With this information,we can start the proof of the equivalence.
For any π =π π, we have:
ππππππ(π,π, π) β‘ π‘ππππ ππππ‘ππππ(π,β)(π, π(π))
Thus:
π =π π π(π) : ππππ(π,π) =π(π) (π(π) : ππππ(π,π))π(π,π) β π(π) : ππππ(π,π)
Now, we know that ππππππ(π(π) : ππππ(π,π)) = π and,by theorem 5.11, π = π.The proof starting from a π : ππππ(π,π) is equal to the one presented in (Univalent
Foundations Program, 2013). We prove by induction. If π and π are 0, we have the trivialpath 0 =π 0, thus ππππππ(0, 0, π) = π0, whereas ππππππ(0, 0, π0) β‘ π(0) β‘ *. We con-clude this part recalling that every π₯ : 1 is equal to *, since we have π₯ =π(π) * : 1. Inthe case of ππππππ(π π’ππ(π), 0, π) or ππππππ(0, π π’ππ(π), π), π : 0. The only case left is forππππππ(π π’ππ(π), π π’ππ(π), π). Similar to (Univalent Foundations Program, 2013), we prove byinduction:
Chapter 5. Homotopy Type Theory 133
ππππππ(π π’ππ(π), π π’ππ(π), ππππππ(π π’ππ(π), π π’ππ(π), π))= ππππππ(π π’ππ(π), π π’ππ(π), ππ π’ππ(ππππππ(π,π, π))= π‘ππππ ππππ‘ππππ(π π’ππ(π),β)(ππ π’ππ(ππππππ(π,π, π)), π(π π’ππ(π))= π‘ππππ ππππ‘ππππ(π π’ππ(π),π π’ππ(β)(ππππππ(π,π, π), π(π π’ππ(π)))= π‘ππππ ππππ‘ππππ(π,β)(ππππππ(π,π, π), π(π))= ππππππ(π,π, ππππππ(π,π, π))= π
5.13 SETS AND AXIOM K
In this subsection, our objective is to prove, using our computational path approach,important results related to sets. First, We define the concept of set as done traditionallyin Homotopy Type Theory. Then, we show that the connection between the axiom K andsets is also valid in our approach. We use these results to show that the naturals numbersare a set. We also prove Hedbergβs theorem is valid in our theory, since only a few stepsof its proof differs from method developed in (Univalent Foundations Program, 2013).
We start with the definition of set (Univalent Foundations Program, 2013):
Definition 5.4. A type π΄ is a set if for all π₯, π¦ : π΄ and all π, π : π₯ = π¦, we have π = π.
In type theory, if a type is a set, we also say that it has the uniqueness of identityproof (UIP) property, since all proofs of the equality of two terms π₯ = π¦ are equal.
We now introduce the following axiom, known as axiom K(HOFMANN; STREICHER,1994):
For all π₯ : π and π : (π₯ =π π₯), we have π = πππππ₯.
Of course, this previous formulation is one familiar to classic type theory. In ourapproach, axiom K can be understood as the following formulation:
Axiom 5.2. For all π₯ : π and π₯ =π‘ π₯ : π, we have π‘ = ππ₯.
Our objective is to establish a connection between sets and axiom K. The followinglemma has proved to be useful:
Lemma 5.21. For every path π‘, there is a path π‘β1 such that π‘ β π‘β1 = π and π‘β1 β π‘ = π.Furthermore, π‘β1 is unique up to propositional identity.
Proof. We claim that π‘β1 = π(π‘). The identities are straightforward. First, we have thatπ‘ β π‘β1 β‘ π(π(π‘), π‘) =π‘π π π. We also have π‘β1 β π‘ β‘ π(π‘, π(π‘)) =π‘π π. Now, suppose wehave π such that π(π‘, π ) =π β² π. Thus, we have that π(π‘, π(π‘)) =π(π‘π,π(π β²)) π(π‘, π ) and thus,π(π‘) = π .
Theorem 5.13. A type π is a set iff it satisfies axiom K.
Chapter 5. Homotopy Type Theory 134
Proof. First, If π is a set, we want to show that it satisfies axiom K. Suppose we havea path π₯ =π‘ π₯. From the axioms of ππ½π-equality, we also have that π₯ =π π₯. Since π is apath, it is always the case that π‘ = π and thus, π satisfies axiom K.
Ifπ satisfies axiom K, we want to show thatπ is a set. To do this, we want to show thatgiven paths π, π : π₯ = π¦, then we have π = π. We show this in the following manner. From apath π₯ =π π¦, we apply π to obtain the inverse path π¦ =π(π)π₯ π₯. Then, we can concatenate πand π(π), obtaining a path π₯ =π(π,π(π)) π₯. By axiom K, we have π(π, π(π)) = π. Analogously,π(π(π), π) = π. Thus, by the previous lemma, π(π) = πβ1 = π(π) and thus, π = π. Thus,by an application of π, π = π.
Theorem 5.14. N is a set.
Proof. That N satisfies axiom K is a direct consequence of theorem 5.11. Thus, fromtheorem 5.13, we conclude that N is a set.
In classic homotopy type theory, one can achieve the previous result by following adifferent path. Firstly, one should be aware of the following concept (Univalent Foundations
Program, 2013):
Definition 5.5. A type π has decidable equality if for all π₯, π¦ : π, the following typeis inhabited:
(π₯ = π¦ : π) + Β¬(π₯ = π¦ : π)
Theorem 5.15. If π has decidable equality, then π is a set.
This theorem is known as Hedbergβs theorem . We will not show a full proof of it,since one can follow exactly the steps established in (Univalent Foundations Program, 2013).One should only be careful to notice that the path πππ of classic homotopy type theoryis just our application of axiom π on a dependent function π and that lemma 2.9.6 of(Univalent Foundations Program, 2013) has already been proved in this work, in the form oflemma 5.17.
We can also use Hedbergβs theorem to give an alternative proof of theorem 5.14, onesimilar to the one given in classic type theory:
Theorem 5.16. N has decidable equality and thus, is a set.
Proof. For any π₯, π¦ : N, we want to show that (π₯ = π¦) + Β¬(π₯ = π¦) is inhabited. Weproceed by induction in π₯. For the base case, we have π₯ = 0. If π¦ = 0, then we have0 =π 0. If π¦ = π π’ππ(π), we use the ππππππ type for N. We have that ππππππ(0, π π’ππ(π)) :(0 = π π’ππ(π)) β 0 and thus, ππππππ(0, π π’ππ(π)) : Β¬(0 = π π’ππ(π)).
For the inductive step, we consider π₯ = π π’ππ(π). If π¦ = 0, then we can use ππππππ againto obtain Β¬(π π’ππ(π) = 0). If π¦ = π π’ππ(π), by the inductive hypothesis, we have two more
Chapter 5. Homotopy Type Theory 135
cases to consider. If π = π, then we apply axiom π, and thus π π’ππ(π) =ππ π’ππ π π’ππ(π).If Β¬(π = π), then we just need to show that π π’ππ is injective to obtain Β¬(π π’ππ(π) =π π’ππ(π)). But that π π’ππ is injective is a direct consequence of applying encode and thendecode to π π’ππ(π) = π π’ππ(π), since from that we conclude π = π. Therefore, fromΒ¬(π π’ππ(π) = π π’ππ(π)) we conclude Β¬(π = π).
5.14 FUNDAMENTAL GROUP OF A CIRCLE
The objective of this section is to show that it is possible to use computational paths toobtain one of the main results of homotopy theory, the fact that the fundamental groupof a circle is isomorphic to the integers group. First, we define a circle as follows:
Definition 5.6 (The circle π1). A circle is the type generated by:
β’ A point πππ π : π1
β’ A computational path πππ π =ππππ πππ π : π1.
The first thing one should notice is that this definition doest not use only the pointsof the type π1, but also a computational path ππππ between those points. That is way itis called a higher inductive type (Univalent Foundations Program, 2013). Our approach differsfrom the classic one on the fact that we do not need to simulate the path-space betweenthose points, since computational paths exist in the syntax of the theory. Thus, if onestarts with a path πππ π =ππππ πππ π : π1., one can naturally obtain additional paths applyingthe path-axioms π, π and π. Thus, one has a path π(ππππ) = ππππβ1, π(ππππ, ππππ), etc. Inclassic type theory, the existence of those additional paths comes from establishing thatthe paths should be freely generated by the constructors (Univalent Foundations Program,2013). In our approach, we do not have to appeal for this kind of argument, since allpaths comes naturally from direct applications of the axioms.
With that in mind, one can define the fundamental group of a circle. In homotopy the-ory, the fundamental group is the one formed by all equivalence classes up to homotopy ofpaths (loops) starting from a point π and also ending at π. Since the we use computationalpaths as the syntax counterpart in type theory of homotopic paths, we use it to proposethe following definition:
Definition 5.7 (Ξ 1(π΄, π) structure). Ξ 1(π΄, π) is a structure defined as follows:
Ξ 1(π΄, π) = {[πππ‘β]ππ€ | π =πππ‘β π : π΄}
We use this structure to define the fundamental group of a circle. We also need toshow that it is indeed a group.
Proposition 5.1. (Ξ 1(π, π), β) is a group.
Chapter 5. Homotopy Type Theory 136
Proof. The first thing to define is the group operation β. Given any π =π π : π1 andπ =π‘ π : π1, we define π β π as π(π , π). Thus, we now need to check the group conditions:
β’ Closure: Given π =π π : π1 and π =π‘ π : π1, π β π must be a member of the group.Indeed, π β π = π(π , π) is a computational path π =π(π ,π) π : π1.
β’ Inverse: Every member of the group must have an inverse. Indeed, if we have a pathπ, we can apply π(π). We claim that π(π) is the inverse of π, since we have:
π(π) β π = π(π, π(π)) =π‘π π
π β π(π) = π(π(π), π) =π‘π π π
Since we are working up to ππ€-equality, the equalities hold strictly.
β’ Identity: We use the path π =π π : π1 as the identity. Indeed, we have:
π β π = π(π, π) =π‘ππ π
π β π = π(π, π) =π‘ππ π.
β’ Associativity: Given any members of the group π =π π : π1, π =π‘ π and π =π π, wewant that π β (π β π‘) = (π β π ) β π‘:
π β (π β π‘) = π(π(π‘, π ), π) =π‘π‘ π(π‘, π(π , π)) = (π β π ) β π‘
All conditions have been satisfied. (Ξ 1(π, π), β) is a group.
Thus, (Ξ 1(π, π), β) is indeed a group. We call this group the fundamental group of π1.Therefore, the objective of this section is to show that Ξ 1(π, π) βΌ= Z.
Before we start developing this proof, the following lemma will prove to be useful:
Lemma 5.22. All paths generated by a path π =ππππ π : π are ππ€-equal to a path πππππ,for a π β Z.
We have said that from a ππππ, one freely generate different paths applying the com-position π and the symmetry. Thus, one can, for example, obtain something such asππππ β ππππ β ππππβ1 β ππππ.... Our objective with this lemma is to show that, in fact, thispath can be reduced to a path of the form πππππ, for π β Z.
Proof. The idea is to proceed by induction on the number π of loops, i.e., πππππ. We startfrom a base π. For the base case, it is trivially true, since we define it to be equal to ππππ0.From π, one can construct more complex paths by composing with ππππ or π(ππππ) oneach step. We have the following induction steps:
Chapter 5. Homotopy Type Theory 137
β’ A path of the form π concatenated with ππππ: We have π β ππππ = π(ππππ, π) =π‘ππ
ππππ = ππππ1;
β’ A path of the form π concatenated with π(ππππ): We have πβπ(ππππ) = π(π(ππππ), π) =π‘ππ=π(ππππ) = ππππβ1
β’ A path of the form πππππ concatenated with ππππ: We have πππππ β ππππ = πππππ+1.
β’ A path of the form πππππ concatenated with π(ππππ): We have πππππ β π(ππππ) =(πππππβ1βππππ)βπ(ππππ) =π‘π‘ ππππ
πβ1β(ππππβπ(ππππ)) = πππππβ1β(π(π(ππππ), ππππ)) =π‘π π=πππππβ1 β π = π(π, πππππβ1) =π‘ππ ππππ
πβ1
β’ A path of the form ππππβπ concatenated with ππππ: We have ππππβπ = ππππβ(πβ1) βππππβ1 = ππππβ(πβ1)βπ(ππππ). Thus, we have (ππππβ(πβ1)βπ(ππππ))βππππ=π‘π‘ ππππ
β(πβ1)β(π(ππππ)βππππ) = ππππβ(πβ1)βπ(ππππ, π(ππππ)) =π‘π = ππππβ(πβ1)βπ = π(π, ππππβ(πβ1)) =π‘ππ
ππππβ(πβ1).
β’ a path of the form ππππβπ concatenated with π(ππππ): We have ππππβπ β ππππβ1 =ππππβ(π+1)
Thus, every path is of the form πππππ, with π β Z.
This lemma shows that every path of the fundamental group can be represented by apath of the form πππππ, with π β Z.
Theorem 5.17. Ξ 1(π, π) βΌ= Z
To prove this theorem, one could use the approach proposed in (Univalent Foundations
Program, 2013), defining an encode and decode functions. Nevertheless, since our compu-tational paths are part of the syntax, one does not need to rely on this kind of approachto simulate a path-space, we can work directly with the concept of path.
Proof. The proof is done by establishing a function from Ξ 1(π, π) to Z and then aninverse from Z to Ξ 1(π, π). Since we have access to the previous lemma, this task is nottoo difficult. The main idea is that the π on πππππ means the amount of times one goesaround the circle, while the sign gives the direction (clockwise or anti-clockwise). In otherwords, it is the π€ππππππ number. Since we have shown that every path of the fundamentalgroup is of the form πππππ, with π β Z, then we just need to translate πππππ to an integerπ and an integer π to a path πππππ. We define two functions, π‘ππΌππ‘ππππ : Ξ 1(π, π) β Zand π‘ππππ‘β : Z β Ξ 1(π, π):
Chapter 5. Homotopy Type Theory 138
β’ π‘ππΌππ‘ππππ: To define this function, we use the help of two functions defined in Z:the successor function π π’ππ and the predecessor function ππππ. We define π‘ππΌππ‘ππππas follows. Of course, we use directly the fact that every loop of π is of the formπππππ with π β Z:
π‘ππΌππ‘ππππ :
β§βͺβͺβͺβͺβ¨βͺβͺβͺβͺβ©π‘ππΌππ‘ππππ([πππππ]ππ€ β‘ [π]ππ€) = 0 π = 0
π‘ππΌππ‘ππππ([πππππ]ππ€) = π π’ππ(π‘ππΌππ‘ππππ([πππππβ1]ππ€)) π > 0
π‘ππΌππ‘ππππ([πππππ]ππ€) = ππππ(π‘ππΌππ‘ππππ([πππππ+1)]ππ€) π < 0
β’ π‘ππππ‘β: We just need to transform an integer π into a path πππππ:
π‘ππππ‘β :
β§βͺβͺβͺβͺβ¨βͺβͺβͺβͺβ©π‘ππππ‘β(π) = [π]ππ€ π = 0
π‘ππππ‘β(π) = π‘ππππ‘β(πβ 1) β [ππππ]ππ€ π > 0
π‘ππππ‘β(π) = π‘ππππ‘β(π+ 1) β [π(ππππ)]ππ€ π < 0
Now we just need to show that they are inverses. To do this, we have to check twoequations:
1. π‘ππππ‘β(π‘ππΌππ‘ππππ([π₯]ππ€)) = [π₯]ππ€
2. π‘ππΌππ‘ππππ(π‘ππππ‘β(π)) = π
From a path [π₯]ππ€, we apply lemma 5.22 to obtain [π₯]ππ€ = [πππππ]ππ€ for some integer n.Thus, we have π‘ππππ‘β(π‘ππΌππ‘ππππ([π₯]ππ€)) = π‘ππππ‘β(π‘ππΌππ‘ππππ([πππππ]ππ€)) = π‘ππππ‘β(π) =[πππππ]ππ€ = [π₯]ππ€. The opposite direction is straightforward: π‘ππΌππ‘ππππ(π‘ππππ‘β(π)) =π‘ππΌππ‘ππππ([πππππ]ππ€) = π. Thus, we conclude that they are inverses. Also, the map be-tween the operations of the groups is direct, since we can easily map β to +. This is due tothe fact that πππππ β πππππ = πππππ+π and thus, π‘ππΌππ‘ππππ[[πππππ+π]ππ€ = π+π. It is alsostraightforward that π‘ππππ‘β(π + π) = [πππππ+π]ππ€. Thus, we establish the isomorphismΞ 1(π, π) βΌ= Z.
5.15 RULES ADDED TO πΏππ·πΈπ β ππ π
In this chapter, we have introduced 7 new rules to the πΏππ·πΈπ β ππ π system. It is thefollowing list of rules:
40. π(π(π), π(π )) =π‘π π(π(π, π ))41. ππ(ππ (π)) =ππ ππβπ (π)42. ππΌππ΄
(π) =ππ π
43. π(π»π,π(π₯), ππ(π)) =βπ π(ππ (π), π»π,π(π¦))44. ππ (πβ§(π, π)) =ππ₯π πβ§(ππ(π), πβ(π))
Chapter 5. Homotopy Type Theory 139
45. ππ (ππ₯) =ππ₯π ππ(π₯)
46. π(ππ₯) =ππ₯π ππ(π₯)
47. π(π) =π₯π₯π π
Moreover, if one adds extensionality to the theory, one winds up with three additionalrules:
π(ππ₯π‘(π‘)) =ππ₯π‘π π‘
ππ (ππ₯) =ππ₯π ππ(π₯)
ππ₯π‘(π) =ππ₯π π.
Thus, we end this work with a total of 47 rewrites rules + 3 optional ones. Of course,to be formal we need to show that the system will terminate and is still confluent. Indeed,the confluence process can even yield new rules to solve some critical pair divergence. Weleave this verification out of the scope of this work, but given the importance of theseproofs, we plan to finish them in a future work.
5.16 CONCLUSION
In this chapter we have developed one of the main objectives of this work. We connectedour computational path approach to homotopy type theory. Using the algebra of compu-tational paths, we have established important results of Homotopy Type Theory. Thatway, we have shown that our approach yields the main building blocks of Homotopy TypeTheory, on par with the classic approach. We have also improved the rewrite system,adding new reduction rules. Indeed, we have ended this chapter with one of the mostclassic results of algebraic topology, the fact that the fundamental group of the circle isisomorphic to the group of the integers.
In view of all results achieved in this chapter, we have developed a valid alternativeapproach to the identity type and homotopy type theory, based on this algebra of paths.We also believe that we have opened the way, in future works, for possible expansionsof this results, formulating and proving even more intricate concepts and theorems ofhomotopy type theory using computational paths. In fact, based on the concepts developedin this chapter, we have constructed the fundamental group of many structures, includingthe MΓΆbius band, the cylinder, torus and the projective plane. These results appear in astill unpublished work "On the Calculation of Fundamental Groups in Homotopy TypeTheory by Means of Computational Paths". A preprint version is available in (VERAS et
al., 2018).
140
6 CONCLUSION
Motivated by seeing the equality between two computational objects as a sequence ofrewrites between then, we have proposed in this work a entity known as computationalpaths. We have also accomplished 3 main objectives. The first one was the proposalof computational paths as an new entity of type theory. In this proposal, we pointedout the fact that computational paths should be seen as the syntax counterpart of thehomotopical paths between terms of a type. We have also proposed a formalization ofthe identity type using computational paths. The second objective was the proposal of amathematical structure for a type using computational paths. We have shown that usingcategorical semantics it was possible to induce a groupoid structure for a type and alsoa higher groupoid structure, using computational paths and a rewrite system. We haveused this groupoid structure to show that computational paths also refutes the uniquenessof identity proofs. The last objective was to formulate and prove the main concepts andbuilding blocks of homotopy type theory. We ended this last objective with a proof of theisomorphism between the fundamental group of the circle and the group of the integers.
The introduction of this work was focused on giving a brief introduction to the foun-dations of mathematics and a brief explanation why axiomatic set theory, ππΉπΆ, is notsuitable of working as a foundation of computation. Thus, we have said that homotopytype theory is a suitable alternative, since it can be used as a foundation of mathematicsand computation at the same time. We have also pointed out that the identity type is themain concept of homotopy type theory, since it is responsible for the homotopical inter-pretation of a type. Nevertheless, we said that this interpretation is limited to a semanticalinterpretation, since there is no entity in the syntax of type theory that represents thosepaths. Thus, we said that the focus of this work is to add such entity to type theory,which is known as computational path.
The second chapter has been focused on introducing the basic concepts of type theory.In this chapter we have introduced the constructions of the main types, showing the for-mation, introduction, elimination and computation rules. We have also shown the currentapproach for the identity type using the constructor π½ . We have also shown the use ofthose rules in practice, showing how one can use π½ to construct basic types of type theory,such as the symmetry and transitivity properties of the identity type.
The third chapter focused on introducing the basic concepts of category theory. Wehave said that one of the objectives achieved here was the proposal of a mathematicalstructure for computational paths. To achieve that, we have used the framework of cate-gory theory. Thus, the needed concepts of this theory has been introduced in chapter 3.We have also shown some concepts of higher category theory, since we use then in chapter4 to construct a higher groupoid.
Chapter 6. Conclusion 141
The fourth chapter has been focused on introducing a new entity known as com-putational paths to the syntax of type theory. To achieve that, we have used conceptsdeveloped in chapter 2 and some basic concepts of π-calculus. After introducing the con-cept of computational paths, we have shown how one can formally define the identitytype using this entity. To do that, we show the formation, introduction, elimination andcomputation rules for the identity type. To make our approach clearer, we have used thisnewly introduced rules to construct three basic types of equality, the reflexivity, symmetryand transitivity. We also showed that the process of obtaining those constructions waseasier than using π½ . After that, we have shown the existence of a rewrite system that es-tablishes equalities between two computational paths. We have also said that this systemdoes that by mapping all possible redundancies that can appear in a computational path.We also pointed out that this system is confluent and terminates. Thus, we have said thatit is possible to think of a strong normal form for a computational path. In the sequel,we have used the concepts of chapter 3 to construct a groupoid model for those compu-tational paths. We also have gone one step further, showing that it is possible to thinkof a higher groupoid structure. Moreover, we have put this groupoid structure togetherwith the existence of a strong normal form to show that this approach also refutes theuniqueness of identity proofs.
The fifth chapter has been focused on accomplishing the third objective of this work.In this chapter we have developed the main building blocks of homotopy theory usingcomputational paths. Instead of using path-induction in our proofs, we have used our al-gebra of paths based on our rewrite system. Proceeding that way, we have shown dozensof lemmas and theorems of homotopy type theory. Thus, we have shown that computa-tional paths are capable of developing this theory. We finished this chapter showing oneof the most classic proofs of algebraic topology: the fundamental group of the circle isisomorphic to the group of integers.
6.1 FUTURE WORK
Since we have successfully accomplished our main objectives, we hope that we have madea strong case for the power of computational paths in homotopy type theory. This ap-proach seems promising, since it has been possible to prove many lemmas and theorems ofhomotopy type theory. Also, another promising aspect is that our mathematical structuremirrors the one obtained using the traditional identity type.
Thus, with those results in mind, it is possible to obtain further results in two fronts:we can focus on the mathematical interpretation of computational paths. In this work, wehave limited our scope to bicategories, but it is possible, in the future, to go even further,adding more dimensions, eventually obtaining an important result: computational pathsshould be able of inducing a weak β-groupoid. We expect this fact, since this has beenrecently achieved using the traditional approach of the identity type (LUMSDAINE, 2009;
Chapter 6. Conclusion 142
BERG; GARNER, 2011). The other direction is to continue to develop the main conceptsand theorems of homotopy theory. We have shown dozens in chapter 5, but there aremany more results. Thus, we could focus on this and use our algebra of computationalpaths to obtain further results. In fact, based on the concepts developed in chapter 5, wehave constructed the fundamental group of many structures, including the MΓΆbius band,the cylinder, torus and the projective plane. These results appear in a still unpublishedwork "On the Calculation of Fundamental Groups in Homotopy Type Theory by Meansof Computational Paths". A preprint version is available in (VERAS et al., 2018).
143
REFERENCES
ALAMA, J. The lambda calculus. In: ZALTA, E. N. (Ed.). The Stanford Encyclopediaof Philosophy. Spring 2015. [S.l.: s.n.], 2015.
AVIGAD, J. Philosophy of mathematics. In: BOUNDAS, C. (Ed.). The EdinburghCompanion to Twentieth-Century Philosophies. [S.l.]: Edinburgh University Press, 2007.p. 234β251.
AWODEY, S. Category theory. 2nd. ed. [S.l.]: Oxford University Press, 2010.
AWODEY, S. Category Theory Foundations. 2012. Category Theory Foundations,Lecture at Oregon Programming Languages Summer School, Eugene, Oregon.
BARKER-PLUMMER, D. Turing machines. In: ZALTA, E. N. (Ed.). The StanfordEncyclopedia of Philosophy. Summer 2013. [S.l.: s.n.], 2013.
BERG, B. van den; GARNER, R. Types are weak π-groupoids. Proceedings of theLondon Mathematical Society, Oxford University Press, v. 102, n. 2, p. 370β394, 2011.
BRIDGES, D.; PALMGREN, E. Constructive mathematics. In: ZALTA, E. N. (Ed.).The Stanford Encyclopedia of Philosophy. Winter 2013. [S.l.: s.n.], 2013.
CHENADEC, P. L. On the logic of unification. Journal of Symbolic computation,Elsevier, v. 8, n. 1, p. 141β199, 1989.
DERSHOWITZ, N. Orderings for term-rewriting systems. Theoretical computer science,Elsevier, v. 17, n. 3, p. 279β301, 1982.
DUMMETT, M. Elements of Intuitionism. [S.l.]: Oxford, 1977. (Oxford Logic Guides,v. 39). ISBN 978-0198505242.
HARPER, R. Type Theory Foundations. 2012. Type Theory Foundations, Lecture atOregon Programming Languages Summer School, Eugene, Oregon.
HINDLEY, J. R.; SELDIN, J. P. Lambda-calculus and combinators: an introduction.[S.l.]: Cambridge University Press, 2008.
HOFMANN, M.; STREICHER, T. The groupoid model refutes uniqueness of identityproofs. In: Logic in Computer Science, 1994. LICSβ94. Proceedings., Symposium on.[S.l.]: IEEE, 1994. p. 208β212.
HOFMANN, M.; STREICHER, T. The groupoid interpretation of type theory. In:Twenty-five years of constructive type theory (Venice, 1995). New York: Oxford Univ.Press, 1998, (Oxford Logic Guides, v. 36). p. 83β111.
HORSTEN, L. Philosophy of mathematics. In: ZALTA, E. N. (Ed.). The StanfordEncyclopedia of Philosophy. Spring 2015. [S.l.: s.n.], 2015.
HOWARD, W. A. The formulas-as-types notion of construction. In: SELDIN, J. P.;HINDLEY, J. R. (Ed.). To H. B. Curry: Essays on Combinatory Logic, LambdaCalculus, and Formalism. [S.l.]: Academic Press, 1980. p. 479β490. Reprint of 1969article.
References 144
HRBACEK, K.; JECH, T. Introduction to Set Theory, Revised and Expanded. [S.l.]:Chapman & Hall/CRC, 1999. (Pure and Applied Mathematics, v. 220).
IRVINE, A. D. Bertrand russell. In: ZALTA, E. N. (Ed.). The Stanford Encyclopedia ofPhilosophy. Winter 2014. [S.l.: s.n.], 2014.
KNUTH, D. E.; BENDIX, P. B. Simple word problems in universal algebras. In:Computational problems in abstract algebra. [S.l.: s.n.], 1970. p. 263β297.
LEINSTER, T. Basic bicategories. arXiv preprint math.CT/9810017, Citeseer, 1998.
LEINSTER, T. Higher Operads, Higher Categories. [S.l.]: Cambridge UniversityPress, 2004. (London Mathematical Society Lecture Note Series (Book 298)). Alsohttp://arxiv.org/abs/math/0305049, May, 2003. ISBN 0-521-53215-9.
LUMSDAINE, P. L. Weak π-categories from intensional type theory. In: Typed lambdacalculi and applications. [S.l.]: Springer, 2009. (LNCS, v. 5608), p. 172β187.
MARQUIS, J.-P. Category theory. In: ZALTA, E. N. (Ed.). The Stanford Encyclopediaof Philosophy. Winter 2014. [S.l.: s.n.], 2014.
MARTIN-LΓF, P. An intuitionistic theory of types: Predicative part. In: ROSE, H.;SHEPHERDSON, J. (Ed.). Logic Colloquium β73 Proceedings of the Logic Colloquium.Elsevier, 1975, (Studies in Logic and the Foundations of Mathematics, v. 80). p. 73 β 118.Available at: <http://www.sciencedirect.com/science/article/pii/S0049237X08719451>.
MARTIN-LΓF, P. Constructive mathematics and computer programming. In: COHEN,L.; LOS, J.; PFEIFFER, H.; PODEWSKI, K.-P. (Ed.). Logic, Methodology andPhilosophy of Science VI, Hannover, 1979. [S.l.]: North-Holland, 1982, (Studies in Logicand the Foundations of Mathematics, v. 104). p. 153β175.
MARTIN-LΓF, P. Intuitionistic Type Theory. Notes by Giovanni Sambin of a series oflectures given in Padua, June 1980. [S.l.]: Bibliopolis, Napoli, 1984. xii+92pp p.
MARTIN-LΓF, P. An intuitionistic theory of types. In: SAMBIN, G.; SMITH, J. (Ed.).Twenty-five years of constructive type theory. [S.l.]: Oxford University Press, 1998,(Oxford Logic Guides, v. 36). p. 127β172. ISBN 978-0198501275.
NLAB. product. 2014. Http://ncatlab.org/nlab/show/product (VersΓ£o 19). Last Reviewby Urs Schreiber in July 19, 2014. Access in March 24, 2015.
NLAB. monoids. 2017. Https://ncatlab.org/nlab/history/monoid (VersΓ£o 34). Lastreview by Urs Schreiber in May 26, 2017. Access in June 19, 2017.
OLIVEIRA, A. G. de. Proof transformations for labelled natural deduction via termrewriting. 1995. Masterβs thesis, Depto. de InformΓ‘tica, Universidade Federal dePernambuco, Recife, Brazil, April 1995.
OLIVEIRA, A. G. de; QUEIROZ, R. J. G. B. de. Term rewriting with labelled deductivesystems. In: Proceedings of Brazilian Symposium on Artificial Intelligence (SBIAβ94).[S.l.: s.n.], 1994. p. 59β72.
OLIVEIRA, A. G. de; QUEIROZ, R. J. G. B. de. A normalization procedure for theequational fragment of labelled natural deduction. Logic Journal of IGPL, Oxford UnivPress, v. 3, n. (2β3), p. 243β290, 1999.
References 145
QUEIROZ, R. J. G. B. de; GABBAY, D. The functional interpretation of the existentialquantifier. Bulletin of the IGPL, Oxford Univ Press, v. 7, n. 2, p. 173β215, 1995. (SpecialIssue on Deduction and Language, Guest Editor: Ruth Kempson). Full version of a paperpresented at Logic Colloquium β91, Uppsala. Abstract in JSL 58(2):753β754, 1993.
QUEIROZ, R. J. G. B. de; GABBAY, D. M. Equality in labelled deductive systems andthe functional interpretation of propositional equality. In: DEKKER, P.; STOCKHOF,M. (Ed.). Proceedings of the 9th Amsterdam Colloquium. [S.l.], 1994. p. 547β565.
QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de. Natural deduction for equality: Themissing entity. In: PEREIRA, L.; HAEUSLER, E.; PAIVA, V. de (Ed.). Advances inNatural Deduction. [S.l.]: Springer, 2014. p. 63β91.
QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de. Propositional Equality, IdentityTypes and Reversible Rewriting Sequences as Homotopies. 2014. Propositional Equality,Identity Types and Reversible Rewriting Sequences as Homotopies, Talk at LogicWorkshop, Universidade Federal do CearΓ‘, Fortaleza, CE, Brazil.
QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de; GABBAY, D. M. The FunctionalInterpretation of Logical Deduction. [S.l.]: World Scientific, 2011.
QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de; RAMOS, A. F. Propositional equality,identity types, and direct computational paths. South American Journal of Logic, v. 2,n. 2, p. 245β296, 2016. Special Issue: A Festschrift for Francisco Miraglia.
RAMOS, A. F. Identity Type as the Type of Computational Paths. 2015. Masterβs thesis,Depto. de InformΓ‘tica, Universidade Federal de Pernambuco, Recife, Brazil, July, 2015.
RAMOS, A. F. Computational paths, transport and the univalence axiom. 2017. Talk atXVIII Brazilian Logic Conference, PirenΓ³polis, GoiΓ‘s, May 2017.
RAMOS, A. F.; QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de. On the identity typeas the type of computational paths. Logic Journal of IGPL, Oxford Univ Press, v. 3, n.(2β3), p. 243β290, 2017.
RAMOS, A. F.; QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G. de. Explicit ComputationalPaths. 2018. Https://arxiv.org/abs/1609.05079.
Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations ofMathematics. Institute for Advanced Study: <http://homotopytypetheory.org/book>,2013.
VERAS, T. M. L. de; RAMOS, A. F.; QUEIROZ, R. J. G. B. de; OLIVEIRA, A. G.de. On the Calculation of Fundamental Groups in Homotopy Type Theory by Means ofComputational Paths. 2018. Https://arxiv.org/abs/1804.01413.
VOEVODSKY, V. Univalent Foundations and Set Theory. 2014. Univalent Foundationsand Set Theory, Lecture at IAS, Princeton, New Jersey, Mar 2014.