Extending Homotopy Type Theory with Strict Equality
Abstract.
In homotopy type theory (HoTT), all constructions are necessarily stable under homotopy equivalence. This has shortcomings: for example, it is believed that it is impossible to define a type of semisimplicial types. More generally, it is difficult and often impossible to handle towers of coherences. To address this, we propose a 2level theory which features both strict and weak equality. This can essentially be represented as two type theories: an “outer” one, containing a strict equality type former, and an “inner” one, which is some version of HoTT. Our type theory is inspired by Voevodsky’s suggestion of a homotopy type system (HTS) which currently refers to a range of ideas. A core insight of our proposal is that we do not need any form of equality reflection in order to achieve what HTS was suggested for. Instead, having unique identity proofs in the outer type theory is sufficient, and it also has the metatheoretical advantage of not breaking decidability of type checking. The inner theory can be an easily justifiable extensions of HoTT, allowing the construction of “infinite structures” which are considered impossible in plain HoTT. Alternatively, we can set the inner theory to be exactly the current standard formulation of HoTT, in which case our system can be thought of as a typetheoretic framework for working with “schematic” definitions in HoTT. As demonstrations, we define semisimplicial types and formalise constructions of Reedy fibrant diagrams.
1. Introduction: Motivations for a 2Level System
The identity type is probably the single concept of intensional MartinLöf type theory (MLTT) which has created most questions, stimulated most research, caused most confusion, and enabled the largest number of different views. Written for elements of a type , the identity type expresses that two elements are equal in some sense and can be substituted for each other, and the elements of this type are called equalities. However, by default, it has a somewhat strange standing. On the one hand, it is not wellbehaved when it comes to describing equality of functions and equality of types. Given two functions of the same type, we cannot derive the principle of (naive) function extensionality, saying that the functions are equal if they are equal at every point, from the basic axioms. We also cannot show that equivalent types can be substituted for each other, although they do behave equivalently in any given situation. On the other hand, we also cannot derive the principle of unique identity proofs (UIP): by a construction of Hofmann and Streicher [HS96], we can not show for two equalities . A priori, it is unclear what it should mean to have distinguishable equalities and how one can make sense of this behaviour.
As we view it, there are two major ways to remedy the situation. Both can be seen as extensions of MLTT. The principle of function extensionality can be added in any case, but after that, we have two possibilities to extend the theory further. The first is to add UIP (or, equivalently, Streicher’s ) as an axiom. Let us call the resulting type theory . The second possibility is to consider univalence, ensuring that type equality is what one would ideally expect. This approach is taken by Homotopy Type Theory [Uni13], and we write HoTT for the resulting theory.
One appeal of HoTT is that equalities can be seen as paths in a space, and it is even possibly to develop a lot of homotopy theory synthetically. An important insight is that, when doing homotopy theory in type theory, every statement that we make is up to homotopy, and every construction respects (homotopical) equivalence. This means that whatever we do will be “nonevil” in the sense that it can only take the homotopy type of spaces, and homotopy equivalence classes of maps, into account, and not the concrete representations of spaces or maps. Exactly this is often considered a selling point of HoTT: one often defines constructions using representatives of homotopy classes in traditional homotopy theory and is forced to show that the constructions are welldefined, i.e. do not depend on the choice of the representative. In HoTT, everything we do is automatically welldefined as we are simply not able to talk about strict properties internally.
Going back to the homotopical point of view, it is not hard to imagine that the blessing of having only constructions up to homotopy can turn out to be a curse: we are unable to make any strict statement. For example, we cannot form a type expressing that a given diagram commutes strictly; all we can do it stating that it commutes up to homotopy. Unfortunately, depending on the shape of the diagram, this will only be sufficient in the simplest cases. More often than not, it will be necessary to say that the different “pieces” (the equalities expressing commutativity) fit together. For example, the fact that a certain subdiagram commutes can be part of the proof that the diagram commutes, but it may at the same time be derivable as the composition of the fact that other subdiagrams commute. In this case, it is natural to require these different ways of getting a certain proof to be equal. It does not stop here; these new proofs can itself be required to be coherent, and so on. What happens here is not at all something that can only be observed in type theory. The first step becomes already apparent in the theory of monoidal categories in the form of “Mac Lane’s Pengaton”. On higher dimensions, it is exactly the same issue that is discussed as homotopy commutativity versus homotopy coherence by Lurie [Lur09].
In general, homotopy coherence corresponds to infinite towers of coherence data, and it is a major open problem (and commonly believed to be unsolvable) to express such towers internally in HoTT. One way to avoid this problem is to restrict constructions to types of low truncation levels. As an examples, the category theory developed in [AKS15] only considers truncated types and [what corresponds to] ordinary categories. This is in many situations not satisfactory: we know that types are groupoids [Lum10, vdBG11], and similarly, the universe should be an category. Unfortunately, we seem to have no way of expressing this internally in HoTT.
The crucial shortcoming of HoTT is that we are unable to perform some constructions which actually seem to be harmless as they only require finite amounts of coherences at every step. An example that has received considerable attention in the HoTTcommunity is the construction of Reedy fibrant truncated semisimplicial types (simply referred to as semisimplicial types). Let us start with , the category of finite nonzero ordinals and strictly monotonous functions. Let us write for the ordinal with elements. A typevalued diagram over is a strict functor from to the category of types. It would correspond to a type (for simplicity written ) for every , and face maps for , as it is wellknown that any map can be written as a composition of face maps. The problem is that we need the semisimplicial identities (essentially a representation of the functor laws) to be strict, which we cannot express in type theory. The considered approach to avoid this problem is to only attempt internalising Reedy fibrant diagrams over , essentially ensuring that the face maps are simple projections. Using the correspondence between fibrations and type families, a (Reedy fibrant) semisimplicial type then corresponds to a type (the “points”) on level . On level , we need a family , where is the universe of types. We think of as lines between types. Next, we need , the type of fillers for triangles. Writing down the type of is already a bit tedious, but nevertheless straightforward: is a family which gives a type for any collection of four points, six lines and four triangles that form an empty tetrahedron. The longstanding open problem of homotopy type theory is to write down the type of in general (up to equivalence). Perhaps surprisingly, this does not seem to be possible. What is possible is to generate an expression for every externally fixed numeral , such that the expressions all “fit together”. When one tries to do the construction for a variable , it does no longer typecheck. The reason is that some judgmental equalities that hold in the case of a numeral fail to hold in the case of a variable. We can try to prove in type theory that the required equalities hold up to homotopy. However, we quickly have to realize that we then also need that these equalities are coherent, and that the coherence proofs are coherent themselves, and so on; something that no one has managed to do so far. The problem is that we cannot formulate the tower of coherences that we need to prove. Morally, the required equalities should hold and be fully coherent just because they are trivially satisfied for each externally fixed natural number. If we can use a system where we judgmental equalities can be shown by induction, there would thus be no problem at all; however, this would require judgmental equalities to be some sort of type.
In , the internal equality type can be seen as an internalised version of judgmental equality. For example, a wellknown metatheoretic statement is that any equality that is constructed in the empty context is ; that is, if we can show an equality internally without assumptions, then this equality holds judgmentally. Not surprisingly, it is possible to construct Reedy fibrant semisimplicial types in . However, we can also simply define categories and functors in the naive sense, as all coherences are satisfied automatically.
The idea of a 2level system is to combine and HoTT instead of viewing them as two alternative extensions of MLTT. We can describe this in two ways:

