arthurfreitasramos - ufpe

146
Arthur Freitas Ramos Explicit Computational Paths in Type Theory Universidade Federal de Pernambuco [email protected] http://cin.ufpe.br/~posgraduacao Recife 2018

Upload: others

Post on 16-Oct-2021

3 views

Category:

Documents


0 download

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.