1 Introduction
There seems to be little doubt that the identity type is one of the most intriguing concepts of MartinLöf’s Type Theory. This claim is supported by recent groundbreaking discoveries. In 2005, Vladimir Voevodsky [14] discovered the Univalent Models, resulting in a new area of research known as homotopy type theory [1]. This theory is based on the fact that a term of some identity type, for example , has a clear homotopical interpretation. The interpretation is that the witness can be seen as a homotopical path between the points and within a topological space . This simple interpretation has made clear the connection between type theory and homotopy theory, generating groundbreaking results, as one can see in [13, 1]. Nevertheless, it is important to emphasize that the homotopic paths exist only in the semantic sense. In other words, there is no formal entity in type theory that represents these paths. They are not present in the syntax of type theory.
In this work, we are interested in an entity known as computational path, originally proposed by [8]. A computational path is an entity that establishes the equality between two terms of the same type. It differs from the homotopical path, since it is not only a semantic interpretation. It is a formal entity of the equality theory. In fact, we proposed in [7] that it should be considered as the type of the identity type. Moreover, we have further developed this idea in [12], where we proposed a groupoid model and proved that computational paths also refute the uniqueness of identity proofs. Thus, we obtained a result that is on par with the same one obtained by Hofmann & Streicher (1995) for the original identity type [10].
Our main idea in this work is to develop further our previous results. Specifically, we want to focus on the idea of path spaces. Since paths are not present in the syntax of traditional homotopy type theory, simulating the path of space of a complex entity could be a cumbersome task. The main approach is to use a technique known as codeencodedecode to try to simulate the path space [13], making proofs somewhat difficult to read and understand. Since our theory adds the concept of path directly to type theory, working with path spaces is a simpler and more direct task. To support this claim, we will work with two examples. First, we will define the path space of the naturals, also showing that it is equivalent to the one obtained using the codeencodedecode technique. Secondly, we will provide a simple proof of that the fundamental group of the circle is isomorphic to the integers. Since the same proof using codeencodedecode is rather complex [13], we hope to assert the advantage in simplicity of our approach.
2 Computational Paths
In this section, our objective is to give a brief introduction to the theory of computational paths. One should refer to [7, 12] for a detailed development of this theory.
A computational path is based on the idea that it is possible to formally define when two computational objects are equal. These two objects are equal if one can reach from applying a sequence of axioms or rules. This sequence of operations forms a path. Since it is between two computational objects, it is said that this path is a computational one. Also, an application of an axiom or a rule transforms (or rewrite) an term into another. For that reason, a computational path is also known as a sequence of rewrites. Nevertheless, before we define formally a computational path, we can take a look at one famous equality theory, the [9]:
Definition 1
The equality is composed by the following axioms:

if ;

;

;