Start with a type theory that has axiom and consider a “subtheory” of types and maps that do not talk about equalities. Inside this subsystem, we can consider a new equality type and univalent universes. If we use the equality type with of the outer system, we cannot form types that live in the inner system; however, we can reason about the inner system.

We may start with HoTT and try to formulate the metatheory (in which judgmental equality lives) as a type system. It is not necessary to capture every aspect of the metatheory in this type system; the important part is that this outer type system has an equality type (which we call strict equality) satisfying . We then have in total three equalities: the equality in HoTT; the strict equality; and the judgmental equality (which we should now refer to as definitional equality). From the point of view of HoTT, the strict equality and definitional equality are identical.
Considering a type theory with two equality types is not new. Our proposal is motivated by the suggestion of a homotopy type system (HTS) by Voevodsky [Voe13]. However, as far as we are aware, “HTS” mostly refers to a range of ideas so far but not to a precise theory, and there is no publication that presents or analyses HTS. The core idea of HTS is to make some judgmental equalities provable. In other words, some form of equality reflection, the characteristic concept of extensional type theory, is reintroduced, in a way that is compatible with the “standard” intensional identity type. A concrete theory that could be called “HTS” is outlined in the draft [Voe13] which, unfortunately, presents rather involved rules that would presumably be nontrivial to justify. It is sometimes said that Andromeda, a project by Bauer et al. [BGH], is an implementation of HTS. However, this is probably rather misleading as Andromeda goes in a very different direction and does not feature univalence at all.
A key observation of the current paper is that no form of equality reflection is actually required. Our proposal instead only required unique identity proofs for the strict equality type. Thus, we can avoid all the problems that are usually connected to equality reflection, such as undecidability of type checking. In contrast, the theory that we suggest is wellbehaved, very close to the standard formulation of HoTT, and has straightforward semantics. One could expect that a downside of our system might be reduced expressibility compared to a theory that features equality reflection. However, we show that we can achieve in our system what HTS was suggested for: a definition of semisimplicial types, and other constructions. This should actually not be surprising in the light of Hofmann’s result [Hof95], which states that equality reflection is conservative over .
Our 2level theory can be defined as two separate type theories with a morphism between them. This actually gives a recipe for constructing a variety of reasonable 2level theories, and the choices that can be made affect the exact abilities of the system. We believe that our 2level theories can be used in two ways. First, we can use the outer theory as a powerful formal language to study the inner theory. For some formulations of the 2level theory, we get a conservativity result (by an argument of the secondnamed author; see the forthcoming thesis [Cap16]). This means that the inner theory is exactly HoTT as studied in the standard textbook on homotopy type theory [Uni13] and by many authors. In a proof assistant which supports this theory, we can then implement results that so far can only be stated metatheoretically. To give an example, it is shown in [Kra15a] that constant functions from to which satisfy coherence conditions correspond to maps , provided that is truncated. This can be done in HoTT only if is an externally fixed natural number. In the 2level system, we can formalise it by taking to be a number in the outer theory, and show that the equivalence holds in the inner theory.
Second, we can use the construction of 2level theories to derive extensions of HoTT that allow constructions that HoTT does not allow. For example, we can assume that the natural numbers of the outer theory are exactly the natural numbers of the inner theory, something that is satisfied in the simplicial set model. This gives us a univalent type theory in which various concepts including semisimplicial types can be defined.
Contributions of the paper
Summarised, the main contributions of the paper are:

