Cubical Methods in Homotopy Type Theory and Univalent Foundations

Cubical methods have played an important role in the development of Homotopy Type Theory and Univalent Foundations (HoTT/UF) in recent years. The original motivation behind these developments was to give constructive meaning to Voevodsky’s univalence axiom, but they have since then led to a range of new results. Among the achievements of these methods is the design of new type theories and proof assistants with native support for notions from HoTT/UF, syntactic and semantic consistency results for HoTT/UF, as well as a variety of independence results and establishing that the univalence axiom does not increase the proof theoretic strength of type theory. This paper is based on lecture notes that were written for the 2019 Homotopy Type Theory Summer School at Carnegie Mellon University. The goal of these lectures was to give an introduction to cubical methods and provide sufﬁcient background in order to make the current research in this very active area of HoTT/UF more accessible to newcomers. The focus of these notes is hence on both the syntactic and semantic aspects of these methods, in particular on cubical type theory and the various cubical set categories that give meaning to these theories.


Introduction
This paper is based on lecture notes for a course given at the 2019 Homotopy Type Theory Summer School at Carnegie Mellon University in Pittsburgh. a The course covered the basics of cubical type theory with its semantics in cubical sets and this paper closely follows the structure a This course was in turn based on a series of lectures given at Inria Sophia Antipolis in May 2017. Those lectures covered the basics of cubical type theory through the cubicaltt system and the lecture notes can be found at: https://github.com/mortberg/cubicaltt/tree/master/lectures of the course. This paper is hence not meant to be a regular research paper with new results, but rather an exposition of cubical type theory and cubical set models. These new type theories provide computational justifications to Homotopy Type Theory and Univalent Foundations (HoTT/UF), in particular, the univalence axiom of Voevodsky (2014) is provable and has computational content. This can therefor be seen as a fully constructive foundation for HoTT/UF, well-suited for computer implementation.
The univalence axiom of Voevodsky (2014) is at the center for HoTT/UF and provides a type theoretic rendering of the idea that all constructions should be invariant up to some form of equivalence. This is very common informal practice in mathematics, for instance a mathematician typically makes no distinction between the quotient ring R/(0) and R itself even though they formally are different objects. It is also common in computer science to think of two equivalent implementations of an abstract interface as the same. The univalence axiom makes this practice formal by enabling the identification of these objects in type theory. This way the difference between informal mathematical practice and formalized mathematics can be reduced.
Another interesting aspect of the univalence axiom is that it solves many problems related to the lack of extensionality principles in intensional type theory. For instance, both function extensionality (pointwise equal functions are equal) and propositional extensionality (logically equivalent propositions b are equal) are consequences of univalence. Furthermore, one can use it to construct well-behaved quotient types (Voevodsky, 2015;Univalent Foundations Program, 2013). These notions have so far been missing from most type theories, leading to many difficulties in formalizing modern mathematics.
However, while the univalence axiom makes type theory more appealing for formalizing mathematics it also breaks some of the good properties of type theory. In particular, by adding univalence axiomatically one loses canonicity. That is, one can easily construct terms of natural number type in closed context that do not reduce to a numeral. As a consequence, this also breaks existence properties: even if an existence statement is proved using a Σ-type one cannot necessarily extract a witness. This means that adding the univalence axiom, at least a priori, breaks the constructive nature of type theory.
This led multiple researchers on a quest to find a constructive justification to the univalence axiom in order to get the extensionality principles of univalence without loosing good type theoretic properties like canonicity. The consistency of the univalence axiom was originally proved by Voevodsky's Kan simplicial set model (Kapulkin and Lumsdaine, 2012). However, this model used classical logic in crucial ways (Bezem et al., 2015) which led experts to look in different directions for a constructive model. The first major breakthrough was when Bezem et al. (2014) formulated the first cubical model of HoTT/UF which constituted the starting point of the use of cubical methods in HoTT/UF. This paper introduces cubical methods in HoTT/UF by focusing on the cubical type theory developed by Cohen et al. (2018). This type theory builds on a cubical model of HoTT/UF that has a lot more structure than the original one of Bezem et al. (2014). This additional structure simplifies the model construction and made it possible to formulate a type theory inspired by it. This paper also discusses another class of models and type theories based on cartesian cubical sets (Angiuli et al., 2021a(Angiuli et al., , 2018bAwodey, 2018). For a more comprehensive historical account of the various cubical set models and type theories we refer the interested reader to (Angiuli et al., 2021a, Section 1).
Outline. The paper first introduces both the type theoretical and semantical setting in which the rest of the paper is formulated (section 2), it then continues with a general introduction to cubical type theories and their models (section 3), followed by a discussion of the cubical transport operation and why it is not sufficient to get a constructive model of HoTT/UF (section 4), this then naturally leads to the more general cubical Kan composition operations that lets us correct the sides of transported elements (section 5), and finally, in order to be able to prove the univalence axiom and give it computational content Glue types are introduced (section 6). The paper then concludes with some suggestions for further reading about cubical methods in HoTT/UF (section 7). Furthermore, most sections end with exercises that complement the material and which were given to the students during the summer school. Suggested solutions to most exercises can be found in appendix A.
Assumed background knowledge. These lectures notes are aimed at students and researchers with some familiarity with dependent type theory and category theory. There are not many textbooks on type theory out there, however a classic is the book by Nordström et al. (1990). Another good introduction which goes into the categorical semantics of type theory are the notes by Hofmann (1997). The situation for category theory is much better as it is an older field. These notes don't require that much categorical background apart from familiarity with presheaves and the Yoneda lemma. An excellent introduction to these concepts with lots of examples can be found in the book by Riehl (2017, Chapter 1 and 2.1-2.2). In order to get a deeper understanding of lifting problems and the content of section 5.4 see (Riehl, 2014, Chapter 11), but beware that this requires much more categorical background than the rest of the material and are not necessary unless one wants to study the homotopy theoretical aspects of the field.