.
And the following rules of inference:
Definition 2
(equality [9]) is equal or convertible to (notation ) iff is obtained from by a finite (perhaps empty) series of contractions and reversed contractions and changes of bound variables. That is, iff there exist () such that , ,
The same happens with equality:
Definition 3
(equality [9]) The equalityrelation determined by the theory is called ; that is, we define
Example 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 via 1step contraction or contraction of a previous term in the sequence. To take this sequence into a path, one has to apply transitivity twice, as we we see below. 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:
.
The aforementioned theory establishes the equality between two terms. Since we are 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. For the type, for example, we obtain:
Definition 4
The equality theory of Martin Löf’s type theory has the following basic proof rules for the type [7, 12]:
)
We are finally able to formally define computational paths:
Definition 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 of the equality theory of type theory or is a change of bound variables). We denote that by .
As we have seen in example 1, composition of rewrites are applications of the rule . Since change of bound variables is possible, each term is considered up to equivalence.
3 A Term Rewriting System for Paths
As we have just shown, a computational path establishes when two terms of the same type are equal. From the theory of computational paths, an interesting case arises. Suppose we have a path that establishes that and a path that establishes that . Consider that and are formed by distinct compositions of rewrites. Is it possible to conclude that there are cases that and should be considered equivalent? The answer is yes. Consider the following example:
Example 2
Consider the path . By the symmetric property, we obtain . What if we apply the property again on the path ? We would obtain a path . Since we applied symmetry twice in succession, we obtained a path that is equivalent to the initial path . For that reason, we conclude the act of applying symmetry twice in succession is a redundancy. We say that the path can be reduced to the path .
As one could see in the aforementioned example, different paths should be considered equal if one is just a redundant form of the other. The example that we have just seen is just a straightforward and simple case. Since the equality theory has a total of 7 axioms, the possibility of combinations that could generate redundancies are high. Fortunately, most possible redundancies were thoroughly mapped by [2]. In that work, a system that establishes redundancies and creates rules that solve them was proposed. This system, known as , originally mapped a total of 39 rules. For each rule, there is a proof tree that constructs it. In this work, we have discovered entirely new rules and added to the system, making a total of rules. We included all rules in appendix B, highlighting the recently discovered ones. To illustrate those rules, take the case of example 2. We have the following [7]:
It is important to notice that we assign a label to every rule. In the previous case, we assigned the label .
Definition 6
(rule [12]) An rule is any of the rules defined in .
Definition 7
(contraction [12]) Let and be computational paths. We say that (read as: contracts to ) iff we can obtain from by an application of only one rule. If can be reduced to by finite number of contractions, then we say that (read as reduces to ).
Definition 8
(equality [12]) 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 , with , such that
or
,
Proposition 1
equality is transitive, symmetric and reflexive.
Proof
Comes directly from the fact that equality is the transitive, reflexive and symmetric closure of .
The above proposition is rather important, since sometimes we want to work with paths up to equality. For example, we can take a path and use it as a representative of an equivalence class, denoting this by .
4 Natural Numbers
Before proceeding to the actual content of this section, one should be familiar to the concept of transport. To see how it is defined in homotopy type theory, one could refer to [13]. Our formulation of transport is based on computational paths and thus, it is different from the traditional one. Since it is used in the proof of theorem 3, we included the details in appendix C.
Our objective in this section is to use computational paths to define the pathspace of the naturals. The Natural Numbers is a type defined inductively by an element and a function . Instead of having to use the rigid syntax of type theory to simulate the path space, in our approach the path space of the naturals is characterized inductively. The basis is the reflexive path . All subsequent paths are constructed by applications of the inference rules of equality. In fact, we can now show that this characterization is similar to the one constructed in [13]. To do this, we use codeencodedecode. For , we define recursively [13]:
We also define a dependent function , with:
Before we show results directly related to , we need the following result:
Theorem 4.1
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 theory for type theory to the path , then there is a path such that .
Proof
In appendix D.
Theorem 4.2
For any , if there is a path , then .
Proof
Since all paths are constructed from the reflexive path , this is a direct application of theorem 1.
Theorem 4.3
For any , we have
Proof
We need to define and and prove that they are pseudoinverses. We define as:
We define recursively:
We now prove that if , then . We prove by induction. The base is trivial, since . Now, consider . We have that . By the inductive hypothesis, . Thus, we need to prove that . This last step is a straightforward application of rule 40 (check appendix B). Therefore, . With this information, we can start the proof of the equivalence.
For any , we have:
Thus (check appendix C):
Now, we know that and, by theorem 2, .
The proof starting from a is equal to the one presented in [13]. We prove by induction. If and are , we have the trivial path , thus , whereas . Now, we recall that the induction for the unit type is given by [13]. Thus, we conclude that every is equal to , since we have . In the case of or , we have . The only case left is for . Similar to [13], we prove by induction:
Therefore, we conclude that our simple inductive definition is equivalent to all the machinery of the codeencodedecode one.
5 Fundamental Group of a Circle
The objective of this section is to show that it is possible to use computational paths to obtain one of the main results of homotopy theory, the fact that the fundamental group of a circle is isomorphic to the integers group. We avoid again the use of the heavy and rather complicated machinery of the codeencodedecode approach. First, we define the circle as follows:
Definition 9 (The circle )
The circle is the type generated by:

A point 