We give (for the first time) a clean presentation of a system with two equalities.

Schematic constructions, which could so far only be given on paper, can be formalised in our system. As an example, we perform constructions of Reedy fibrant diagrams. Further work is outlined in the conclusions.
Related work
The current paper is the writeup of our presentation [ACK] at TYPES’15. As briefly explained above, the main difference to Voevosky’s draft [Voe13] is that we do not consider any form of equality reflection, saving us from various difficulties.
Superficially related is the construction by Maietti [Mai09] of a twolevel foundation for constructive mathematics. However, their motivation and goals are very different from ours, hence their system cannot be used to reconcile strict equality with univalence.
Our work is more closely related to a recent proposal by Part and Luo [PL15] of Logicenriched HoTT. In their system, our strict layer of type theory is replaced by a “logic enrichment”. Their proposal is limited to the construction of semisimplicial types (corresponding to the one that we give in Section 3). It is not explained whether this can be generalised to Reedy fibrant diagrams in the sense we present in Section 4, as they use specific properties of the category.
Agda formalisation
As a proof assistant based on our 2level theory does not (yet) exist, we cannot formalise our constructions exactly as they are presented. However, we have implemented in Agda an approximation of the construction of semisimplicial types that is given in Section 3. It can be found on GitHub at github.com/nicolaikraus/HoTTAgda/tree/master/nicolai/SemiSimp. For an explanation of the relationship between the construction given in the paper and this implementation, we refer to the last remark of Section 3.
Organisation
The structure of the paper is as follows. In Section 2, we specify our 2level theories. Section 3 explains the construction of Reedy fibrant truncated semisimplicial types in a way that could nearly be done in homotopy type theory, and we show how the missing gap is filled by our strict equality. Then, in Section 4, we demonstrate how our theory can be used to internalise standard constructions in a fairly straightforward way. Finally, in Section 5, we outline further work and conclude the paper.
2. The Specification of a 2Level System
In this section, we want to specify our 2level theory (or, to be precise, our family of 2level theories). We give two presentations: first, the semantical approach, and second, the syntactical approach. With the first approach, we explain how the theory is constructed. It also shows which choices can be made, and how models of the 2level theory can be constructed. The syntax that we propose afterwards is based on the semantics, but fixes a precise system.
2.1. Semantical Approach
Many models of type theory consist of a category , modelling the category of contexts. Starting from , additional structures are added to model types and terms, together with the structure that is needed to model the components of the considered theory (such as universes or dependent functions). Then, a model of a 2level theory in our sense is given by a category of contexts , together with two structures on such that the first structure (taken together with ) models HoTT, and the second structure (taken together with ) models . Finally, we need a morphism between the structures in a suitable sense, describing how any type or term in HoTT can be viewed as a type or term in .
We make this precise using the notion of categories with families [Dyb95]. Let us recall the definition:
Definition 2.1 (CwF [Dyb95]).
A category with families (CwF) is given by:

a category , equipped with a distinguished terminal object ;

a presheaf ;

a presheaf ;

for all and , an object representing the functor defined by:
The objects of are called contexts. Given a context , the elements of are called types, and given a type , the elements of are called terms.
The context is called the context extension of by the type , and is the display map of .
The action of and on morphisms is called substitution.
A CwF can be regarded as a model of MLTT with only structural rules, i.e. rules that deal with types, terms and substitutions, but no type formers (like or types). Type formers can be postulated separately as additional structures on a CwF. For details, we refer to [Dyb95] and [Hof97].
To model a 2level type theory, we need to add some extra structure to a CwF:
Definition 2.2.
A 2level category with families is a CwF , together with:

a presheaf ;

a natural transformation .
Given a 2level CwF , we will denote the underlying category with family by . There is also a second CwF structure on , where the types are given by , and terms are defined as:
and context extension is given simply by . We will denote this second CwF by .
The map determines a morphism of CwF , which we will also denote by .
The theory employed in this paper will be modelled by a 2level CwF where:

is a model of ;

is a model of HoTT;

