Towards a directed homotopy type theory

In this paper, we present a directed homotopy type theory for reasoning synthetically about (higher) categories, directed homotopy theory, and its applications to concurrency. We specify a new `homomorphism' type former for Martin-L\"of type theory which is roughly analogous to the identity type former originally introduced by Martin-L\"of. The homomorphism type former is meant to capture the notions of morphism (from the theory of categories) and directed path (from directed homotopy theory) just as the identity type former is known to capture the notions of isomorphism (from the theory of groupoids) and path (from homotopy theory). Our main result is an interpretation of these homomorphism types into Cat, the category of small categories. There, the interpretation of each homomorphism type hom(a,b) is indeed the set of morphisms between the objects a and b of a category C. We end the paper with an analysis of the interpretation in Cat with which we argue that our homomorphism types are indeed the directed version of Martin-L\"of's identity types.


Introduction
Martin-Löf type theory, together with its identity type, is now often described as a synthetic theory of higher groupoids. This rich structure of the identity type was first discovered by Hofmann and Streicher in their disproof of the uniqueness of identity proofs [HS96]. There, the authors construct an interpretation of Martin-Löf's identity type into the category of groupoids where for any terms a, b in a type G, the identity type Id G (a, b) is interpreted to be the set of morphisms a → b in the groupoid interpreting G.
The full extent of this structure was later made explicit in Voevodsky's interpretation of Martin-Löf type theory with the identity type (amongst other types) into the category of Kan complexes, the objects of which represent spaces or ∞-groupoids [KL12]. In this interpretation, the identity type Id K (a, b) of any two points a, b in a Kan complex K is itself a Kan complex, or space.
Following these concrete interpretations, others (e.g. [War08,GG08,Nor17]) have compared Martin-Löf's specification of the identity types with the part of Quillen's axiomatization of homotopy theory that is today called the theory of weak factorization systems [Qui67,Bro73]. In [Nor17], the author has shown that in any finitely complete category, models of Martin-Löf's identity type are in correspondence with weak factorization systems with two stability properties.
Such results describe a fascinating perspective on the theory of higher groupoids. However, one might argue that this theory is very well understood already by topologists since it has concrete models which have been studied for the better part of a century. However, if one thinks of the theory of higher groupoids as being a theory of (reversible) paths, then one might wonder whether there is also a type theory which describes a theory of irreversible, or directed, paths. One might hope that such a type theory would shed light on the less well understood theories of higher categories and directed spaces. Both of these theories have a notion of directed paths at their core, and for both of these theories, there are many competing concrete models. Thus, having a synthetic theory of directed paths might shed light on this situation.
In this paper, we present the core of such a type theory. Our long-term goal is to use this type theory to prove and verify theorems about higher categories, directed homotopy theory, and concurrency.
1.1. Previous work. Several other type theories with semantics in category theories have been proposed. In [LH11], the authors construct a type theory that gives a synthetic theory of 1-categories. In [RS17], the authors construct a type theory that gives a theory of (∞, 1)-categories. Other works-in-progress [Nuy15,War13] do hope to give a theory of ∞-categories.
In this paper, we aim to give a syntax which not only describes ∞-categories but also directed spaces. We have three design criteria: (1) that our notion of directed paths is introduced via a type former and not as a judgement, so that it can be iterated as Martin-Löf's identity type can be, (2) that our theory allows us to transport terms of dependent types along directed paths, and (3) that our theory does not always allow us to transport terms of the type of directed paths along identities, since such a transportation does not hold in categories of directed spaces.
The syntaxes of [LH11] and [Nuy15] do not meet our first criterion since their directed paths are introduced as a judgement and not as a type former. This seems to make the theory somewhat unwieldy: in [LH11], only the theory of 1-categories is introduced and [Nuy15] includes no semantics. The theory of [War13] does not meet our second criterion, and the theory of [RS17] does not meet our third criterion.
1.2. Organization. In Section 2, we present the syntax for our type theory, which consists of one new type former hom within Martin-Löf type theory. In Section 3, we interpret the rules of this new type former hom within a comprehension category derived from the category Cat of small categories. Even though the objects of Cat are simpler than those of our intended semantics (higher categories and directed spaces), we see this as an important test case since its theory is much better understood than those of of our intended semantics. In Section 4, we briefly describe directed homotopy theory and its connection with concurrency, and we sketch an interpretation of our type former hom in a category of directed spaces.

The syntax
In this section, we define a type of homomorphisms within standard Martin-Löf type theory [ML82]. We only work in the bare type theory. That is, we assume that we have all the 'general rules' of [ML82], but none of the type-forming rules given there.
First, we require that for every type T , there are two new types Now we can define our type of homomorphisms.
hom formation : hom introduction : 2.1. Transportation and composition. Before we develop semantics for these rules, we prove some illustrative results in the syntax.
First, we show that we can transport types along homomorphisms, which is analogous to the transportation along identities in homotopy type theory.
Proposition 2.1. For any type Γ, t : T S(t) TYPE, we have a dependent term as follows. which we abbreviate by transport R (s, f ) (where that λs.s is merely abbreviation for the dependent term Γ, t : T core , s : S(it) s : S(it), and not a term constructor in our language.) Now using this transportation, we can show that we can compose two homomorphisms.
Proposition 2.2. For any type T TYPE, we have a dependent term as follows.
Proof. Using Proposition 2.1, we obtain a dependent term r : T op , s : T core , t : T, f : hom T (r, is), g : hom T (i op s, t) transport R (f, g) : hom T (r, t) which we rename comp R (f, g).
By the right hom computation rule, we find that for any f : hom T (r, is), the composition comp R (f, 1 s ) is strictly equal to f : hom T (r, is). Using left hom elimination, we could analogously construct a left transportation transport L and a left composition comp L such that for any g : hom T (i op s, t), the composition comp L (1 s , g) is strictly equal to g in the type hom T (i op s, t).

The semantics in Cat
In this section, we construct an interpretation in the category of categories. We work in a set theory with two uncountable inaccessible cardinals κ < λ. Let Cat denote the category of κ-small categories, and let CAT denote the 2-category of λ-small categories. We have arranged this so that CAT contains Cat and all the objects of Cat. Note that there are no universes in our syntax, so this is as much of a tower of universes in the semantics as we need.
3.1. Grothendieck (op)fibrations. The notions of Grothendieck fibrations and opfibrations play a central role in this interpretation, so we briefly review it here. See [Joh02] for more details.
Consider a functor P : E → B in CAT . We say that a morphism e : E → E in E is cartesian if for any other morphism e : E → E in E, any factorization of P (e ) through P (e) (that is, a morphism b : P (E ) → P (E ) such that P (e) • b = P (e )) uniquely lifts to a factorization of e through e (that is, there is a unique morphism : E → E such that e • = e and P ( ) = b).
The archetypical cartesian morphisms are pullback squares, in the following sense. First, let 2 denote the poset 0 ≤ 1. Then C 2 is the category of morphisms of a category C. Let cod : C 2 → C be the functor which sends each morphism to its codomain. Now consider any category C in CAT with all pullbacks. Then a morphism in C 2 whose underlying diagram in C is a pullback square is a cartesian morphism with respect to the functor cod.
A functor P : E → B in CAT is a Grothendieck fibration if for any object E of E, any morphism b : B → P (E) in B can be lifted to a cartesian morphism e : E → E (so that P (e) = b).
The archetypical Grothendieck fibration is a functor of the form cod : C 2 → C for any category C with all pullbacks. This is because for any object f in C 2 (which is a morphism f : X → Y in C) and morphism g : Dually, we can define cocartesian morphisms and Grothendieck opfibrations. For a functor P : E → B in CAT , a cocartesian morphism in E is a cartesian morphism in E op with respect to the functor P op . Then our archetypical cocartesian morphisms are pushout squares in any C 2 with respect to the functor dom : C 2 → C. A Grothendieck opfibration is a functor P : E → B in CAT such that P op is a Grothendieck fibration. Our archetypical Grothendieck opfibration is dom : C 2 → C for any category C with all pushouts.
One reason that Grothendieck fibrations have been of interest is that they are equivalent to pseudofunctors into Cat. However, we will not make full use of that equivalence here, but we will make use of the Grothendieck construction.
Consider any category C in Cat, and any functor F : C → Cat. We can construct, following Grothendieck, a new category C.F as follows. The objects of C.F are pairs (X, Y ) such that X is an object of C and Y is an object of F (X).
. Then there is a projection functor π C : C.F → C which takes each pair (X, Y ) to X. The functor π C is a Grothendieck opfibration since given any (X, Y ) in C.F , we can lift any morphism f : Dually, given any functor of the form F : C op → Cat, one can construct a Grothendieck fibration π C : C.F → C. The objects of C.F are still pairs (X, Y ) such that X is an object of C and Y is an object of F (X), but the morphisms 3.2. The comprehension category. A comprehension category over Cat (following [Jac93]) consists of a category E, a functor χ : E → Cat 2 , and a Grothendieck fibration G : E → Cat in CAT making the following diagram commute and such that χ sends to cartesian morphisms in E to cartesian morphisms in Cat 2 (that is, pullback squares).
When interpreting a type theory into this framework, we take the objects of Cat to be our collection of contexts, the morphisms of Cat to be context morphisms, and each fiber G −1 (Γ) to be the collection of types dependent on the context Γ. The terminal category * is the interpretation of the empty context. By applying the functor χ to an object T of G −1 (Γ), we obtain a morphism χ(T ) in Cat with codomain Γ; the domain of χ(T ) is the context extension (or comprehension) of Γ by T . Thus, terms in a type T dependent on a context Γ are interpreted by sections of χ(T ).
Problem 3.1. To construct a comprehension category over Cat.
Example 3.2. Before we construct the comprehension category, we indicate what G −1 ( * ) (the types in the empty context) will be. This will be the category of functors * → Cat, which is isomorphic to Cat itself. The comprehension functor χ will take a functor of the form C : * → Cat to a functor which is isomorphic to the unique functor C( * ) → * . Thus, terms of C are functors * → C( * ), which are just objects of the category C( * ). For any morphism (F, τ ) : (Γ, T ) → (Γ , T ) we have that χ(F, τ ) is the morphism in C 2 with the following underlying commutative square in Cat By Lemma 3.4 below, the functor χ preserves cartesian morphisms. Now it is straight-forward to check that the following diagram commutes.
Proof. Consider a cartesian morphism (F, τ ) : Applying χ to this functor, we obtain the following morphism in Cat 2 , which is a commutative square in Cat.
We want to show that this is cartesian with respect to cod : C 2 → C.
So consider a morphism α, β : Z → π Γ in Cat 2 and a morphism γ : Z 1 → Γ in Cat such that F γ = β as illustrated below.
( * ) We need to show that there is a unique δ : Z 0 → Γ.T which makes the diagram commute.
This comprehension category has a unit η : Cat → Cat.[−, Cat] which takes a category Γ to (Γ, * Γ : Γ → Cat) where * Γ is the functor which is constant at the terminal category * . Then χ(Γ, * Γ ) is an isomorphism π Γ : Γ. * Γ → Γ. In the sections that follow, we will interpret contexts as categories Γ in Cat, we will interpret types in context Γ as objects of the category [Γ, Cat] (which are functors Γ → Cat), and we will interpret terms of such an object T in [Γ, Cat] as morphisms from * Γ → T in [Γ, Cat] (which are natural transformations * Γ ⇒ T ).
3.3. core and op. In this section, we interpret the type formers core and op and the functions i and i op into our comprehension category. Example 3.6. Before we give the construction, we describe what it will be in the empty context.
Consider a type C in the empty context, which is just a category. Then C core will be just the set 1 of objects of C and C op will be the usual opposite category of C. Then i : C core → C and i op : C core → C op will be the injections which are the identity on objects. Whiskering with i (resp. i op ) gives a functor which takes any T : Γ → Cat to the natural transformation i : T core ⇒ T (resp. i op : T core ⇒ T op ).
3.4. hom formation. In this section, we interpret the hom formation rule. Example 3.9. In the empty context, our problem reduces to finding for each category C and object (x, y) ∈ C op × C, a category hom C (x, y). Our construction will produce the usual homset hom C (x, y).
Construction 3.10 (for Problem 3.8). Let (−) op × id Cat : Cat → CAT denote the functor which takes any C ∈ Cat to C op × C in CAT . Then let c Set : Cat → CAT be the constant functor at Set, the category of κ-small sets.
There is a lax natural transformation hom : (−) op × id Cat ⇒ c Set which at each C ∈ Cat is the usual functor hom C : C op × C ⇒ Set (which maps an object (X, Y ) ∈ C op × C to the set hom C (X, Y ) of morphisms X → Y in C). This transformation is not natural since for a functor F : C → D, the square of functors might not commute. It is however a lax natural transformation since there is a natural transformation hom F : In this note, we will often talk about a set X in the category Cat. To be clear, we mean the category whose objects are the elements of X and whose morphisms are only identity morphisms. Now for any functor T : Γ → Cat and natural transformations s : * Γ ⇒ T op , t : * Γ ⇒ T , we have the following diagram of functors and (lax) natural transformations.
By pasting together the natural transformation (s, t) and the lax natural transformation hom in the diagram above, we obtain a lax natural transformation hom T (s, t) : * Γ ⇒ c Set T . At every object γ ∈ Γ, this gives a functor hom T (s, t)γ : * → Set which is just a set hom T (s, t)γ( * ). For every morphism φ : γ → γ in Γ, this produces a natural transformation * In other words, hom T (s, t) is a functor Γ → Cat.
3.5. hom introduction. In this section, we interpret the hom introduction rule.
Problem 3.11. To functorially construct for each functor T : Γ → Cat and natural transformation t : * Γ ⇒ T core , a natural transformation 1 t : * Γ ⇒ hom T (i op t, it).
Example 3.12. In the empty context, our problem reduces to finding for each category C and object t ∈ C core , an object 1 t ∈ hom T (t, t). Our construction will produce the usual identity morphism t → t.
Construction 3.13 (for Problem 3.11). For every category C and for every t ∈ C core (that is, an object t of C), there is an element 1 C t ∈ hom C (t, t), the identity morphism t → t. Since this is (vacuously) natural in t, it assembles into the natural transformation shown below where c * is the constant functor at the terminal set. This is furthermore natural in C, so it assembles into the following modification.
Now, consider a functor T : Γ → Cat and a natural transformation t : * Γ ⇒ T core . We obtain a diagram Then pasting together this diagram, we obtain a modification c * hom C (i op t, it) which unfolds into a natural transformation 1 t : * ⇒ hom(ι op t, ιt). This natural transformation has at each γ ∈ Γ the component 1 tγ : * → hom(tγ, tγ) which picks out the identity morphism tγ → tγ.
3.6. Right hom elimination and computation. In this section, we interpret the right hom elimination rule so that it satisfies the strict equality required by the right hom computation rule. Example 3.15. Where Γ and Θ are both empty contexts, our problem reduces to finding for each category C, each functor D : C core .C.hom C (i op × 1) → Cat, and each natural transformation d : * C core ⇒ D • 1 • : C core → Cat, a natural transformation e r (d) : The objects of C core .C.hom C (i op × 1) are triples (X, Y, f ) such that f : X → Y is a morphism in C. Its morphisms are of the form g : Since e r (d)1 • must be d, we know that e r (d) (X,X,1 X ) must be d(X) for any object X of C core . Now for any other object (X, Y, f ) of C core .C.hom C (i op × 1), there is a morphism f : (X, X, 1 X ) → (X, Y, f ). Then we get a morphism D(f ) : D(X, X, 1 X ) → D(X, Y, f ). We apply this functor to d(X) to obtain e r (d) f . That is, we set e r (d) f := D(f ) (dX) .

But we have
where the first equality and last equality come from our definition of e r (d), the second and third from composition in the category Γ.T core .T .hom T (i op × 1).Θ, and the forth from the naturality of d. Now we only need to check that e r (d) • 1 • .Θ = d. For any (γ, t, θ) of Γ.T core .Θ, we have that where the first equality is the definition of 1 • , the second is the definition of e r (d), and the third is the functoriality of D. Therefore, we have that e r (d)1 • = d.

3.7.
Left hom elimination and computation. In this section, we interpret the left hom elimination rule so that it satisfies the strict equality required by the left hom computation rule. However, it just takes an application of right hom elimination and computation.
and (T op ) core = T core . Then by substituting T op in for T everywhere in the statement of the Problem 3.14, we find that our problem has already been solved.
3.8. The homotopy theory. In this section, we describe the (directed) homotopy theory that this interpretation inhabits in Cat.
To understand this homotopy theory in Cat, first recall that there are two weak factorization systems on Cat [Nor17]. We begin with the following two factorizations of the fold map where 2 is the category generated by one morphism 0 → 1, I is the category generated by one isomorphism 0 ∼ = 1. This gives us, by exponentiation, two functorial factorizations of the diagonal C → C × C of any category C.
Then, we can functorially factor any functor F : C → D in two ways. We can characterize the right maps of these weak factorization systems in another way. The maps in R → are exactly those maps which have the enriched right lifting property against the inclusion of the domain into the generic morphism: 0 : * → 2. The maps in R ∼ = are exactly those maps which have the enriched right lifting property against the inclusion of the domain into the generic isomorphism: 0 : * → I. While the usual identity type of Martin-Löf type theory has an interpretation into the weak factorization system (L ∼ = , R ∼ = ) [Nor17], we claim that we have constructed in the preceding sections an interpretation into the weak factorization system (L → , R → ). By this, we just mean that (1) given any interpretation of a dependent type T : Γ → Cat, its comprehension π Γ : Γ.T → Γ is in R → , and (2) the elimination property can be seen as the existence of a lift between a map of L → and a map of R → . To show that any comprehension π Γ : Γ.T → Γ is in R → , note first that it is a Grothendieck opfibration.
Proposition 3.19. Any Grothendieck opfibration p : E → B is in R → .
Proof. We need to show that there is a lift in the following square.
where e is an object of E and f : pe → b is a morphism in B. By the definition of Grothendieck opfibration, there is a lift of f , which we will denote (e, f ) : e → (e, f ) such that p (e, f ) = p. We will choose (e, 1 e ) to always be 1 e .
A morphism (e 0 , f 0 ) → (e 1 , f 1 ) of E × B 0 B 2 is a pair ( , φ) where : e 0 → e 1 is morphism of E and φ : b 0 → b 1 is a morphism of B which makes the following square commute in B.
Now, in E we have the following diagram of solid arrows. By the definition of Grothendieck opfibration, we obtain a unique morphism (e 0 , f 0 ) → (e 1 , f 1 ), which we will denote ( , φ), which makes the above diagram into a commutative square. It is straightforward to check that is a functor which makes the first diagram of this proof commute. Now the right elimination property (in the empty context) says that for any category C, any functor D : C core .C.hom C → Cat, and any functor d : C core → C core .C.hom C .D making the following square commute, there is a lift making both triangles commute.
C core .C.hom C We want to see that this arises as the solution of a lifting problem between a left map and a right map of our weak factorization system. We just saw that π is a right map, so now we prove that 1 • is a left map.
Proposition 3.20. For any category C, the functor Proof. Factor the functor i : C core → C.
We claim that the middle object, C core × C 0 C 2 , is isomorphic to C core .C.hom C and this makes 1 • isomorphic to 1 × C ! i, the left factor of the factorization for the weak factorization system (L → , R → ). Thus, 1 • will be in L → .
The objects of C core .C.hom C are pairs ((x, y), f ) where (x, y) is an object of C op ×C and f is morphism x → y.
The objects of C core × C 0 C 2 are pairs (x, f ) where x is an object of C core (that is, x is an object of C) and f is morphism with domain x.
On objects, define the functor α : C core .C.hom C → C core × C 0 C 2 by α((x, y), f ) := (x, f ) and its inverse by On morphisms, define the functor α and its inverse both by (1 x , g) → (1 x , g). This gives an isomorphism α : C core .C.hom C ∼ = C core × C 0 C 2 . Now, we just check that α1 • = 1 × C ! i. For any object x of C core , we have that α1 • (x) and 1×C ! i(x) are both (x, 1 x ) (and C core has no nonidentity morphisms).

Directed homotopy theory and concurrency
In this section, we briefly describe some aspects of directed homotopy theory and its application to concurrency and indicate how our hom types can be intepreted in a category of directed spaces. 4.1. Background. In brief, directed homotopy theory is the study of spaces for which certain paths are singled out and given a direction [Gra09]. For example, one might want to consider the circle S 1 in the category of topological spaces together with the information that any clockwise path is 'allowed', but counter-clockwise paths are 'not allowed'.
Such directed spaces appear in many applications, but perhaps most notably in the study of concurrent processes. A system of concurrent processes can be represented by a space whose points represent states of the system and whose directed paths represent possible executions of the system. For example, we might consider two processes A and B which both need to access the same two memory locations m and n in succession [FGH + 16]. In order to avoid a conflict, we allow each process to 'lock' (L) and 'unlock' (U ) each memory location, and while one memory location is locked by one process, we disallow the other process to lock it. Then the set of allowed states in such a system can be seen to form a directed space S (shaded in gray in Figure 1) whose underlying topological space is a subspace of Now we can ask which states (x, y) are reachable by these two processes starting from the origin (0, 0) and which states (x, y) are safe, meaning that the end state (1, 1) can be reached from (x, y). In this example, we see that the whole space but the square [U A n , U 4.2. Future work: semantics in directed spaces. In future work, we hope to construct an interpretation of hom-types into a suitable category of directed spaces (see e.g., [Gra09,Kri15]). We roughly sketch that interpretation here. For any directed space X, we let X core and X op have the same underlying space as X, we let X core have only trivial directed paths, and we reverse the directed paths of X to get the directed paths of X op . Then we let the underlying space of hom X (x, y) be the space of directed paths from x to y in X, and we let a directed path of paths from p to q in hom X (x, y) be a homotopy of paths from p to q which is directed in the homotopy coordinate. The difficult and interesting part of establishing such an interpretation will lie in constructing a universe in this category.
We end by demonstrating that in such an interpretation of hom-types into a category of directed spaces, together with an interpretation of Martin-Löf's Σ-types, we will be easily able to express the notions of reachable and safe states. Indeed, given a type X and two terms i, f meant to represent the initial and final state, we can define Reachable(X) := Σ x∈X hom X (i, x) Safe(X) := Σ x∈X op hom X (x, f ).
Then, for our directed space S shown above in Figure 1, we would have that Reachable(S) is the directed space of reachable states each with a witness that that state is reachable and Safe(X) would be the directed space of safe states each with a witness that that state is safe.