A computational path  .
The first thing one should notice is that this definition doest not use only the points of the type , but also a computational path between those points. That is way it is called a higher inductive type [13]. Our approach differs from the classic one on the fact that we do not need to simulate the pathspace between those points, since computational paths exist in the syntax of the theory. Thus, if one starts with a path , one can naturally obtain additional paths applying the pathaxioms , and . Thus, one has a path , , etc. In classic type theory, the existence of those additional paths comes from establishing that the paths should be freely generated by the constructors [13]. In our approach, we do not have to appeal for this kind of argument, since all paths comes naturally from direct applications of the axioms.
With that in mind, one can define the fundamental group of a circle. In homotopy theory, the fundamental group is the one formed by all equivalence classes up to homotopy of paths (loops) starting from a point and also ending at . Since the we use computational paths as the syntax counterpart of homotopic paths in type theory, we use it to propose the following definition:
Definition 10 ( structure)
is a structure defined as follows:
We use this structure to define the fundamental group of a circle. We also need to show that it is indeed a group.
Proposition 2
is a group.
Proof
The first thing to define is the group operation . Given any and , we define as . Thus, we now need to check the group conditions:

Closure: Given and , must be a member of the group. Indeed, is a computational path .

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 as the identity. Indeed, we have:
.

Associativity: Given any members of the group , and , we want that :
All conditions have been satisfied. is a group.
Thus, is indeed a group. We call this group the fundamental group of . Therefore, the objective of this section is to show that .
Before we start developing this proof, the following lemma will prove to be useful:
Lemma 1
All paths generated by a path are equal to a path , for a .
We have said that from a , one freely generate different paths applying the composition and the symmetry. Thus, one can, for example, obtain something such as . Our objective with this lemma is to show that, in fact, this path can be reduced to a path of the form , for .
Proof
The idea is to proceed by induction. We start from a base . For the base case, it is trivially true, since we define it to be equal to . From , one can construct more complex paths by composing with or on each step. We have the following induction steps:

A path of the form concatenated with : We have ;

A path of the form concatenated with : We have

A path of the form concatenated with : We have .

A path of the form concatenated with : We have

A path of the form concatenated with : We have = . Thus, we have .

a path of the form concatenated with : We have
Thus, every path is of the form , with .
This lemma shows that every path of the fundamental group can be represented by a path of the form , with .
Theorem 5.1
To prove this theorem, one could use the approach proposed in [13], defining an encode and decode functions. Nevertheless, since our computational paths are part of the syntax, one does not need to rely on this kind of approach to simulate a pathspace, we can work directly with the concept of path.
Proof
The proof is done by establishing a function from to and then an inverse from to . Since we have access to the previous lemma, this task is not too difficult. The main idea is that the on means the amount of times one goes around the circle, while the sign gives the direction (clockwise or anticlockwise). In other words, it is the number. Since we have shown that every path of the fundamental group is of the form , with , then we just need to translate to an integer and an integer to a path . We define two functions, and :

: To define this function, we use the help of two functions defined in : the successor function and the predecessor function . We define as follows. Of course, we use directly the fact that every path of is of the form with :

: We just need to transform an integer into a path :
That they are inverses is a straightforward check. Therefore, we have .
6 Conclusion
Based on the theory of computational paths and the term rewriting system, we have proposed the main topic of this work: it is possible to use this approach to define path spaces directly, avoiding the use of complex techniques such as codeencodedecode. We have seen that the reason for that is the fact that the concept of path is only present semantically in traditional homotopy type theory, whereas in our approach it is added directly to the syntax. To illustrate our point, we have focused on two examples: the path space of the naturals and the proof that the fundamental group of the circle is isomorphic to the integers. In the first example, we have shown a straightforward inductive definition of the path space, showing that it is equivalent to the codeencodedecode one. In the second example, we have shown an easy proof for the fundamental group of the circle, using only basic rewriting rules in the process.
References
 [1] Steve Awodey. Type theory and homotopy. In P. Dybjer, Sten Lindström, Erik Palmgren, and G. Sundholm, editors, Epistemology versus Ontology, volume 27 of Logic, Epistemology, and the Unity of Science, pages 183–201. Springer Netherlands, 2012.
 [2] A. G. de Oliveira. Proof transformations for labelled natural deduction via term rewriting. 1995. Master’s thesis, Depto. de Informática, Universidade Federal de Pernambuco, Recife, Brazil, April 1995.
 [3] A. G. de Oliveira and R. J. G. B. de Queiroz. A normalization procedure for the equational fragment of labelled natural deduction. Logic Journal of IGPL, 7(2):173–215, 1999.