the morphism preserves , and strictly.
Note that, crucially, equality types, although present in both CwF structures, are not generally preserved. This is important, because preservation of equality would mean that axiom holds in , which in turn would imply that does not admit any univalent universes containing nonpropositional types.
Other type formers besides those mentioned might or might not be preserved. We say that a 2level CwF is strong if preserves coproducts, natural numbers, and the empty type (more generally types, if part of the theory).
Interestingly, most of the existing models of HoTT can be naturally extended to a 2level CwF. Most notably, the simplicial model [KLV12] can be regarded as a 2level CwF, where is given by arbitrary (wellordered) morphisms, is the subfunctor of consisting of Kan fibrations, and is simply the inclusion. With this setup, is (equivalent to) a presheaf CwF, which models type theory with equality reflection (hence, in particular, ), and is the same as the model defined in the paper.
One can also start with an arbitrary model of HoTT, then consider the presheaf category . It is perhaps not surprising that one can equip with a 2level CwF structure so that can be recovered inside . This makes it possible to use 2level type theory to formulate and prove statements that hold in any model of HoTT, i.e. 2level type theory can be regarded as a metalanguage for HoTT.
2.2. Syntactical Approach
In the syntactical approach, the clear separation of a 2level theory into two theories becomes harder to see. We do not leave as many choices open as in the semantical approach, but rather fix a concrete theory; and the choices that we make ensure that the conservativity result of the forthcoming thesis [Cap16] applies to the presented theory.
For a precise specification, we choose a presentation in the style of [Uni13, Appendix A.2], which considers three forms of judgments: ; ; and . Fortunately, we do not need to give all the rules, as most of them are identical to those given in [Uni13, Appendix A.2]. Thus, in most cases, it is sufficient to state the difference in order to give both an understandable and a precise specification.
The theory that we consider has the following basic types and type formers: , the type former of dependent functions; , the type former of dependent pairs; , the coproduct type former; , the unit type; , the empty type; , the fibrant type of natural numbers; , the equality type (in the sense of HoTT); a hierarchy of universes. So far, we can think of these as the types and type formers of HoTT. Further, we have: , the strict coproduct; , the strict empty pretype; , the strict pretype of natural numbers; , the strict equality; and hierarchy of strict universes.
Both the hierarchy and the hierarchy are cumulative. We think of the elements of as fibrant types (or simply types), while the elements of are pretypes.
Recall possibility 1 from the two ways of describing a 2level system as outlined on page 1: we can start with a type theory with and embed HoTT later. Thus, we first consider the type theory with the basic types , , , with universes , and with , , and . All rules correspond exactly to those of [Uni13, Appendix A.2]. For example:

Contexts are formed using elements of , i.e. if is a context and , then is a context.

If and , then we have .

If , then we have .