Background
Homotopy Type Theory and Univalent Foundations, as formulated by Voevodsky ( , 2011Voevodsky ( , 2014Voevodsky ( , 2015 and in the HoTT book (Univalent Foundations Program, 2013), are axiomatic extensions of type theory initially developed by the Swedish logician Per Martin-Löf. There are multiple different type theories of this kind, see e.g. (Martin-Löf, 1975, 1982, 1998, and we will here use the term "Martin-Löf type theory" (MLTT) for type theories specified in the MLTT tradition. That is, type theories specified by the four hypothetical judgments: We write Γ J for an arbitrary judgment and in the rest of the paper we assume that the type theories we work with support Π-and Σ-types. We follow the Agda convention (introduced by Nuprl (Constable et al., 1985)) of writing dependent function types as (x : A) → B and dependent products as (x : A) × B. The non-dependent variants of these are written A → B and A × B. We write p.1 and p.2 for the first and second projections of a pair p : (x : A) × B. We also assume Πand Σ-types satisfy judgmental η rules: We say that an equality holds "judgmentally" if it is a judgmental equality specified by the type theory, i.e. if the judgment Γ a = b : A is derivable in the theory. Note that many authors refer to this as "definitional equality", however we prefer the term "judgmental equality" as it is more specific to the MLTT formalism. We will refer to the semantic version of this judgment as a "strict equality", i.e. an equality that holds strictly in some model of the theory.
We also assume an infinite hierarchy of universes U n , however we will leave the universe level n implicit and not be specific about the exact rules that these universes satisfy in order to avoid formal technicalities. Basic datatypes like empty, unit, boolean, and natural number types are also assumed and inhabit the lowest universe U 0 . We will write functions on these using patternmatching equations, however all examples can easily be translated to recursors and eliminators.
One can also imagine extending with general inductive types or W-types, but we won't focus on these here as the cubical machinery extends very straightforwardly from the basic inductive types and it is more illustrative to look at concrete examples instead of the general case. However, the situation for inductive families (a.k.a. indexed inductive types) is more subtle and we refer the interested reader to (Cavallo and Harper, 2019) and (Vezzosi et al., 2021, Section 4) for details.
However, we do not include Martin-Löf (1975) identity types as in HoTT/UF. We will instead consider path types that behave like identity types, but which are not inductively generated. This is achieved by first adding an abstract interval type I and then defining paths in a type A as functions I → A with fixed endpoints. In this sense cubical type theory is even closer to the homotopical intuition that motivates HoTT/UF-equalities are really defined to be paths. The main part of the work will then be to extend the theory so that path types behave like identity types, in particular making the path elimination principle J provable with computational content. The first attempt to solve this is by introducing cubical transport operations, however, it turns out that these are not sufficient as we cannot properly define them for path types themselves. This then leads to the more general Kan composition operations that exist in some form in all cubical type theories and cubical set models.
This, or some variation of it, is essentially the underlying type theoretic setup in the various cubical systems that have been implemented in recent years. These include cubical (2013), cubicaltt (2015), yacctt (2018), RedPRL (2016) (Angiuli et al., 2018a), redtt (2018), cooltt (2020), mlang (2019) and Cubical Agda (Vezzosi et al., 2019). All of these systems build on different cubical type theories and have different standard cubical models (Bezem et al., 2014;Bezem et al., 2018;Cohen et al., 2018;Angiuli et al., 2018bAngiuli et al., , 2021aCoquand et al., 2018;Cavallo and Harper, 2019), however the ideas underlying them are very similar and one of the goals of this paper is to give sufficient background to understand and work with the various systems. This paper will mainly present the theory underlying Cubical Agda, but many of the ideas and constructions translate directly to the other systems.
The cubical type theories underlying these systems are typically justified using categorical semantics in various cubical set categories. These are often formulated using one of the many frameworks for semantics of MLTT, like the categories with families (CwF's) of Dybjer (1996). We will be informal in these notes and not commit to a specific framework. However, a crucial result that we will rely on is the fact that any presheaf category forms a CwF (or some other equivalent notion of model) with Π-, Σ-types, and basic datatypes like natural numbers, together with universes closed under these type formers. These results can be found in the lecture notes of Hofmann (1997) and the unpublished note about universes by Hofmann and Streicher (1997).
An elegant way of describing the semantics of cubical type theory and HoTT/UF is to use the internal language of the presheaf topos of cubical sets, following Orton and Pitts (2018). This approach builds on an idea of Coquand (2015) and another early use of the technique can be found in the work of Birkedal et al. (2018). As these categories are locally cartesian closed this internal language is extensional type theory (Lambek and Scott, 1986), which means that the semantics can be presented using type theoretic notations. In order to avoid confusion we write Π(x : A).B and Σ(x : A).B for the semantic versions of dependent function and product types. For the strict extensional equality in the internal language we write x ≡ y given x, y : A. This lets us mimic many of the syntactic constructions from cubical type theory also in the semantics, leading to very short and elegant constructions. However, it is sometimes illuminating or even necessary to express things externally, i.e. present the semantics using standard categorical language. We will in the paper make it clear when the semantics is described internally or externally.
The main aim of these notes is to present cubical type theories and their models up to the computational realization of univalence. The cubical version of this principle informally states that the type of equivalences of types A and B is equivalent to the type of paths between A and B.
This in particular means that we have a function Combined with cubical transport this gives a way to transport structures between equivalent types. For example, if we have a monoid structure on unary numbers we can transport it to get a monoid structure on binary numbers. The fact that univalence has computational meaning then means that this transport will actually compute as expected.

Cubical type theories and their models
The crucial idea in order to make a type theory cubical is to add a primitive interval I and allow the judgmental structure of the theory to also include contexts with interval variables. Intuitively one may think of I as a formal analogue of the real interval [0, 1] ⊂ R. A variable i : I should be thought of as a point that is varying continuously between the two distinct endpoints 0 : I and 1 : I: By extending the judgmental structure of MLTT with these variables we get cubical judgments of the form i 1 : I, ..., i n : I J Given a judgment J depending on an interval variable i : I we write J (r/i) for J with r substituted for i. So A(0/i) is a type where 0 has been substituted for i, etc. These substitutions act like regular substitutions, so in particular they behave in the standard way with respect to binders and commute with all type and term formers of the theory. Types and terms in a context with n dimension variables correspond to n-dimensional cubes as described in table 1. By the standard rules for substitutions we have A(0/i)(0/ j) = A(0/ j)(0/i), etc. These equations correspond to the lines in the square matching up, namely the source of the left-most line, A(0/i) is the same as the source of the bottom one in the square, A(0/ j), in the third row of the table 1.
Remark 1. Note that any judgment in cubical type theory can be put in the above form. Indeed, given a judgment Γ J where Γ contains both interval variables i : I and regular variables x : A in any order we can always first reorganize it so that the interval variables occur first and the regular variables occur last (weakening appropriately with respect to the interval variables). The regular variables can then be λ -abstracted so that we only have interval variables left in the context. Focusing on the cubical judgments of the above form is hence not a restriction and as it simplifies the explanations we will focus on them in this section, however in later sections Γ denotes an arbitrary context with both interval and regular variables unless explicitly specified.

Cartesian cubical sets
Semantically all cubical set models are based on presheaves on some cube category C , i.e. functor categories C := [C op , Set]. This means that a cubical set G : C is simply a functor C op → Set and hence comes with both an action on the objects of C op (which are the same as those of C ) and the morphisms of C op (which are the same as those in C , but reversed). So given an element of X : C we get a set G(X) and given a morphism f : Hom C (X, Y ) we get a function of sets G( f ) : G(Y ) → G(X). As G is a functor it furthermore has to send the identity morphism 1 X : Hom C (X, X) to the identity function 1 G(X) : G(X) → G(X) and composition of morphisms g • f to composition of functions G( f ) • G(g).
One way to think about presheaves is as indexed sets with extra structure. Indeed, a special case is when C is some small discrete category I, i.e. a category where the collection of objects is a set and the only morphisms are the identity morphisms. A presheaf G : I is then nothing but an indexed family of sets (indexed by the objects of I). Now, if C happens to not be discrete and have more morphisms than the identity morphisms then we get induced maps between the indexed sets. Presheaves are hence a compact way of describing a collection sets indexed by the objects of a category, together with functions between them respecting composition. So in order to specify a cubical set model we first have to give a suitable cube category specifying what to index our cubical sets by and which functions we should be able to manipulate these with.
A very important cube category is the cartesian one.
Definition 2. The cartesian cube category has as objects finite sets, and as morphisms Hom (I, J) functions J → I + {0, 1} with identity and composition given by The reason I and J are flipped in the functions in the above definition is that we will take the opposite of this category when defining cartesian cubical sets. In the rest of the notes we will omit the inl/inr maps for readability as they can easily be inferred. Furthermore, note that the composition operation is the Kleisli composition for the monad + {0, 1} : → . We will use the more compact description using the Kleisli category when introducing other cubical set categories later in the paper, but this can always be unfolded into an explicit definition as in the definition above.
We write I, J, K, ... for objects of , and say that a finite set {i 1 , . . . , i n } is an n-cube of dimensions i 1 , . . . , i n . Notable morphisms in the category include: • Given ε ∈ {0, 1}, a dimension i and a finite set I there are face maps • Given a dimension i and a finite set I there are degeneracy maps • Given dimensions i, j and a finite set I there are symmetry maps • Given dimensions i, j and a finite set I there are diagonal maps These morphisms satisfy various evident cubical identities, e.g. degenerating and taking a face does nothing. We illustrate the actions of these maps informally for concrete n-cubes in table 2.  A cartesian cubical set is a functor G : . Geometrically we may think of such a G as a space and G({i 1 , . . . , i n }) as the set of continuous functions [0, 1] n → G. With this in mind we can give some geometric meaning to the action of G on the morphisms of . The face maps G(d i ε ) : G(I + {i}) → G(I) restrict (n + 1)-cubes to n-cubes by setting the i coordinate to ε. The degeneracy maps G(s i ) : G(I) → G(I + {i}) lets us regard n-cubes as (n + 1)-cubes. The symmetry maps rotate cubes by permuting the axes. Finally, the diagonal maps extract the various diagonal n-cubes of (n + 1)-cubes.

Faces
Let : → be the Yoneda c embedding defined at an object I ∈ as (I) = Hom ( , I). At a morphism f : Hom (I, J) it is defined as precomposition of f with g : Hom ( , I), so ( f )(g) = f • g. The interval of cubical type theory is modeled by ({i}) where i is an arbitrary dimension. We write I for this representable 1-cube (a representable cubical set is one which is in the image of ). An important property of cartesian cubical sets is that the product of representables is again representable. d Combined with the fact that preserves products we get that the representable n-cube is an n-fold product of I, i.e. ({i 1 , . . . , i n }) ∼ = I n . The category is in fact the universal category with this property: Remark 3. The category is equivalent to the free finite product category on an interval object (Parker, 2014;Awodey, 2018).
The Yoneda lemma is probably the most used result in category theory. In the case of a cartesian cubical set G it states that we have a bijection G({i 1 , . . . , i n }) ∼ = I n → G. In other words, the n-cubes of G are in bijective correspondence with the set of natural transformations I n → G. This means that the structure of a cartesian cubical set is determined by maps out of products of I, justifying the geometric intuition from above where we thought of G as a space and G({i 1 , . . . , i n }) as the set of continuous functions [0, 1] n → G. Furthermore, a type i 1 : I, . . . , i n : I A : U corresponds to a morphism A : I n → U , justifying the cubical judgments. This is one reason why cartesian cubical sets are so well-suited as a basis for higher dimensional type theory.

Cubical set models
It is a well-known fact that any presheaf category forms a model of type theory (Hofmann, 1997, Section 4). This hence directly applies to the cubical set category discussed above. In this model a context Γ is modeled by a cartesian cubical set G and a substitution σ : ∆ → Γ is modeled by a natural transformation of cubical sets s : D → G. A type in context Γ is also modeled by a presheaf, but on the category of elements of G. The category of elements, written G, is a general construction on a presheaf category which gives a new category where the objects are of the form (I, ρ) with I : and ρ : G(I). A type is hence modeled by a presheaf on G. With these definitions one can prove that can be organized into a CwF with structure corresponding to Π-, Σ-types, basic datatypes and universes closed under these operations. This means in particular that we have a context extension operation which given presheaves G : and A : G gives us an extended semantic context G.A : as well as a weakening map p : G.A → G. Terms of the type theory are then modeled as sections of p.
Remark 4. An important, but subtle, fact is that by working with types represented as objects of G we avoid coherence problems related to equations between substitutions on types and c The symbol " " is hiragana for "yo". d This is not true for simplicial sets where the product of representables has to be subdivided in order to form a simplicial set again. The problem boils down to simplices not being closed under products, e.g. I × I is a square which has to be subdivided into two triangles glued together along the diagonal in order to be realized as using simplices. terms only holding up to isomorphism. A classical result in category theory is that G /G, so presheaves on the category of elements of G is equivalent to the slice category over G. Types could hence just as well be modeled by objects of /G, but this has the drawback that substitution would be defined as a pullback which is only unique up to isomorphism. This means that if we would substitute with σ : ∆ → Γ and then δ : Θ → ∆ in A we would not get strictly the same thing as if we would substitute with δ • σ : Θ → Γ directly. This is a well-known problem which arises in models of type theory in locally cartesian closed categories (Seely, 1984) and various solutions exist to solve it (Curien, 1993;Hofmann, 1994;Voevodsky, 2009;Clairambault and Dybjer, 2011;Curien et al., 2014;Lumsdaine and Warren, 2015). However, in the case of presheaf categories like this problem can completely be avoided by instead representing types as objects in G where substitution can simply be defined as precomposition and hence satisfy the required equations strictly by definition.
After this short introduction to presheaf models of type theory we can now clarify the relationship between the proof theory of cubical type theory and its semantics. Given an n-cube I = {i 1 , . . . , i n } and context Γ = i 1 : I, . . . , i n : I there is a close correspondence between the structural rules of cubical type theory and the semantic maps of cubical sets as illustrated in table 3. Table 3. Relationship between structural rules and semantic maps.

Syntax/proof theory Semantics
Recall that the action of on morphisms is precomposition, so the judgments on the left are given by precomposing with the maps on the right. The table shows that there is a close correspondence between the maps in the cartesian cubical set categories and the structure of the cubical judgments in cubical type theory. This correspondence was analyzed by Buchholtz and Morehouse (2017) to define and relate a great variety of cubical set categories.
Remark 5. If we omit contraction/diagonals we obtain the substructural cubical sets that underlie the original cubical set model of Bezem et al. (2014). However, because of the substructural nature of this cube category it is not as easy to develop a cubical type theory based on this model (even for non-cubical type theories substructural dependent type theory is an active research area). It also not clear how to interpret eliminators for HITs in this cubical set model. In the rest of the paper we hence focus on structural cubical sets with contraction/diagonals.

Path types
In order to be able to talk about paths between terms and between types in cubical type theory we need to extend the theory with path types. These types are a type theoretic rendering of the idea that a path is just a function out of the interval in cubical type theory. The rules for these follow below.
Note that these rules are very similar to those of Π-types, except that special care has to be taken when applying a path to one of the endpoints of the interval. So just like how Π-types "internalize" the usual variables of type theory the path types let us internalize the interval variables of cubical type theory.
If A doesn't depend on i we write simply Path A a b. These non-dependent path types are supposed to correspond to the identity types of HoTT/UF while Path i is a cubical version of the "path-over" types of HoTT, i.e. paths living over a line of types. These path-over types are descendants of the work of McBride (2002) on heterogeneous equality in type theory (i.e. equalities between terms of different types). Having built-in path-over types is very useful, especially when working with higher inductive types, as we can directly represent heterogeneous equalities. Furthermore, representing equalities using path types allows direct definitions of many standard operations on identity types that are usually proved by path induction.
For example, given A : U we define a proof of reflexivity as a constant path (i.e. a constant function): We will in the rest of paper sometimes write just refl when the a can be easily inferred.
Remark 6. Note that, as opposed to identity types, the path types are not inductively generated. This means that we have to be able to prove both refl and J (path induction).
Given A, B : U we can also prove that the images of two path-equal elements are path-equal This operation satisfies some judgmental equalities that do not hold judgmentally when ap is defined using identity elimination on p, for example (omitting the a and b arguments): The fact that we get these equations judgmentally is very useful when formalizing mathematics. Note that the standard equation ap f (refl a) = refl ( f a) also holds judgmentally as refl a is just a constant function.
We can also define new operations that doesn't always hold for identity types, for instance, function extensionality for path types can be proved as: To see that this has the correct boundaries we do the following computation: Note that the last judgmental equality holds by the η rule for Π-types. The case for the right endpoint (i.e. when applying funExt to 1) holds by an analogous computation.
Even though we can define a funExt constant it is often more convenient to inline it. In HoTT/UF propositions are defined as types satisfying a predicate that says that all elements are path-equal: A basic result of HoTT/UF, which uses function extensionality, is that propositions are closed under Π-types.
Note that we have inlined the use of funExt here. In fact, we are implicitly using funExt for dependent functions in order to prove this, but with path types there is no difference in the proofs of the dependent and non-dependent version. For details see exercise (5).
Equality reasoning in Σ-types is notoriously complicated to work with in MLTT, but with dependent path types things get more manageable. Given A : U and a family B : Working with path-over types like this is very convenient as no transports are necessary, making reasoning with equalities in Σ-types a lot easier than in traditional MLTT. In particular, the inverse of Σ eq can be defined as The fact that Σ eq and Σ − eq are mutually inverse is proved by refl as we have judgmental β and η rules for the involved types. Being able to pass seamlessly between paths in Σ-types and Σ-types of paths is an easily overlooked benefit of having path types.
Semantically we can justify path types using the internal language of . Given a line of types A : I → U we define: We then define the type of paths between a : A 0 and b : A 1 as It is easy to verify that this satisfies the rules of path types as they are constructed using semantic Π-and Σ-types. Furthermore, the exact same operations as above are easily definable semantically.

Connections and reversals
It is often very useful to assume more structure on the underlying cube category, both when constructing models and for making proofs simpler in the cubical type theory based on the model. This is the done in both cubicaltt and Cubical Agda which are based on the cube category of the CCHM cubical set model of Cohen et al. (2018). Before defining this category we have to introduce De Morgan algebras: We write DM for the monad on the category of sets associating to each set A the free De Morgan algebra on A. This category has all the morphisms of , but there are very many more (see exercise (8)). Notable new morphisms in this category are: • Given a dimension i and a finite set I there are connection maps • Given a dimension i and a finite set I there are reversal maps: The connections can be thought of as new kinds of degeneracies while the reversals let us invert lines as illustrated in table 4. The action of the reversal map is, as the name suggests, to reverse a path. However, the connections might look a bit funny at first. However, if one thinks of them as new types of degeneracies they're less strange. As discussed above, the usual degeneracy map s i can be thought of an operation which turns a path p from a to b into a square: Reading this as a commutative diagram of paths this represents a proof that refl · p = p · refl (where · is composition in diagrammatic order). The connections analogously represent proofs that refl · p = refl · p and p · refl = p · refl. This might not seem very useful, but note that we have not yet defined general composition of paths. So by adding operations to the cube category we get the possibility of getting fillers to certain squares representing compositions directly. We will soon see that this lets us prove some results about path types which would normally require path induction. Furthermore, combining connections with reversals allows us to fill many squares, e.g. the one corresponding to p · p −1 = refl · refl (see exercise (6)).
The interval in DM is defined in the same way as the one in using the Yoneda embedding. We may see the connection and reversal morphisms in DM as operations in DM of type ∧, ∨ : I → I → I and ¬ : I → I satisfying the axioms of a De Morgan algebra. The topological intuition behind these operations is that r ∧ s corresponds to min(r, s), r ∨ s to max(r, s) and ¬r to 1 − r for r, s ∈ [0, 1].
Remark 9. One might wonder why De Morgan algebras and not Boolean algebras? The reason is that Boolean algebras do not describe the theory of the real interval. Indeed, the equations r ∧ ¬r = 0 and r ∨ ¬r = 1 are not generally true for r ∈ [0, 1] with the above interpretation except for at the endpoints. However, despite the interval in Boolean algebras not satisfying the same axioms as the real interval there is no problem with constructing a model using it.
Type theoretically we may now substitute interval variables for formulas built using connections and reversals in order to construct more complex cubes out of simpler ones. For example, given p : Path A a b and i, j : I we can construct the connection squares p (i ∧ j) and where, for instance, the right-hand side of the left square is computed as The ability to directly construct squares with boundaries given by the formulas that can be formed in a De Morgan algebra is very convenient. An example of this is the proof that singletons are contractible, that is: any element in (x : A) × (Path A a x) is path-equal to (a, refl).
Obviously the first component is a path between a and b. The second component is a path from λ ( j : I). p 0 to λ ( j : I). p j, i.e. from refl to p by the computation and η rules for path types.
Given a, b : A we may also define the symmetry of a path as follows: This satisfies sym (sym p) = p judgmentally. This is another example of an equation that doesn't hold judgmentally when sym is defined by induction on p and is useful when formalizing mathematics, for example we may directly define the opposite of a category so that C op op = C judgmentally.
With this new additional structure the path types almost behave like the identity types of HoTT/UF, however we need to add additional structure that lets us prove the path-elimination principle commonly referred to as J following Martin-Löf (1975).

Exercises
(1) Prove that {i} × { j} ∼ = {i, j} in (for distinct i and j). More generally, prove that has finite products. (2) Given a, a : A and b, b : B, prove the binary version of ap: (3) Given f , g : A → B → C, prove the binary (non-dependent) version of funExt: Given p : Path A a b and i, j, k : I, draw the cubes corresponding to i.
(10) The circle S 1 has constructors base and loop : I → S 1 such that loop 0 = loop 1 = base. Why is this type non-trivial even though λ (i j : I). loop (i ∧ j) constructs a square whose (i = 0) and (i = 1) sides are refl base and loop? (Hint: what are the other sides of the square?) (11) As i ∧ ¬i is not necessarily 0 in a De Morgan algebra we can construct a path that goes halfway around the circle and back by writing λ (i : I). loop (i ∧ ¬i) (recall that i ∧ ¬i corresponds to min(i, 1 − i)). Construct a homotopy on the circle that shows that this path is contractible: hmtpy : Path (Path S 1 base base) (refl base) (λ (i : I). loop (i ∧ ¬i)) (12) Prove that it is inconsistent to assume decidable equality of I internally. (Hint: construct a path from the unit type to the empty type using decidable equality on I)

Cubical transport
In order to be able to prove the path induction principle J we will introduce a new operation that we call cubical transport. Type theoretically it can be described by the rule: One way to intuitively understand this operation is as an operation for transporting a point from one endpoint to the other over a line of types: An alternative definition (taken by Cubical Agda for instance) is to require that A is a path-abstraction. There is no deep reason for doing this either way, except that when working informally on paper the author finds it easier to have transport act as a binder (but other experts disagree with this). However, when implementing a proof assistant based on this theory it is typically easier to have as few binders as possible.

Recovering HoTT/UF transport and path induction
Readers familiar with HoTT/UF will probably be surprised by the type signature of cubical transport. It is indeed different from what is called "transport" in HoTT/UF. The HoTT/UF transport operation takes a type family P : A → U , a path a = b in A, and gives a function P a → P b. The cubical transport operation on the other hand takes a line A : I → U and gives a function A(0/i) → A(1/i). This more primitive transport operation does however imply the HoTT/UF transport operation, which we refer to as "subst" in order to avoid confusion: With this we can now prove the path induction principle J. Indeed, it may in fact be decomposed as contractibility of singletons (which we have proved in the previous section) and subst: With this we can now do similar reasoning as in HoTT/UF. For example path composition and its properties can be derived from J. Furthermore, we can represent structures on types using Σ-types (or records if we would have them) and transport properties between structured types. Example 4.1. We can define what it means for a type to be a monoid as a nested Σ-type as follows: The first four fields are the identity constant and binary operation of the monoid together with their standard laws. The final field makes sure that the type is a set in the HoTT/UF sense, i.e. that its path type is a proposition (see exercise (6) for the formal definition). Using subst we can now get a function for transporting monoid structure between path-equal types: Concretely A could be unary natural numbers N and B binary numbers B. This means that we can transport the monoid structure on N to B given a path between these two types. We will see that such a path can be constructed using univalence in example 6.1. This hence means that we will get an induced associative and unital binary operation on binary numbers from the one on unary numbers.
With what we have seen so far we can hence formalize many results of HoTT/UF, however we still haven't given these notions computational meaning. For example, how should the transported monoid operation on binary numbers compute? It is easy to imagine how it could compute, but as the underlying cubical transport operation has no judgmental computation rules yet this function would be stuck when given concrete binary numbers. Furthermore, as P in subst can be any predicate valued in U and not just isMonoid we need to give judgmental computation rules to cubical transport which handle all of the type formers of the theory.
Another problem is that it's not yet possible to prove the standard computation rule for path induction which says that we have a path: Indeed, if we unfold the left hand side we see that we have to construct a path: However, there is currently no reason why this would be the same as d for all type families C. One could try to add a computation rule which says that transport i A a is judgmentally a if i doesn't occur A, but this does not help with making the monoid example above compute properly. It is in fact currently an open problem whether the above path can in fact be proved by refl d while also having well-behaved computation rules for the rest of the theory. This is commonly referred to as the "regularity problem" in cubical type theory and constructive cubical models. A solution to this problem would be a major breakthrough, but there are some negative counterexamples by Swan (2018) which suggest that it might in fact be impossible to achieve this.
All currently existing cubical type theories and constructive cubical models circumvent this problem by not requiring the above path to be provable by refl d, but rather carefully setting things up so that it can be proved by a slightly more involved path. Achieving this while still giving wellbehaved computation rules to the theory is really the main technical part of constructing a cubical type theory and constructive cubical models. We will now look at how this can be achieved for cubical transport for some basic type formers.

Judgmental computation rules for cubical transport
In order to give the cubical transport operation computational meaning we have to add computation rules for it to the theory. This is done by adding judgmental equalities for the different type formers. For instance, for non-dependent pairs A × B we define: It is easy to see that this is a well-defined judgmental equality by checking that the right hand side has the correct type.
For function types A → B we need to be able to transport backwards as well. That is, given a : A(1/i) we want an element in transport ¬i A a : A(0/i): Using a reversal we can define this as: To do this we first abstract over x : A(1/i) and transport it backwards to get an element transport ¬i A x of type A(0/i). We then apply f and obtain an element in B(0/i) which can be transported forward in B to get the desired element of B(1/i). We can summarize this construction in the computation rule: For basic datatypes A without parameters we can let transport i A be the identity function, e.g. for natural numbers we have transport i N n = n. This makes sense as N(r/i) = N for any r : I. For parameterized datatypes (like A + B or List A) we can define the cubical transport operation for each constructor (see exercise (2)). This generalizes directly to W-types and schemas for inductive types. However, as discussed in section 2, the situation for inductive families is more subtle and has recently been worked out for a type theory similar to the one in these notes by Vezzosi et al. (2021, Section 4)

by building on work by Cavallo and Harper (2019).
Remark 10. Note that there is a choice in how cubical transport behaves for pair and function types. We could instead have treated these transports as neutral values that don't reduce further unless we either apply a projection or apply them to something. We call these the negative definitions of transport as the computation rules are defined using eliminators, while the ones we gave above are the positive definitions.
We now need to define cubical transport for Path types. Given Γ, i : I Path A a b and p : (Path A a b)(0/i) we are going to construct an element of (Path A a b)(1/i). Consider the following naive definition (where j is a fresh dimension variable): This might look like a plausible definition, but the resulting path does not have the right endpoints! Indeed, when j is 0 this is transport i A a and not a(1/i). We run into similar problems when trying to naively define cubical transport for Π-and Σ-types (see exercise (3)). The way we solve this, following Cohen et al. (2018), is to generalize cubical transport and instead consider more general composition operations.

Exercises
(1) Give the negative definition of cubical transport for A × B.
(2) Define cubical transport in sum types A + B. (Hint: pattern-match on the constructors) (3) Try to define cubical transport for Σ-and Π-types and see what problems you run into.

Kan composition operations
In order to solve the problem with cubical transport for path types we introduce a generalized cubical transport operation that also lets us fix the boundary of the transported element. Given p : (Path A a b)(0/i) we write this as: This is a path in A(1/i) where the boundary has been fixed to be a and b. The syntax of the comp operation is the same as the one for cubical transport, except that it also takes a list of faces (written in general as [( j 0 = ε 0 ) → a 0 , . . . , ( j n = ε n ) → a n ]) that has to match up with p j. In the above example the list of faces is [( j = 0) → a, ( j = 1) → b] and these match up with p j as p is a path between a and b so that (p j)(0/ j) = p 0 = a and (p j)(1/ j) = p 1 = b.
We refer to this operation as Kan composition and, as explained above, it is a form of cubical transport where we can fix the sides of the transported element. We can illustrate the above example diagrammatically as follows: The vertical sides in the drawing are going in direction i while the bottom (or "base") is going in direction j. Furthermore, for this operation to be well-formed the sides (or "tubes") have to match the base, up to judgmental equality, as in the picture.
Another important property of this operation is that when we perform a substitution that makes one of the faces "valid" (i.e. turn the equation before " →" into (0 = 0) or (1 = 1)) the operation reduces to the corresponding element at this face with 1 substituted for i. So if we substitute 0 for j in This a composition with a valid face which means that it will reduce to the element at this face with 1 substituted for i. In this case the element at the face is a and we get Furthermore, "absurd" faces with (0 = 1) and (1 = 0) before the " →", can be disregarded/deleted. So if there wouldn't have been a valid face in the above composition we could have just deleted the (0 = 1) → b face. Finally, note that this operations binds i in all of A, a and b, but not in p j. This means that the reduction when a face is valid could trigger further computations as we will reduce the element at the valid face with 1 for i.

Examples of compositions
Let us now look at some examples of compositions. Given a, b, c : A we can define the concatenation of two paths as: Note that the right hand side depends on i in this example, so if we apply compPath p q to 1 we will substitute 1 for j in the composition and get: By the same discussion as the example above we get a when applying compPath p q to 0. This hence means that compPath p q is indeed a path from a to c as specified in the type.
Let us now prove one of the groupoid laws: the concatenation of a path with its inverse is path-equal to refl. Given a, b : A we give the following complicated definition: In order to see that this is a path between the two desired endpoints we first set k to 0 and then to 1 and see what the term evaluates to. In the first case we obtain λ ( j : I). comp i A[( j = 0) → a, ( j = 1) → p (¬i)] (p j) after deleting absurd faces. Up to renaming of bound variables this is the same as compPath p (sym p) as desired. In the second case the third face becomes valid (i.e. when k is 1 it is (1 = 1)) so the whole term reduces to λ ( j : I). a which is the same as refl as desired.
Terms like this might look very daunting at first, but in order to construct them we draw pictures. As we are constructing a path of paths, i.e. a square, we will have to form a 3-dimensional composition drawing, i.e. a cube. We draw this as follows: The top face is the desired result, i.e a square in direction k with left-hand side being compPath p (sym p) and all three other sides refl. This fixes the left (k = 0) side to: This way we have constructed a cube with the top side missing where all faces match up and we can implement the above composition term. Note that we do not have to specify the (k = 0) face in the term, the reason is that when we substitute 0 for k we automatically get the term we want (remember that compPath p (sym p) is itself defined using comp).

Cubical transport as special case of composition
A very important special case of the composition operation is the cubical transport operation from section 4. Given Γ, i : I A and Γ a : The intuition behind this definition is that cubical transport is just composition with no faces fixed and it is in this sense that the composition operation generalizes cubical transport. Furthermore, by defining comp by cases on all type formers in the theory we obtain the cases for cubical transport from above as special cases. This means that we have to add computation rules for composition instead of cubical transport to the theory and this is exactly what is done in (Cohen et al., 2018, Section 4.5).
An important consequence of defining cubical transport using composition is that given type A, B : U we can now construct a path between a : A and transport i (P i) a over P : Path U A B: When j is 0 this computes to a and when j is 1 the face can be deleted, giving the above definition of cubical transport in terms of comp. With this we can now justify that the computation rule for J on refl holds up to a path. Recall that J A a C d a refl reduces to transport i (C a refl) d, so transFill does indeed give us the result we want (up to symmetry): Using connections we can also define a similar "filling" operation that lets us construct a path between an element and a composition with that element as base. Geometrically this corresponds to an operation that lets us fill the interior of an open cube, e.g. given an open square or cube as above the filling operation computes a filled square or cube with the original open square or cube as its boundary. This kind of operation is used to define the judgmental computation rules for composition in Σ-and Π-types, however we won't go into the details of this here and refer the interested reader to (Cohen et al., 2018, Section 4.4 and 4.5).

Composition in general
In general, the composition operation looks as follows: Furthermore, in (Cohen et al., 2018) these satisfy the following properties: (1) All faces are distinct (so duplicated faces can be removed from the list). These are a lot of properties to formulate and check. In order to make this more convenient Cohen et al. (2018) introduced context restrictions: This is to be understood as J (ε/i). In other words, context restrictions lets us consider judgments on faces of cubes without having to apply substitutions. To check item (5) in the above list we check that Γ, i : I, ( j k = ε k ), ( j l = ε l ) a k = a l : A for all pairs of k and l. This judgment hence ensures that the sides of the cube match up. Furthermore, to check that the sides match the base (property (6) above) we use the following judgment: With the notations of (Cohen et al., 2018) the above discussion is summarized by the following concise typing rule: The notation Γ a : A[ϕ → b] is short for Γ a : A and Γ, ϕ a = b : A, so a has type A and on ϕ it is judgmentally equal to b. This hence lets us very concisely formulate properties (5) and (6) in the typing rule. For more details how this works formally, both type theoretically and semantically, see (Cohen et al., 2018). Note that other combinations of constraints are possible, for instance one does not have to delete absurd faces or one can consider composition problems where permutations matter. In fact, Angiuli et al. (2018b) considers a variation of composition where none of properties (1)-(3) are satisfied which enables some optimizations in the way the composition operations compute in cartesian cubical type theory.

Kan composition semantically
Semantically these operations can be elegantly formulated using the internal language of the presheaf topos of cubical sets. Following Orton and Pitts (2018) we can express this as additional structure on the types in the model. Proving that the type formers preserve this structure is the main part of the model construction and these proofs are very similar to the computation rules that we have formulated type theoretically in this paper and which are presented in detail for composition in (Cohen et al., 2018).
We can also understand these operations using categorical and homotopical language using lifting diagrams. In the categorical model we can view a type in context Γ as an element over Γ in the slice category DM /Γ (or in some other cubical set category than DM ). e The semantic version of transFill A a corresponds to the diagonal in the diagram: The top map corresponds to the element a as it's a point in A. The bottom map is not visible in the syntax, but it is implicit in the substitution principle for the judgment. The dashed diagonal map then defines a path in A and the commutativity of the top triangle corresponds to the fact that the starting point of this path is a. This is exactly what the transFill operation gives us. The interested reader can consult (Angiuli et al., 2021a, Section 1.2) for a more detailed discussion of this.
If we pretend that the above is instead in the category of topological spaces then we would say that the map on the right has the right lifting property with respect to the endpoint inclusion δ 0 : 1 → [0, 1], which in turn means that this map has the path lifting property. In other words, we can think of transFill as an operation that gives us a choice of solutions to path lifting problems.
We can also express the Kan filling operation diagrammatically. It corresponds to choice of a diagonal map as in the diagram below.
A Γ δ 0 ∨ϕ In general the square and open square on the left can be n-dimensional, but in the diagram we have just drawn the special case used for path concatenation. The map on the left is an endpoint inclusion combined with a "formula" specifying the shape of the open box. This formula is essentially a large disjunction of the faces in the syntax for the filling problem (in the case of path concatenation it is ( j = 0) ∨ ( j = 1)). The precise definition of how this map is then defined can be elegantly expressed using pushout-products as in (Gambino and Sattler, 2017, Section 2).
The composition operation can also be drawn using lifting diagrams. This is done by pulling back the diagram for the filling operation as in the diagram below. The composition operation then produces the longer dashed arrow from the "lid" of the square in: -Γ e Note that we now also use the letter Γ for the cubical set in DM corresponding to the semantic context.
Readers familiar with Kan simplicial sets will see a close resemblance between the simplicial horn filling diagrams and these cubical open box filling diagrams. In fact, this analogy can be made precise by saying that a map is a fibration if it has the right lifting property with respect to maps of the form δ 0 ∨ ϕ as above (Gambino and Sattler, 2017, Section 2). Sattler (2017) has proved that these, combined with a class of cofibrations, forms a Quillen model structure. That is, a category suitable for developing homotopy theory in. Interestingly this construction uses that the type formers preserve the composition structure, in particular that the universe can be equipped with a filling structure. This can be contrasted with the Kan simplicial set model where the existence of the classical Quillen model structure using Kan fibrations is assumed prior to constructing the model of the type theory. In the constructive cubical set models the order is the opposite: first the model of the type theory is constructed and using this Sattler (2017) constructs a model structure.
Another important difference between the cubical and simplicial models is that being "Kan" is a structure instead of a property. For this to work constructively additional "uniformity" conditions on the choice of fillers are assumed. These are expressed using suitable naturality conditions and essentially say that the chosen fillers commute with substitution. The fact that uniform fillers can be used to obtain a constructive model of HoTT/UF was one of the main new ideas in the original cubical set model of Bezem et al. (2014).

Variations on the Kan operations
In these notes we have presented the composition operations of Cohen et al. (2018), but there are many other possible variations. In order to be able to support higher inductive types Coquand et al. (2018) replaced the composition operations with a notion of homogeneous composition where the type is constant. However, this is not enough and the cubical transport operations also had to be generalized to get a theory where the operations are interderivable with the heterogeneous composition operations of Cohen et al. (2018).
A crucial property in Cohen et al. (2018) is that Kan filling can be derived from composition and connections, however in the cartesian setting there are no connections and in order to overcome this problem the composition operations need to be generalized as in Angiuli et al. (2021aAngiuli et al. ( , 2018b. There is also a decomposition of this generalized composition operation into generalized homogeneous composition and another generalized form of cubical transport called "coercion". This makes it possible to also support higher inductive types in these models as proved by Cavallo and Harper (2019).
There are hence a lot of parameters one can vary when constructing cubical models. This makes the literature on these models quite difficult to get into as different papers use different variations when talking about similar things. However, in a recent paper Cavallo et al. (2020) develop a common generalization to all of the (structural) cubical models, making it clearer how they are all related. By weakening the generalized composition operations of the cartesian model the authors construct a more general model that specializes to the specific models in presence of additional structure.

Exercises
(1) Given p : Path A a b, prove the following groupoid laws using compositions (Hint: draw suitable open cubes) i. compRefl : (2) Prove associativity of compPath using only composition (harder).
i. Construct a square that has "constantly" p : Path A a a as its boundary: a a a a p p p p That is, construct a term of the following type given p : Path A a a: iv. Construct a cube that is constantly p : Path A a a on all of its edges. (hard) (4) Given some type A, use a composition to prove: For the definition of isContr see the beginning of section 6. (5) Use a composition to prove: isPropIsContr : isProp (isContr A) (6) We can define isSet : U → U that expresses that a type is an h-set as Use a composition to prove: Given f : A → B and g : B → A prove the following using a composition

Glue types and univalence
We have now finally reached the main goal of this paper: the constructive proof of the univalence axiom. When expressed in cubical type theory the axiom says: Where the type of equivalences is defined as: It can be proved that the above formulation of univalence is equivalent to the following two terms: f The naive way of trying to prove ua would be to just add it as a constant with a suitable computation rule: This would make ua β trivially provable using refl and we could prove univalence. But this does not completely solve the problem of giving univalence computational meaning as there is no rule for "transport i (ua A B e (∼ i)) b". We could of course add another computation rule having it compute to the inverse of e applied to b, but then what about "transport i (compPath (ua A B e) (sym(ua A B e))) i) a"?
The above argument shows that it is not enough to just naively add some computation rules to the type theory in order to give univalence computational meaning. It also shows that the real difficulty with giving univalence computational meaning comes from explaining how cubical transport, or more generally comp, should compute for paths built up using ua. Note that this argument is not a proof that it is impossible to just add a ua constant with some computation rules, but rather that it is not sufficient to just naively add some rules which suggests that a more structured approach is necessary.

Glue types
A more structured approach was introduced by Cohen et al. (2018) who invented a new type theoretic construct called "Glue types". These resemble the compositions from above, but instead of replacing faces with n-dimensional cubes the Glue types allows faces of a type to be replaced by equivalent types. Just as we used composition to change the sides of a line we can use Glue types to replace the sides of a line between types with equivalent types. Given i : I A and two types B 0 and B 1 with equivalences e 0 : Equiv B 0 A(0/i) and e 1 : Equiv B 1 A(1/i) we can illustrate f See https://groups.google.com/forum/#!msg/homotopytypetheory/j2KBIvDw53s/YTDK4D0NFQAJ for the original discussion of this. the type Glue [(i = 0) → (B 0 , e 0 ), (i = 1) → (B 1 , e 1 )] A using the diagram: This explains why these types are called Glue types: they let us glue together the endpoints of the line A with B 0 and B 1 along equivalences e 0 and e 1 . g Note that this diagram is fundamentally different from the diagrams we drew for compositions-the sides are not lines, they are equivalences. This is illustrated by the sides being squiggly arrows without any specified direction.
It is straightforward to prove that the identity function is an equivalence (see exercise (1) for a direct cubical proof of this) and we write id A : Equiv A A for this equivalence. Given types A and B in U with e : Equiv A B we can construct the ua term as follows: We can illustrate this diagrammatically as follows: We now have a definition of ua and the only missing part is to prove ua β . For this we have to define cubical transport, and more generally composition, for Glue types. Doing this is very complicated and the interested reader can look at (Cohen et al., 2018, Section 6.2) for a complete definition. If one unfolds this definition in the special case of ua β one almost gets e.1 a, except for some trivial transports in constant types. This is hence exactly like what happened when we proved the computation rule for J at refl and we can again use transFill to prove ua β .
With ua and ua β we can now prove the standard formulation of univalence from above. To do this note that ua β states that Equiv A B is a retract of Path U A B. It is easy to see that this implies that (X : U ) × Equiv A X is a retract of (X : U ) × Path U A X. But (X : U ) × Path U A X is contractible by contrSingl and any retract of a contractible type is itself contractible, so (X : U ) × Equiv A X is in fact contractible. This is another way to state the univalence axiom and by (Univalent Foundations Program, 2013, Theorem 5.8.4) we get the desired proof of univalence. A formalization of these results in Cubical Agda can be found at https: g There are a many different of notions of "gluing" in the literature, for instance the gluing axiom for sheaves or Artin gluing in topos theory. The notion of gluing considered here in the form of Glue types has no relationship with these other notions apart from the name. //github.com/agda/cubical/blob/ef62b84397396d48135d73ba7400b71c721ddc94/ Cubical/Foundations/Univalence.agda.
As the above proof of univalence is a concrete definition in terms of the primitives of cubical type theory which all have computational content it as well has computational content. Furthermore, Huber (2019) has proved that this formulation of cubical type theory satisfies canonicity which means that any closed term of type N evaluates to a numeral. This hence provides constructive meaning to the univalence axiom. Furthermore, it is also possible to introduce identity types in cubical type theory and prove the univalence axiom expressed using them instead of paths (for a formal proof see https://github.com/agda/cubical/blob/ ef62b84397396d48135d73ba7400b71c721ddc94/Cubical/Foundations/Id.agda).
This means that any term in HoTT/UF can be translated to cubical type theory and hence be given computational meaning.
With all of this we can now finally transport arbitrary properties and structures between equivalent types. Let us spell this out for monoids.
Example 6.1. Combining ua and subst we get a convenient function for transporting results between equivalent types: In the case when P is isMonoid this gives us a way of transporting monoid structures between related types as discussed in example 4.1. A classic result in HoTT/UF is that isomorphic types are equivalent (see exercise (2)). Unary and binary numbers are clearly isomorphic and we can hence use substEquiv to transport the additive monoid structure from unary to binary numbers. This means that we will get an addition operation on binary numbers induced by the one on unary numbers. As we have given computational meaning to cubical transport at all type formers involved we can see that this operation will add two binary numbers by translating them to unary, adding them using unary addition, and then translating back to binary. This back and forth actually follows from the way cubical transport is defined for function types (remember that we had to transport "backwards" in the definition).
Such an addition operation on binary numbers might seem quite naive, but it turns out that we can actually do much more using univalence. The key realization is that univalence extends to a general principle called the structure identity principle (SIP) (Univalent Foundations Program, 2013, Section 9.8) which says that any property can be transported between equivalent structured types. We can define the type of monoids as The SIP then lets us lift a structured equivalence on the underlying types of M, N : Monoid to a path between M and N. Combining this with subst we can now transport any property proved for M to N. We can hence prove that binary numbers with efficient binary addition is a monoid and relate this to the additive monoid on unary numbers. This way we achieve a clear separation of concerns (Dijkstra, 1974) where proofs can be done using unary numbers and then transported over to binary numbers which are better suited for doing computations than proving properties. A cubical version of the SIP and many of its consequences for formalizing mathematics and computer science can be found in the paper of Angiuli et al. (2021b).

Glue types semantically
Glue types can also be presented internally in the presheaf topos of cubical sets we've seen in these notes. This, together with a proof of a formulation of univalence without universes, was worked out by Orton and Pitts (2018) and later extended to also incorporate universes by Licata et al. (2018). The typing rule for Glue types can be expressed as: This can be expressed diagrammatically as follows: The diagram states the same thing as the typing rule for Glue types: given a type A defined on all of Γ and a type B which is equivalent to the restriction of A on Γ, ϕ the Glue type gives us a total type defined on all of Γ. Interestingly there is a very similar construction in the proof of univalence in the Kan simplicial set model (Kapulkin and Lumsdaine, 2012, Theorem 3.4.1) where a more or less identical diagram occurs. For a discussion of the relationship between these see (Cohen et al., 2018, Section 6.1). The general form of this was coined the Equivalence Extension Property by Awodey and plays an important role in the work of Sattler (2017) for constructing a Quillen model structure from a cubical model of HoTT/UF.

Variations
Just as there are differences in how the composition operations are formulated in different models, there are also variations in how the Glue types are formulated. It might seem strange to introduce the very general Glue types when we only want to be able to prove ua. There is indeed a simpler formulation in cartesian cubical sets which is tailored for proving ua and which Angiuli et al. (2018b) call "V-types". These lets us omit the id B side in the definition of ua using Glue types and directly get the dashed line in: However, this variation is weaker than Glue types in that they don't let us directly equip the universe with a composition structure. To remedy this Angiuli et al. (2018b) introduce another quite complicated type of compositions in the universe which essentially correspond to a special case of Glue types.
Another, even simpler variation called G-types, can be found in Bezem et al. (2018). However, this variation does not work in structural cubical models and type theories as explained by (Angiuli, 2019, Page 65).

Exercises
(1) Prove id A : Equiv A A using a connection.
(2) Given f : A → B and g : B → A prove the following using only compositions (hard): This lemma is very useful for constructing equivalences.
(3) Prove that not : bool → bool from exercise (4) in section 3 is an equivalence (Hint: use isoToEquiv). Combine this with ua to get a non-trivial path from bool to bool. What happens if we transport true along it? (4) Use a 2-dimensional Glue type to prove uaIdEquiv : Path (Path U A A) (ua id A ) refl

Conclusions and further reading
We end these lecture notes with some pointers to further reading about cubical methods in HoTT/UF that hasn't already been discussed in the paper. These pointers are in no way meant to be an exhaustive list of the interesting literature on cubical methods in HoTT/UF, but rather just some pointers to papers that an interested reader can look into next.
For the reader who wants more hands-on experience with the ideas presented in these notes we recommend trying out Cubical Agda (Vezzosi et al., 2019(Vezzosi et al., , 2021. A tutorial to Cubical Agda with many exercises can be found at https://github.com/HoTT/EPIT-2020/tree/main/ 04-cubical-type-theory. There are also quite a few papers reporting on formalization projects using Cubical Agda, including a cubical version of the SIP (Angiuli et al., 2021b), synthetic homotopy theory (Mörtberg and Pujet, 2020), proof theory and ordinal notations (Forsberg et al., 2020), and a formalization of π-calculus (Veltri and Vezzosi, 2020).
There are also some interesting papers describing various independence results that have been proved using cubical methods. For instance, Uemura (2019) used a cubical variation of assemblies to construct an impredicative universe that does not satisfy a form of propositional resizing, Coquand et al. (2017) showed that countable choice cannot be proved in univalent type theory with propositional truncation, and the independence of Church's thesis in univalent type theory was shown by Swan and Uemura (2019). Another interesting recent development is a normalization result for cubical type theory proved by Sterling and Angiuli (2021).
As explained in these notes cubical type theory is constructive and hence satisfies the existence property. This means that we can write down existence statements using Σ-types and extract witnesses automatically. A famous example of this is the so called "Brunerie number": a concrete synthetic definition of n ∈ Z such that π 4 (S 3 ) = Z/nZ (Brunerie, 2016). This construction has been formalized Cubical Agda h , but it has so far not been possible to compute this numeral due to the computational complexity of the involved constructions. This is hence a very important open problem and solving it would lead to the possibility of constructively computing many other topological invariants using cubical type theory.
Finally, an important problem with cubical type theory is the question whether we can interpret all of the results that we prove in topological spaces or even any (Grothendieck) ∞-topos (Shulman, 2019). Currently these questions have not been fully resolved for the various cubical type theories and models that we have discussed in this paper. However, there has been some recent progress on an "equivariant" cubical set model that is equivalent to spaces (Riehl, 2019). We are hence very optimistic that these issues will be resolved in the near future, leading to even more exciting developments in HoTT/UF using cubical methods.

Appendix A. Solutions to exercises
We have collected solutions to the exercises in the notes here. Some results have been formalized in cubicaltt and Cubical Agda in which case we refer to the formalized solutions as well.

Section 3: Cubical type theories and their models
(1) To prove that {i} × { j} ∼ = {i, j} in we have to analyze what products in look like. By the definition of products {i} × { j} is an object with morphisms π 1 : Hom ({i} × { j}, {i}) and π 2 : Hom ({i} × { j}, { j}) satisfying the usual universal property. By the definition of hom-sets in we see that π 1 is a function {i} → ({i} × { j}) + 2 (recall that the functions go in the opposite direction) and similarly for π 2 . Furthermore, as the functions go the opposite direction the universal property has to correspond to the universal property of coproducts. Therefore {i} × { j} = {i} { j} ∼ = {i, j}.
(2) Given a, a : A and b, b : B, the binary version of ap can be proved as: (3) Given f , g : A → B → C, the binary (non-dependent) version of funExt can be proved as: . This is the number of elements of the free distributive lattice on 2n generators as negations can be pushed down to the names (so the generators are {i 1 , . . . , i n , ¬i 1 , . . . , ¬i n }). These numbers are called the "Dedekind numbers" and grow incredibly fast (the 10:th Dedekind number is in fact not even known). See https://en.wikipedia.org/wiki/Dedekind_number and https://oeis.org/A000372 for details. (9) Given A : U , the alternative version of contrSingl can be proved as: So loop (i ∧ j) is an identification of refl base and loop over an identification of refl base and loop. This square does hence not prove that loop is trivial; for this to be the case all but one side would have had to been refl base.
(11) The homotopy can be constructed as: hmtpy : Path (Path S 1 base base) (refl base) (λ (i : I). loop (i ∧ ¬i)) hmtpy = λ ( j i : I). loop ( j ∧ (i ∧ ¬i)) (12) Assuming decidable equality on I internally means that we have a function: dec : Π(i j : I). bool that returns true if i ≡ j and false otherwise. With this we can define oops : Path U (Unit, Empty) oops = λ (i : I). if dec i 0 then Unit else Empty

Section 4: Cubical transport
(1) In order to give the negative definition of cubical transport for A × B we first have to consider transport i (A × B) p to be a neutral value and give the reduction rules when applying the eliminators to this. This is easily done by adding the equations: (transport i (A × B) p).1 = transport i A p.1 (transport i (A × B) p).2 = transport i B p.2 (2) To define cubical transport in sum types A + B we assume that we are given x : A(0/i) and y : B(0/i), and write: (3) When defining cubical transport for Σ-and Π-types one runs into the problem that one needs a path connecting an element with its transport (just like was needed to prove the computation rule for J). Indeed, consider the case of cubical transport in Σ-types. For this we need to fill the ? in: To this end we can write down the following: (transport i A p.1, transport i (B ?) p.2) There is however no way to fill this ? at this point as we would need a path from p.1 to transport i A p.1. Indeed, p.2 is in B(0/i) p.1, but the result should be in B (1/i) (transport i A p.1) as we've picked transport i A p.1 as the first component of the result pair. Note that there is not really anything else we could have picked for the first component as we need something in A(1/i) and the only way to get something of this type with what we're given is by transporting p.1 in A.
The problem when defining cubical transport for Π-types is similar, but there one needs to also handle the reversal coming from transporting backwards.