[4]
R. J. G. B. de Queiroz and A. G. de Oliveira.
Term rewriting systems with labelled deductive systems.
In
Proceedings of Brazilian Symposium on Artificial Intelligence (SBIA’94)
, pages 59–72, 1994.  [5] R. J. G. B. de Queiroz and A. G. de Oliveira. Natural deduction for equality: The missing entity. In Advances in Natural Deduction, pages 63–91. Springer, 2014.
 [6] R. J. G. B. de Queiroz, A. G. de Oliveira, and D. M. Gabbay. The Functional Interpretation of Logical Deduction. World Scientific, 2011.
 [7] R. J. G. B. de Queiroz, A. G. de Oliveira, and A. F. Ramos. Propositional equality, identity types, and direct computational paths, 2016.
 [8] R. J. G. B. de Queiroz and D. M. Gabbay. Equality in labelled deductive systems and the functional interpretation of propositional equality. In Proceedings of the 9th Amsterdam Colloquium, pages 547–565. ILLC/Department of Philosophy, University of Amsterdam, 1994.
 [9] J. Roger Hindley and Jonathan P. Seldin. Lambdacalculus and combinators: an introduction. Cambridge University Press, 2008.
 [10] Martin Hofmann and Thomas Streicher. The groupoid interpretation of type theory. In Twentyfive years of constructive type theory (Venice, 1995), volume 36 of Oxford Logic Guides, pages 83–111. Oxford Univ. Press, New York, 1998.
 [11] Philippe Le Chenadec. On the logic of unification. Journal of Symbolic computation, 8(1):141–199, 1989.
 [12] Arthur F. Ramos, Ruy J. G. B. De Queiroz, and Anjolina G. De Oliveira. On the identity type as the type of computational paths. Logic Journal of the IGPL, 25(4):562–584, 2017.
 [13] The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. https://homotopytypetheory.org/book, Institute for Advanced Study, 2013.
 [14] V. Voevodsky. Univalent foundations and set theory, 2014. Univalent Foundations and Set Theory, Lecture at IAS, Princeton, New Jersey, Mar 2014.
Appendix 0.A Subterm Substitution
In Equational Logic, the subterm substitution is given by the following inference rule [4]:
One problem is that such rule does not respect the subformula property. To deal with that, [11] proposes two inference rules:
where M, N and O are terms.
As proposed in [7], we can define similar rules using computational paths, as follows:
where is the context in which the subterm detached by ’[ ]’ appears and could be a subdomain of , equal to or disjoint to .
In the rule above, should be understood as the result of replacing every occurrence of by in .
Appendix 0.B List of Rewrite Rules
We present all rewrite rules of . They are as follows (All but the last three have been taken from [7]):
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42. .
Rules , and have been recently discovered and appears for the first time in this work. They come form the following derivation trees:
Rule :
Rule :
Rule :
Appendix 0.C Transport
As stated in [5], substitution can take place when no quantifier is involved. In this sense, there is a ’quantifierless’ notion of substitution. In type theory, this ’quantifierless’ substitution is given by a operation known as transport [13]. In our pathbased approach, we formulate a new inference rule of ’quantifierless’ substitution [5]:
We use this transport operation to solve one essential issue of our pathbased 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 same axiom for a dependent function . In that case, we want , but we cannot guarantee that the type of is the same as . The solution is to apply the transport operation and thus, we can guarantee that the types are the same:
Appendix 0.D Reflexivity
Here we provide a proof for Theorem 1, i.e., for the following statement: 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 theory for type theory to the path , then there is a path such that .
Proof
The base case is straightforward. 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:

, with .
We use rule 40. We have .

, with .
We use rule 41. We have .

, with .
We use rule 42. We have .
Comments
There are no comments yet.