All further rules of , and all rules of , , , , and are also those given in [Uni13, A.2.4–9]. The constructors of are called , , and the constructors of are called and . We assume all the usual judgmental rules (including the judgmental rule for ).
Further, the theory has a strict identity pretype, written : For any and , we have , with the introduction rule , the eliminator , and the usual computation rule. For pretypes , we can form the pretype of strict isomorphisms, written (unlike in HoTT, it is enough to have maps in both directions such that both compositions are pointwise strictly equal to the identity). However, we do not assume that is univalent. Instead, we add the rule : for , , as before, and for , we have a term . We also assume that satisfies the principle of function extensionality.
Note that, so far, we have not considered , , , , at all. We do this now, and their rules are more subtle. The first important rule is that any type (element of ) is also a pretype (element of ):
(1) 
This means that informally we can understand as a subtype of .
Now, let and be fibrant types, i.e. and . Then, by (1) and by the formation rule of , we have . However, we add the rule that, under these conditions, this conclusion can be lifted to . In other words, preserves types. We add the same rule for :
(2) 
We do not add the same rule for , that is, the strict sum of two types is still only a pretype. Similarly, there is no special rule for : if , it does not matter whether is a type or only a pretype, the expression is only an element of , not of .
In contrast, the equality type former can only be applied to elements of fibrant types; i.e. its formation rule is given by
(3) 
(note that there is no strict universe involved). The type (with the constructor ) is a pretype by rule (1), but (usually) not the same as . The elimination principle of only works for families of types (not in general for pretypes). This means that the usual “path induction” principle, which allows us to construct an element of , can only be applied if is a family of types, i.e. . If we restrict ourselves to types, we can do everything that we can do in HoTT. In particular, we can say what it means for a function between types to be an equivalences (using ). We assume that the universes are univalent, that is, the canonical map from type of equalities to the type of equivalences (defined as usual in homotopy type theory) is an equivalence itself.
Similarly, the type former only allows us to form a type if and are types (elements of some ), and we can only defined a function with the usual induction principle if is a family of types.
We have the type of natural numbers (in any context) with the constructors , , and its induction principle can only be applied to eliminate into families of types. The same is the case for . This completes the syntactical characterization of our 2level system. We will usually omit the index and simply write or instead of or in the same style as it is done in [Uni13]. A strong 2level theory is now simply one in which and , and and , and and coincide.
Remark 2.3.
If is a (“fibrant”) type with elements , then we can form both the type and the pretype . By “strict path induction” (i.e. an application of ), we can easily construct a function . Consequently, strictly equal elements of a type are also homotopyequal. This corresponds to the fact that judgmental equality in HoTT implies equality (“”). We cannot construct a function in the other direction, as the path induction principle can only be applied to eliminate into types, which is not. Hence, equal elements are not necessarily strictly equal. However, if we have a type which does satisfy this “equality reflection” principle, it is easy to see that the type is a set in the sense of homotopy type theory.
3. SemiSimplicial Types
In a 2level theory, we can define strict categories in a reasonable sense. There are a number of choices that one can make; for example, the objects could be a fibrant type or only assumed to be a pretype. Later (see Definition 4.3), we will give one possible concrete definition. The important thing is that the categorical equations can be required strictly; and, if we have such a strict category , we can easily write down the pretype of strict functors . Unfortunately, there is no general way to get an actual fibrant type of such functors.
The case where is (the category of finite nonempty ordinals and increasing functions) is particularly interesting since “simplicial structures” appear frequently in homotopy theory. Having a type of functors would have many potential applications; maybe most notably, one could try to internalise a constructive version of the model of univalent foundations in simplicial sets [KLV12]. Unfortunately, it seems unreasonable to expect that such a type can be constructed. It would be a good approximation (and potentially good enough for many constructions) if one could form a type of functors , where is the category of finite nonempty ordinals and strictly increasing functions (a more precise definition will be given below). Trying to define such a type seems more promising, since is an inverse category and, if we restrict ourselves to Reedy fibrant functors, we can describe them by induction (see [Shu15]).
This gave rise to the challenge of defining Reedy fibrant truncated semisimplicial types (in the community often just referred to as semisimplicial types) in type theory. The challenge was first raised during the special year on Univalent Foundations at the Institute for Advanced Study (Princeton, 2012–13). As briefly sketched in the introduction, a (Reedy fibrant) truncated semisimplicial type is simply a type , a truncated semisimplicial type is such an together with a family , and so on. Defining truncated semisimplicial types as a family in homotopy type theory is a famous open problem. Many attempts (see e.g. [Her15, Shu, Kra15b]) have not led to a solution, and at a workshop on HoTT in Warsaw (June 29–30, 2015), a clear majority of the participants expected it to be impossible.
The hard part of the construction is to define the matching objects , that is the “full boundary” of an simplex, as the corresponding component of is then just given as a family . A popular attempt for defining the matching objects is to define the skeleton of by induction on , that is, the collection of components of up to level . As long as is a fixed numeral, this can be done. However, if is a variable, some crucial judgmental equalities do not hold anymore and the construction is believed to become impossible. In our level theory, we can prove strict equalities (i.e. the internalisation of judgmental equality) by induction. This allows us to complete the sketched approach of defining in a weak sense: we construct a family . If we assume that the strict natural numbers () and the fibrant ones () coincide, this represents a construction of truncated semisimplicial types. Without this assumption and under the conjectured conservativity result [Cap16], it internalises the result that truncated semisimplicial types can be defined for an externally fixed .
To give the precise construction, let us first note that we have the family of finite types ( is the type with elements), together with the families . Let us write for the predicate
expressing that a function is strictly monotonously increasing. Let us further write for the type . We then have a composition operator , defined separately on each of the two components. This is a representation of strictly increasing functions such that is strictly associative, as observed in [Kra15b]. Unsurprisingly, this is enough to make a category in the sense that we will define later (see Definition 4.3).^{1}^{1}1Note that, for technical reasons, we include the initial object . This explains the shift by : we have defined instead of .
In the following, we use variable names , instead of , to indicate that we have an element of a nested type, i.e. a tuple. With at hand, we define truncated semisimplicial types () simultaneously with skeletons () and the morphism part of skeletons (written ). These have the following types:
These type families can be explained as follows:

is the type of truncated semisimplicial types.

Assume we have a truncated semisimplicial type , where is smaller than another given number .^{2}^{2}2The definition works for , but is the case that is important for the intuition. allows us to form the type . This is the type of “partial boundaries” of an truncated semisimplicial type. Intuitively, it has points, lines, …, and cells on level .

We think of as a “functor” from to . Its morphism component is given by : for any , we get a function which simply “removes” those cells that appear in the partial boundary of an simplex, but not in the partial boundary of an simplex.
At the same time as we define , and , we prove the following strict functor law for all , , and , :
We define all the components by induction on as follows. In the base case, we set ; ; ; and . In the successor case, we choose
Note that, in the last line, the type of the term is . However, what we need at that point is an element of the type . This is why we transport along the proof , abbreviated to , which shows that the two types are strictly equal.
We omit the term for as it is not insightful to write it down explicitly. It is constructed as follows. First, we note that we need a (strict) equality between pairs; the first components are (strictly) equal by . When one tries to prove that the second components are (strictly) equal, one quickly realizes that what is needed is coherence for the family of strict equalities : The composition can be shown to be (strictly) equal to in two ways, and we need that both ways are strictly equal. Of course, this follows from the fact that we have axiom for our strict equality. We have verified this construction in Agda (see the remark below).
Remark 3.1.
We and many others have attempted to formalize semisimplicial types in homotopy type theory with exactly the outlined strategy, replacing the strict law by the usual equality type. This works in the same way until the point where we need that is coherent, which is automatic in our case. Intuitively, is coherent, and it is easy to get trapped into thinking that this coherence can just be shown simultaneously with the other four components. However, if one does this, one notices that one needs an additional coherence level for , and it continues like this. Morally, all these coherences should hold, and it is very likely that we would actually be able to prove them inductively if only we were able to write them down. Unfortunately, writing them down is a problem that is very similar to defining semisimplicial types itself. From this point of view, what the level theory gives us is the possibility to prove a certain equality and all its higher coherences at the same time.
Remark 3.2.
We have now defined the truncated semisimplicial types , so we may ask whether we can define a (nontruncated) type of semisimplicial types . If we work in the strong 2level theory (where and coincide), we can consider the homotopy limit , defined as
Then, is indeed a (fibrant) type that encodes (Reedy fibrant) functors .
Remark 3.3.
Our Agda formalisation^{3}^{3}3github.com/nicolaikraus/HoTTAgda/tree/master/nicolai/SemiSimp takes place within the fibrant theory. The contribution of the strict equality is completely encapsulated in a single lemma that we postulate without a formal proof. Unfortunately, simulating our 2level system completely in Agda, although possible in principle, would be extremely cumbersome because of the need to keep track of type fibrancy manually.
4. Reedy Fibrant Diagrams Over Inverse Categories
In Section 3, we have defined Reedy fibrant truncated semisimplicial types using our 2level theory. We have stayed in the fibrant theory (HoTT) as much as we could, and only used the strict theory to prove a crucially needed coherence. In this section we want to demonstrate that the 2level theory is even more powerful if we give up this strategy of only working in the fibrant fragment whenever possible. The point is that we can derive results about HoTT without staying inside HoTT, analogous to how one can get results that respect homotopy equivalence even when certain constructions are performed on concrete spaces that only represent homotopy types.
What we claim is that, in a proof assistant implementing a 2level type theory, we could formalize many constructions that are presented metatheoretically in the current literature. In the current section, we will show that Reedy fibrant diagrams have limits in if is a finite inverse category. This is an internalised version of results discussed by Shulman [Shu15]. Of course it generalizes the construction in Section 3, although not “literally”: the truncated semisimplicial types that we get here will look different from those constructed above.
4.1. Essentially Fibrant Pretypes and Strict Fibrations
As a preparation for our “more abstract” sample applications of the 2level theory, we remark that it is often not necessary to know that a pretype is a fibrant type. Instead, it is usually sufficient to have a fibrant type and a strict isomorphism . If this is the case, we say that is essentially fibrant. Clearly, every fibrant type is also an essentially fibrant pretype.
In Section 3, we have made heavy use of the fibrant finite types (for ). In a strong 2level theory, this type coincides with the strict pretype (for ), but this is not in general the case. We say that some pretype is essentially finite if we have a number and a strict isomorphism .
Lemma 4.1.
Let be essentially finite and be a family of fibrant types. Then, is essentially fibrant.
Proof.
Essential finiteness gives us a cardinality on which we do induction. If is , then is strictly isomorphic to the unit type. Otherwise, we have an essentially finite such that , and is strictly isomorphic to , which is essentially finite by the induction hypothesis. ∎
Similar to essential fibrancy, we have the following definition:
Definition 4.2 (strict fibration).
Let be a function (with ). We say that is a strict fibration if we have a family such that the fibre of over any is strictly isomorphic to , that is, .
From now on, we will drop the attribute strict and simply talk about fibrations. Any fibrant type family gives rise to a fibration , as it is easy to see that the first projection satisfies the given condition. Indeed, any strict fibration is isomorphic over to a strict fibration of this form. This often allows us to assume that a given fibration has the form of a projection.
4.2. Strict Categories
We define categories in much the same way as the precategories are defined in [Uni13], except that we use strict equality to express the laws. Since strict equality does not suffer from coherence issues, this notion of category is wellbehaved. It can be applied to structures which do not have fibrant types of objects or morphisms.
Definition 4.3 (strict category).
A strict category is given by: a pretype of objects; for all pairs , a pretype of arrows or morphisms; an identity arrow for every object ; and a composition function for all objects . The usual categorical laws are required to hold strictly, that is, we have strict equalities and , as well as .
We say that a category is essentially finite if the pretype of objects is essentially finite (no condition is put on the arrows).
The usual theory of categories can be reproduced in the context of strict categories. We leave it to the reader to define appropriate notions of functor, natural transformation, limits, adjunctions, and so on.
From now on, we will refer to strict categories simply as categories. If is a category, we will often abuse notation and use itself to denote its type of objects.
Another important notion is the following:
Definition 4.4 (reduced coslice).
Given a category and an object , the reduced coslice is the full subcategory of nonidentity arrows in the coslice category . A concrete definition is the following. The objects of are triples of an , a morphism , and a proof , for all , where denotes the function . Morphisms between and are elements such that in .
Note that we have a “forgetful functor” , given by the first projection on objects as well as on morphisms.
4.3. Inverse Categories
Classically, inverse categories are categories which do not contain an infinite sequence of nonidentity arrows (see [Shu15]). We restrict ourselves to those which have height at most , and where a rank function is given explicitly. First, consider the category which has as objects, and (the function is defined in the canonical way). Then, we define:
Definition 4.5 (inverse category).
We say that a category is an inverse category if there is a functor which reflects identities; i.e. if we have and , then we also have and .
4.4. Reedy Fibrant Limits
Much of what is known about the category of sets in classical category theory can be extended to the category of pretypes in a given universe. For example, the following result translates rather directly:
Lemma 4.6.
The universe , viewed as a category in the canonical sense, has all small limits.
Proof.
Let be a category with and (for all ). Let be a functor. We define to be the pretype of natural transformations , where is the constant functor on . Clearly, , and a routine verification shows that satisfies the universal property of the limit of . ∎
Unfortunately, the category of fibrant types is not as well behaved. Even pullbacks of fibrant types are not fibrant in general (but see Lemma 4.7). If we have a functor , we can always regard it as a functor , where it does have a limit. If this limit happens to be essentially fibrant, we say that has a fibrant limit. Clearly, this limit will then be a limit of the original diagram (note that is a full subcategory of ).
Lemma 4.7.
The pullback of a fibration along any function is a fibration.
Proof.
We can assume that is of the form and is the first projection. Clearly, the first projection of satisfies the universal property of the pullback. ∎
Lemma 4.7 makes it possible to construct fibrant limits of certain “wellbehaved” functors from inverse categories. The socalled matching objects play an important role.
Definition 4.8 (matching object; see [Shu15, Chp. 11]).
Let be an inverse category, and a functor. For any , we define the matching object to be the (not necessarily fibrant) limit of the composition .
Definition 4.9 (Reedy fibrant diagram; see [Shu15, Def. 11.3]).
Let be an inverse category and be a functor. We say that is Reedy fibrant if, for all , the canonical map is a fibration.
Using this definition, we can make precise the claim that we can construct fibrant limits of certain wellbehaved diagrams:
Theorem 4.10 (see [Shu15, Lemma 11.8]).
Let be an essentially finite inverse category. Then, every Reedy fibrant has a fibrant limit.
Proof.
By induction on the cardinality of . In the zero case, the limit is the unit type.
Otherwise, let us consider the rank functor . We choose an object such that is maximal; this is possible (constructively) since is assumed to be essentially finite. Let us call the category that we get if we remove from ; that is, we set . Clearly, is still essentially finite and inverse.
Let be Reedy fibrant. We can write down the limit of explicitly as
(4) 
Using that has no incoming nonidentity arrows, this pretype is strictly isomorphic to
(5)  
Let us write for the limit of restricted to , and let us further write for the canonical map . Further, we write for the map . Then, (5) is strictly isomorphic to
(6) 
This is the pullback of the span . By Reedy fibrancy of , the map is a fibration. Thus, by Lemma 4.7, the map from (6) to is a fibration.
By the induction hypothesis, is essentially fibrant. This implies that (6) is essentially fibrant, as it is the domain of a fibration whose codomain is essentially fibrant. ∎
If is an inverse category, we will denote by the full subcategory of consisting of all those objects of rank less than . Correspondingly, for a given diagram over , we will denote by the restriction of to .
4.5. Fibrant Limits and SemiSimplicial Types
If is a Reedy fibrant diagram over , we can restrict to , then take the limit of the corresponding functor. With a slight abuse of notation, we will denote such limit by , even though is not defined at .
Note that a diagram over is Reedy fibrant if and only if its restriction to is Reedy fibrant and the map is a fibration. Hence, to give a Reedy fibrant diagram over is the same as to give a Reedy fibrant diagram over , together with a fibration over . We will refer to this extended diagram as . By mutual induction on the natural number , we can define a type , and a function from to diagrams over . We start with with and set to the trivial diagram over . Then, we set
Above, we write to mean the type given by Theorem 4.10 which is strictly isomorphic to the matching object of at (which would otherwise only be a pretype).
5. Conclusions and Further Work
In the previous two sections, we have demonstrated how our 2level theories can be used in two ways. First, our framework offers reasonable, easily justifiable ways of extending homotopy type theory. Second, we can internalise results about homotopy type theory that, before, could only be stated metatheoretically. In a suitable proof assistant which implements a 2level theory, we could formalize many constructions that can at the moment only be done on paper. Our current article offers a demonstration of this possibility: we have shown how some of the constructions about fibrant limits and diagrams can be internalised. From here, we could go into several directions. We could, for example, internalise Shulman’s result that diagrams over a model of type theory form again a model, preserving univalence [Shu15]. Of course, for such an internalisation, we need to be careful to formulate all definitions and results constructively.
A more modest but (as we believe) worthwhile next goal is the construction of fibrant replacements. With this, we can internalise the proof that any type carries the structure of an groupoid (a Kan semisimplicial type), as it is given in [Kra15a, Remark and Corollary 16]. To do this, we would first define an groupoid to be a Reedy fibrant semisimplicial type such that every fibration from to a horn is an equivalence (in the sense of homotopy type theory). We can then, for a type , consider the semisimplicial type , defined to be the Reedy fibrant replacement of the functor that is constantly . It is shown in [Kra15a] that is an groupoid in our sense, and the argument can easily be internalised. This construction is in fact not difficult and has in the current paper been omitted solely for reasons of space.
Our next significant project, supported by the 2level theory, is the development of category theory. By an category, which could also be called a Segal type, we mean a Reedy fibrant semisimplicial type for which the usual “Segal maps” are equivalences. It is likely that it is necessary to add degeneracies, and we expect that this can be done in the way presented by Harpaz [Har15].
We believe that it is important to develop a theory of categories typetheoretically, because the universe itself should be an category; we expect that many infinite coherence problems become approachable if we can set up some basic infrastructure, so that towers of coherences could be formulated and handled in a clean way.
The most important application that we currently have in mind is the specification of higher inductive types (HITs). Although HITs are used frequently in the literature on homotopy type theory, we do not have a general syntactical specification yet. The approach to define a general syntactical framework of HITs that is used in [ACDF] seems to be promising, but suffers from the issue that an unmanageable number of coherences needs to be handled manually. We expect and hope that this can be resolved with the framework of categories that we plan to develop.
References
 [ACDF] Thorsten Altenkirch, Paolo Capriotti, Gabe Dijkstra, and Fredrik Nordvall Forsberg. Towards a theory of higher inductive types. Presentation at TYPES’15, Tallinn, Estonia, 20 May 2015.
 [ACK] Thorsten Altenkirch, Paolo Capriotti, and Nicolai Kraus. Infinite structures in type theory: Problems and approaches. Presented at TYPES’15, Tallinn, Estonia, 20 May 2015. Work in progress, working title.
 [AKS15] Benedikt Ahrens, Krzysztof Kapulkin, and Michael Shulman. Univalent categories and the Rezk completion. Mathematical Structures in Computer Science (MSCS), pages 1–30, Jan 2015.
 [BGH] Andrej Bauer, Gaëtan Gilbert, Philipp Haselwarter, Matija Pretnar, and Chris Stone. Andromeda. Implementation of a type theory with equality reflection.
 [Cap16] Paolo Capriotti. Infinite Structures in Homotopy Type Theory. PhD thesis, School of Computer Science, University of Nottingham, Nottingham, UK, 2016. In preparation.
 [Dyb95] Peter Dybjer. Internal type theory. In Types for Proofs and Programs, pages 120–134. Springer, 1995.
 [Har15] Yonatan Harpaz. Quasiunital –categories. Algebraic & Geometric Topology, 15(4):2303–2381, 2015.
 [Her15] Hugo Herbelin. A dependentlytyped construction of semisimplicial types. Mathematical Structures in Computer Science, pages 1–16, Mar 2015.
 [Hof95] Martin Hofmann. Conservativity of equality reflection over intensional type theory. In Stefano Berardi and Mario Coppo, editors, Types for Proofs and Programs (TYPES), volume 1158 of Lecture Notes in Computer Science, pages 153–164. SpringerVerlag, 1995.
 [Hof97] Martin Hofmann. Syntax and semantics of dependent types. In Semantics and Logics of Computation, pages 79–130. Cambridge University Press, 1997.
 [HS96] Martin Hofmann and Thomas Streicher. The groupoid interpretation of type theory. In In Venice Festschrift, pages 83–111. Oxford University Press, 1996.
 [KLV12] Krzysztof Kapulkin, Peter LeFanu Lumsdaine, and Vladimir Voevodsky. The simplicial model of univalent foundations. ArXiv eprints, Nov 2012.
 [Kra15a] Nicolai Kraus. The general universal property of the propositional truncation. In Hugo Herbelin, Pierre Letouzey, and Matthieu Sozeau, editors, 20th International Conference on Types for Proofs and Programs (TYPES 2014), volume 39 of Leibniz International Proceedings in Informatics (LIPIcs), pages 111–145, Dagstuhl, Germany, 2015. Schloss Dagstuhl–LeibnizZentrum fuer Informatik.
 [Kra15b] Nicolai Kraus. Truncation Levels in Homotopy Type Theory. PhD thesis, School of Computer Science, University of Nottingham, Nottingham, UK, 2015.
 [Lum10] Peter LeFanu Lumsdaine. Higher Categories from Type Theories. PhD thesis, Carnegie Mellon University, 2010.
 [Lur09] Jacob Lurie. Higher Topos Theory. Annals of Mathematics Studies. Princeton University Press, Princeton, 2009.
 [Mai09] Maria Emilia Maietti. A minimalist twolevel foundation for constructive mathematics. Annals of Pure and Applied Logic, 160(3):319 – 354, 2009. Computation and Logic in the Real World: CiE 2007.
 [PL15] Fedor Part and Zhaohui Luo. Semisimplicial types in logicenriched homotopy type theory. CoRR, abs/1506.04998, 2015.
 [Shu] Michael Shulman. Homotopy type theory should eat itself (but so far, it’s too big to swallow). Blog post, homotopytypetheory.org/2014/03/03/hottshouldeatitself.
 [Shu15] Michael Shulman. Univalence for inverse diagrams and homotopy canonicity. Mathematical Structures in Computer Science, pages 1–75, Jan 2015.
 [Uni13] The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. homotopytypetheory.org/book, Institute for Advanced Study, 2013.
 [vdBG11] Benno van den Berg and Richard Garner. Types are weak groupoids. Proceedings of the London Mathematical Society, 102(2):370–394, 2011.
 [Voe13] Vladimir Voevodsky. A simple type system with two identity types, 2013. Unpublished note.