Cubical Type Theory: a constructive interpretation of the univalence axiom

This paper presents a type theory in which it is possible to directly manipulate n -dimensional cubes (points, lines, squares, cubes, etc.) based on an interpretation of dependent type theory in a cubical set model. This enables new ways to reason about identity types, for instance, function extensionality is directly provable in the system. Further, Voevodsky’s univalence axiom is provable in this system. We also explain an extension with some higher inductive types like the circle and propositional truncation. Finally we provide semantics for this cubical type theory in a constructive meta-theory. 1998


Introduction
This work is a continuation of the program started in [6,13] to provide a constructive justification of Voevodsky's univalence axiom [27].This axiom allows many improvements for the formalization of mathematics in type theory: function extensionality, identification of isomorphic structures, etc.In order to preserve the good computational properties of type theory it is crucial that postulated constants have a computational interpretation.Like in [6,13,22] our work is based on a nominal extension of λ-calculus, using names to represent formally elements of the unit interval [0, 1].This paper presents two main contributions.
The first one is a refinement of the semantics presented in [6,13].We add new operations on names corresponding to the fact that the interval [0, 1] is canonically a de Morgan algebra [3].This allows us to significantly simplify our semantical justifications.In the previous work, we noticed that it is crucial for the semantics of higher inductive types [26] to have a "diagonal" operation.By adding this operation we can provide a semantical justification of some higher inductive types and we give two examples (the spheres and propositional truncation).Another shortcoming of the previous work was that using path types as equality types did not provide a justification of the computation rule of the Martin-Löf identity type [19] as a judgmental equality.This problem has been solved by Andrew Swan [25], in the framework of [6,13,22], who showed that we can define a new type, equivalent to, but not judgmentally equal to the path type.This has a simple definition in the present framework.
The second contribution is the design of a type system1 inspired by this semantics which extends Martin-Löf type theory [20,19].We add two new operations on contexts: addition of new names representing dimensions and a restriction operation.Using these we can define a notion of extensibility which generalizes the notion of being connected by a path, and then a Kan composition operation that expresses that being extensible is preserved along paths.We also define a new operation on types which expresses that this notion of extensibility is preserved by equivalences.The axiom of univalence, and composition for the universe, are then both expressible using this new operation.
The paper is organized as follows.The first part, Sections 2 to 7, presents the type system.The second part, Section 8, provides its semantics in cubical sets.Finally, in Section 9, we present two possible extensions: the addition of an identity type, and two examples of higher inductive types.

Basic type theory
In this section we introduce the version of dependent type theory on which the rest of the paper is based.This presentation is standard, but included for completeness.The type theory that we consider has a type of natural numbers, but no universes (we consider the addition of universes in Section 7).It also has β and η-conversion for dependent functions and surjective pairing for dependent pairs.The syntax of contexts, terms and types is specified by: Γ, ∆ ::= () | Γ, x : A Contexts t, u, A, B :: We write A → B for the non-dependent function space and A × B for the type of nondependent pairs.Terms and types are considered up to α-equivalence of bound variables.Substitutions, written σ = (x 1 /u 1 , . . ., x n /u n ), are defined to act on expressions as usual, i.e., simultaneously replacing x i by u i , renaming bound variables whenever necessary.The inference rules of this system are presented in Figure 1 where in the η-rule for Π-and Σ-types we omitted the premises that t and u should have the respective type.
We write J for an arbitrary judgment and, as usual, we consider also hypothetical judgments Γ ⊢ J in a context Γ.
The following lemma will be valid for all extensions of type theory we consider below.
Lemma 1. Substitution is admissible: In particular, weakening is admissible, i.e., a judgment valid in a context stays valid in any extension of this context.

Path types
As in [6,22] we assume that we are given a discrete infinite set of names (representing directions) i, j, k, . . .We define I to be the free de Morgan algebra [3] on this set of names.This means that I is a bounded distributive lattice with top element 1 and bottom element 0 with an involution 1 − r satisfying: The elements of I can hence be described by the following grammar: The set I also has decidable equality, and as a distributive lattice, it can be described as the free distributive lattice generated by symbols i and 1 − i [3].As in [6], the elements in I can be thought as formal representations of elements in [0, 1], with r ∧ s representing min(r, s) and r ∨ s representing max(r, s).With this in mind it is clear that (1 − r) ∧ r = 0 and (1 − r) ∨ r = 1 in general.
Well-formed contexts, Γ ⊢ (The condition x / ∈ dom(Γ) means that x is not declared in Γ)  Remark.We could instead also use a so-called Kleene algebra [15], i.e., a de Morgan algebra satisfying in addition r ∧ (1 − r) s ∨ (1 − s).The free Kleene algebra on the set of names can be described as above but by additionally imposing the equations i ∧ (1 − i) j ∨ (1 − j) on the generators; this still has a decidable equality.Note that [0, 1] with the operations described above is a Kleene algebra.With this added condition, r = s if, and only if, their interpretations in [0, 1] are equal.A consequence of using a Kleene algebra instead would be that more terms would be judgmentally equal in the type theory.

Syntax and inference rules
Contexts can now be extended with name declarations: Γ, ∆ ::= . . .| Γ, i : I together with the context rule: A judgment of the form Γ ⊢ r : I means that Γ ⊢ and r in I depends only on the names declared in Γ.The judgment Γ ⊢ r = s : I means that r and s are equal as elements of I, Γ ⊢ r : I, and Γ ⊢ s : I. Note, that judgmental equality for I will be re-defined once we introduce restricted contexts in Section 4.
The extension to the syntax of basic dependent type theory is: Path abstraction, i t, binds the name i in t, and path application, t r, applies a term t to an element r : I.This is similar to the notion of name-abstraction in nominal sets [21].
The substitution operation now has to be extended to substitutions of the form (i/r).There are special substitutions of the form (i/0) and (i/1) corresponding to taking faces of an n-dimensional cube, we write these simply as (i0) and (i1).
The inference rules for path types are presented in Figure 2 where again in the η-rule we omitted that t and u should be appropriately typed.
We define 1 a : Path A a a as 1 a = i a, which corresponds to a proof of reflexivity.
The intuition is that a type in a context with n names corresponds to an n-dimensional cube: The substitution (i/j) corresponds to renaming a dimension, while (i/1 − i) corresponds to the inversion of a path.If we have i : I ⊢ p with p(i0) = a and p(i1) = b then it can be seen as a line The substitutions (i/i ∧ j) and (i/i ∨ j) correspond to special kinds of degeneracies called connections [7].The connections p(i/i ∧ j) and p(i/i ∨ j) can be drawn as the squares: where, for instance, the right-hand side of the left square is computed as and the bottom and left-hand sides are degenerate.

Examples
Representing equalities using path types allows novel definitions of many standard operations on identity types that are usually proved by identity elimination.For instance, the fact that the images of two equal elements are equal can be defined as: This operation satisfies some judgmental equalities that do not hold judgmentally when the identity type is defined as an inductive family (see Section 7.2 of [6] for details).
We can also define new operations, for instance, function extensionality for path types can be proved as: To see that this is correct we check that the term has the correct faces, for instance: We can also justify the fact that singletons are contractible, that is, that any element in (x : A) × (Path A a x) is equal to (a, 1 a ): As in the previous work [6,13] we need to add composition operations, defined by induction on the type, in order to justify the elimination principle for paths.

Systems, composition, and transport
In this section we define the operation of context restriction which will allow us to describe new geometrical shapes corresponding to "sub-polyhedra" of a cube.Using this we can define the composition operation.From this operation we will also be able to define the transport operation and the elimination principle for Path types.

The face lattice
The face lattice, F, is the distributive lattice generated by symbols (i = 0) and (i = 1) with the relation (i = 0) ∧ (i = 1) = 0 F .The elements of the face lattice, called face formulas, can be described by the grammar There is a canonical lattice map I → F sending i to (i = 1) and 1 − i to (i = 0).We write (r = 1) for the image of r : I in F and we write (r = 0) for (1 − r = 1).We have (r = 1) ∧ (r = 0) = 0 F and we define the lattice map F → F, ψ −→ ψ(i/r) sending (i = 1) to (r = 1) and (i = 0) to (r = 0).Any element of F is the join of the irreducible elements below it.An irreducible element of this lattice is a face, i.e., a conjunction of elements of the form (i = 0) and (j = 1).This provides a disjunctive normal form for face formulas, and it follows from this that the equality on F is decidable.
Geometrically, the face formulas describe "sub-polyhedra" of a cube.For instance, the element (i = 0) ∨ (j = 1) can be seen as the union of two faces of the square in directions j and i.If I is a finite set of names, we define the boundary of I as the element ∂ I of F which is the disjunction of all (i = 0) ∨ (i = 1) for i in I.It is the greatest element depending at most on elements in I which is < 1 F .
We write Γ ⊢ ψ : F to mean that ψ is a face formula using only the names declared in Γ.We introduce then the new restriction operation on contexts: Γ, ∆ ::= . . .| Γ, ϕ together with the rule: This allows us to describe new geometrical shapes: as we have seen above, a type in a context Γ = i : I, j : I can be thought of as a square, and a type in the restricted context Γ, ϕ will then represent a compatible union of faces of this square.This can be illustrated by: There is a canonical map from the lattice F to the congruence lattice of I, which is distributive [3], sending (i = 1) to the congruence identifying i with 1 (and 1 − i with 0) and sending (i = 0) to the congruence identifying i with 0 (and 1 − i with 1).In this way, any element ψ of F defines a congruence r = s (mod.ψ) on I.
To any context Γ we can associate recursively a congruence on I, the congruence on Γ, ψ being the join of the congruence defined by Γ and the congruence defined by ψ.The congruence defined by () is equality in I, and an extension x : A or i : I does not change the congruence.The judgment Γ ⊢ r = s : I then means that r = s (mod.Γ), Γ ⊢ r : I, and Γ ⊢ s : I.
In the case where Γ does not use the restriction operation, this judgment means r = s in I.
As explained above, the elements of I can be seen as formal representations of elements in the interval [0, 1].The elements of F can then be seen as formulas on elements of [0, 1].We have a simple form of quantifier elimination on F: given a name i, we define ∀i : F → F as the lattice morphism sending (i = 0) and (i = 1) to 0 F , and being the identity on all the other generators.If ψ is independent of i, we have ψ ϕ if, and only if, ψ ∀i.ϕ.For example, if ϕ is (i = 0) ∨ ((i = 1) ∧ (j = 0)) ∨ (j = 1), then ∀i.ϕ is (j = 1).This operation will play a crucial role in Section 6.2 for the definition of composition of glueing.

Syntax and inference rules for systems
Systems allow to introduce "sub-polyhedra" as compatible unions of cubes.The extension to the syntax of dependent type theory with path types is: We allow n = 0 and get the empty system [ ].As explained above, a context now corresponds in general to the union of sub-faces of a cube.In Figure 3 we provide operations for combining compatible systems of types and elements, the side condition for these rules is This condition requires Γ to be sufficiently restricted: for example ∆, (i = 0) The first rule introduces systems of types, each defined on one ϕ l and requiring the types to agree whenever they overlap; the second rule is the analogous rule for terms.The last two rules make sure that systems have the correct faces.The third inference rule says that that any judgment which is valid locally at each ϕ l is valid; note that in particular n = 0 is allowed (then the side condition becomes Note that when n = 0 the second of the above rules should be read as We extend the definition of the substitution judgment by ∆ ⊢ σ : Γ, In this case, we see this element a as a witness that the partial element u, defined on the "extent" ϕ (using the terminology from [10]), is extensible.More generally, we write For instance, if Γ, i : I ⊢ A and Γ, i : I, ϕ ⊢ u : A where ϕ = (i = 0) ∨ (i = 1) then the element u is determined by two elements Γ ⊢ a 0 : A(i0) and Γ ⊢ a 1 : A(i1) and an element Γ, i : I ⊢ a : A[(i = 0) → a 0 , (i = 1) → a 1 ] gives a path connecting a 0 and a 1 .

Lemma 3. The following rules are admissible:
The inference rules with double line are each a pair of rules, because they can be used in both directions.
Furthermore, if ϕ is independent of i, the following rules are admissible and it follows that we have in general:

Composition operation
The syntax of compositions is given by: t, u, A, B ::= . . .
where u is a system on the extent ϕ.
The composition operation expresses that being extensible is preserved along paths: if a partial path is extensible at 0, then it is extensible at 1.
Note that comp i binds i in A and u and that we have in particular the following equality judgments for systems: If we have a substitution ∆ ⊢ σ : Γ, then where j is fresh for ∆, which corresponds semantically to the uniformity [6,13] of the composition operation.We use the abbreviation Example 4. With composition we can justify transitivity of path types: This composition can be visualized as the dashed arrow in the square:

Kan filling operation
As we have connections we also get Kan filling operations from compositions: where j is fresh for Γ.The element Γ, i : This means that we can not only compute the lid of an open box but also its filling.If ϕ is the boundary formula on the names declared in Γ, we recover the Kan operation for cubical sets [16].

Equality judgments for composition
The equality judgments for comp i C [ϕ → u] a 0 are defined by cases on the type C which depends on i, i.e., Γ, i : I ⊢ C. The right hand side of the definitions are all equal to u(i1) on the extent ϕ by the typing rule for compositions.There are four cases to consider: ] the composition will be of type C(i1).
For Γ ⊢ u 1 : A(i1), we first let: Using this we define the equality judgment: we let: From which we define:

Transport
Composition for ϕ = 0 F corresponds to transport: Together with the fact that singletons are contractible, from Section 3.2, we get the elimination principle for Path types in the same manner as explained for identity types in Section 7.2 of [6].

Derived notions and operations
This section defines various notions and operations that will be used for defining compositions for the glue operation in the next section.This operation will then be used to define the composition operation for the universe and to prove the univalence axiom.

Contractible types
We define isContr A = (x : A) × ((y : A) → Path A x y).A proof of isContr A witnesses the fact that A is contractible.
Given Γ ⊢ p : isContr A and Γ, ϕ ⊢ u : A we define the operation3 Conversely, we can state the following characterization of contractible types: Lemma 5. Let Γ ⊢ A and assume that we have one operation then we can find an element in isContr A.
Proof.We define x = contr [] : A and prove that any element y : A is path equal to x.For this, we introduce a fresh name i : I and define ϕ = (i = 0) ∨ (i = 1) and u = [(i = 0) → x, (i = 1) → y].Using this we obtain Γ, i : In this way, we get a path i contr [ϕ → u] connecting x and y.

The pres operation
The pres operation states that the image of a composition is path equal to the composition of the respective images, so that any function preserves composition, up to path equality.Lemma 6.We have an operation: where Note that pres i binds i in f and t.

The equiv operation
We define isEquiv T A f = (y : A) → isContr ((x : T ) × Path A y (f x)) and Equiv T A = (f : T → A) × isEquiv T A f .If f : Equiv T A and t : T , we may write f t for f .1 t.
Lemma 7. If Γ ⊢ f : Equiv T A, we have an operation Conversely, if Γ ⊢ f : T → A and we have such an operation, then we can build a proof that f is an equivalence.

Glueing
In this section, we introduce the glueing operation.This operation expresses that to be "extensible" is invariant by equivalence.From this operation, we can define a composition operation for universes, and prove the univalence axiom.

Syntax and inference rules for glueing
We introduce the glueing construction at type and term level by: t, u, A, B :: We may write simply unglue b for unglue [ϕ → f ] b.The inference rules for these are presented in Figure 4.In the case ϕ = (i = 0) ∨ (i = 1) the glueing operation can be illustrated as the dashed line in:

A
This illustrates why the operation is called glue: it glues together along a partial equivalence the partial type T and the total type A to a total type that extends T .
Remark.In general Glue [ϕ → (T, f )] A can be illustrated as: This diagram suggests that a construction similar to Glue also appears in the simplicial set model.Indeed, the proof of Theorem 3. In Section 7 we introduce a universe of types U and we will be able to define a function of type (A B : U) → Equiv A B → Path U A B by:

Composition for glueing
We assume Γ, i : A, and define the composition in B. In order to do so, assume Γ, ψ, i : and define: The following provides the algorithm for composition We can check that whenever Γ, i : which is consistent with the fact that B = T in this case.
In the next section we will use the glue operation to define the composition for the universe and to prove the univalence axiom.

Universe and the univalence axiom
As in [20], we now introduce a universe U à la Russell by reflecting all typing rules and

Composition for the universe
In order to describe the composition operation for the universe we first have to explain how to construct an equivalence from a line in the universe.Given Γ ⊢ A, Γ ⊢ B, and Γ, i : I ⊢ E, such that E(i0) = A and E(i1) = B, we will construct equiv i E : Equiv A B. In order to do this we first define such that: We will now prove that f is an equivalence.Given y : B we see that (x : A) × Path B y (f x) is inhabited as it contains the element (g y, j θ 0 (i1)) where Next, given an element (x, β) of (x : A) × Path B y (f x) we will construct a path from (g y, j θ 0 (i1)) to (x, β).Let and ω = θ 1 (i0) so Γ, i : I, j : I ⊢ θ 1 : E, ω(j0) = g y, and ω(j1) = x.And further with we obtain k (ω(j/k), j δ) : Path ((x : A) × Path B y (f x)) (g y, j θ 0 (i1)) (x, β) as desired.This concludes the proof that f is an equivalence and thus also the construction of equiv i E : Equiv A B.
Using this we can now define the composition for the universe: Given Γ, i : I ⊢ E we can also get an equivalence in Equiv A B (where A = E(i0) and B = E(i1)) with a less direct description by where id A is the identity equivalence as given in Example 8. we get, using Lemma 7
Corollary 10.For any type A : U the type C = (X : U) × Equiv X A is contractible. 4roof.It is enough by Lemma 5 to show that any partial element ϕ ⊢ (T, f ) : C is path equal to the restriction of a total element.The map unglue extends f and is an equivalence by the previous theorem.Since any two elements of the type isEquiv X A f .1 are path equal, this shows that any partial element of type C is path equal to the restriction of a total element.We can then conclude by Theorem 9.
Corollary 11 (Univalence axiom).For any term Proof.Both (X : U) × Path U A X and (X : U) × Equiv A X are contractible.Hence the result follows from Theorem 4.7.7 in [26].
Two alternative proofs of univalence can be found in Appendix B.

Semantics
In this section we will explain the semantics of the type theory under consideration in cubical sets.We will first review how cubical sets, as a presheaf category, yield a model of basic type theory, and then explain the additional so-called composition structure we have to require to interpret the full cubical type theory.

The category of cubes and cubical sets
Consider the monad dM on the category of sets associating to each set the free de Morgan algebra on that set.The category of cubes C is the small category whose objects are finite subsets I, J, K, . . . of a fixed, discrete, and countably infinite set, called names, and a morphism Hom(J, I) is a map I → dM(J).Identities and compositions are inherited from the Kleisli category of dM, i.e., the identity on I is given by the unit I → dM(I), and composition f g ∈ Hom(K, I) of g ∈ Hom(K, J) and f ∈ Hom(J, I) is given by µ K •dM(g)•f where µ K : dM(dM(K)) → dM(K) denotes multiplication of dM.We will use f, g, h for morphisms in C and simply write f : J → I for f ∈ Hom(J, I).We will often write unions with commas and omit curly braces around finite sets of names, e.g., writing I, i, j for I ∪ {i, j} and I − i for I − {i} etc.If i is in I and b is 0 I or 1 I , we have maps (ib) in Hom(I − i, I) whose underlying map sends j = i to itself and i to b.A face map is a composition of such maps.A strict map Hom(J, I) is a map I → dM(J) which never takes the value 0 I or 1 I .Any f can be uniquely written as a composition f = gh where g is a face map and h is strict.
Let us discuss some important examples of cubical sets.Using the canonical de Morgan algebra structure of the unit interval, [0, 1], we can define a functor If u is in [0, 1] I we can think of u as an environment giving values in [0, 1] to each i ∈ I, so that iu is in [0, 1] if i ∈ I. Since [0, 1] is a de Morgan algebra, this extends uniquely to ru for r ∈ dM(I).So any f : To any topological space X we can associate its singular cubical set S(X) by taking S(X)(I) to be the set of continuous functions [0, 1] I → X.
For a finite set of names I we get the formal cube y I where y : C → [C op , Set] denotes the Yoneda embedding.Note that since Top is cocomplete the functor in (1) extends to a cocontinuous functor assigning to each cubical set its geometric realization as a topological space, in such a way that y I has [0, 1] I as its geometric realization.
The formal interval I induces a cubical set given by I(I) = dM(I).The face lattice F induces a cubical set by taking as F(I) to be those ϕ ∈ F which only use symbols in I.The restrictions along f : J → I are in both cases simply substituting the symbols i ∈ I by f (i) ∈ dM(J).
As any presheaf category, cubical sets have a subobject classifier Ω where Ω(I) is the set of sieves on I (i.e., subfunctors of y I).Consider the natural transformation (• = 1) : I → Ω where for r ∈ I(I), (r = 1) is the sieve on I of all f : J → I such that rf = 1 I .The image of (• = 1) is F → Ω, assigning to each ϕ the sieve of all f with ϕf = 1 F .

Presheaf semantics
The category of cubical sets (with morphisms being natural transformations) induce-as does any presheaf category-a category with families (CwF) [9] where the category of contexts and substitutions is the category of cubical sets.We will review the basic constructions but omit verification of the required equations (see, e.g., [12,13,6] for more details).

Basic presheaf semantics
As already mentioned the category of (semantic) contexts and substitutions is given by cubical sets and their maps.In this section we will use Γ, ∆ to denote cubical sets and (semantic) substitutions by σ : ∆ → Γ, overloading previous use of the corresponding metavariables to emphasize their intended role.
Given a cubical set Γ, the types A in context Γ, written A ∈ Ty(Γ), are given by sets Aρ for each I ∈ C and ρ ∈ Γ(I) together with restriction maps Aρ → A(ρf ), u → uf for f : J → I satisfying u id I = u and (uf )g = u(f g) ∈ A(ρf g) if g : K → J. Equivalently, A ∈ Ty(Γ) are the presheaves on the category of elements of Γ.For a type A ∈ Ty(Γ) its terms a ∈ Ter(Γ; A) are given by families of elements aρ ∈ Aρ for each I ∈ C and ρ ∈ Γ(I) such that (aρ)f = a(ρf ) for f : J → I.Note that our notation leaves a lot implicit; e.g., we should have written A(I, ρ) for Aρ; A(I, ρ, f ) for the restriction map Aρ → A(ρf ); and a(I, ρ) for aρ.
The restriction by f : J → I of such a w is defined by (wf Basic data types like the natural numbers can be interpreted as discrete presheaves, i.e., N ∈ Ty(Γ) is given by Nρ = N; the constants are interpreted by the lifts of the corresponding set-theoretic operations on N.This concludes the outline of the basic CwF structure on cubical sets.
Remark.Following Aczel [1] we will make use of that our semantic entities are actual sets in the ambient set theory.This will allow us to interpret syntax in Section 8.3 with fewer type annotations than are usually needed for general categorical semantics of type theory (see [24]).E.g., the definition of application app(w, u)ρ as defined in ( 2) is independent of Γ, A and B, since set-theoretic application is a (class) operation on all sets.Likewise, we don't need annotations for first and second projections.But note that we will need the type A for λ-abstraction for (λ Γ;A v)ρ to be a set by the replacement axiom.

Semantic path types
Note that we can consider any cubical set X as X ′ ∈ Ty(Γ) by setting X ′ ρ = X(I) for ρ ∈ Γ(I).We will usually simply write X for X ′ .In particular, for a cubical set Γ we can form the cubical set Γ.I.
For A ∈ Ty(Γ) and u, v ∈ Ter(Γ; A) the semantic path type Path Γ A (u, v) ∈ Ty(Γ) is given by: for ρ ∈ Γ(I), Path A (u, v)ρ consists of equivalence classes i w where i / ∈ I, w ∈ A(ρs i ) such that w(i0) = uρ and w(i1) = vρ; two such elements i w and j w ′ are equal iff w(i/j) = w ′ .Here s i : I, i → I is induced by the inclusion I ⊆ I, i and (i/j) setting i to j.We define ( i w)f = j w(f, i/j) for f : J → I and j / ∈ J.For r ∈ I(I) we set ( i w) r = w(i/r).Both operations, name abstraction and application, lift to terms, i.e., if w ∈ Ter(Γ.I; A), then w ∈ Ter(Γ; Path A (w[0], w [1])) given by ( w)ρ = i w(ρs i ) for a fresh i; also if u ∈ Ter(Γ; Path A (a, b)) and r ∈ Ter(Γ; I), then u r ∈ Ter(Γ; A) defined as (u r)ρ = (uρ) (rρ).
For the next definition note that if A ∈ Ty(Γ), then ρ ∈ Γ(I) corresponds to ρ : y I → Γ and thus Aρ ∈ Ty(y I); also, any ϕ ∈ F(I) corresponds to ϕ ∈ Ter(y I; F).Definition 13.A composition structure for A ∈ Ty(Γ) is given by the following operations.For each I, i / ∈ I, ρ ∈ Γ(I, i), ϕ ∈ F(I), u a partial element of Aρ of extent ϕ, and a 0 ∈ Aρ(i0) with a 0 f = u (i0)f for all f : J → I with ϕf = 1 F (i.e., a 0 ι ϕ = u(i0) if a 0 is considered as element of Ter(y I; Aρ(i0))), we require comp(I, i, ρ, ϕ, u, a 0 ) ∈ Aρ(i1) such that for any f : J → I and j / ∈ J, A type A ∈ Ty(Γ) together with a composition structure comp on A is called a fibrant type, written (A, comp) ∈ FTy(Γ).We will usually simply write A ∈ FTy(Γ) and comp A for its composition structure.But observe that A ∈ Ty(Γ) can have different composition structures.Call a cubical set Γ fibrant if it is a fibrant type when Γ considered as type Γ ∈ Ty(⊤) is fibrant where ⊤ is a terminal cubical set.A prime example of a fibrant cubical set is the singular cubical set of a topological space (see Appendix C).
Theorem 14.The CwF on cubical sets supporting dependent products, dependent sums, and natural numbers described above can be extended to fibrant types.
Following the argument in the syntax we can use the equivalence structure to explain a composition for Glue.
Theorem 17.If A ∈ FTy(Γ), T ∈ FTy(Γ, ϕ), and we have an equivalence structure for w, then we have a composition structure for Glue(ϕ, T, A, w) such that the equations (3) also hold for the respective composition structures.

Semantic universes
Assuming a Grothendieck universe of small sets in our ambient set theory, we can define A ∈ Ty 0 (Γ) iff all Aρ are small for ρ ∈ Γ(I); and A ∈ FTy 0 (Γ) iff A ∈ Ty 0 (Γ) when forgetting the composition structure of A.
Definition 18.The semantic universe U is the cubical set defined by U(I) = FTy 0 (y I); restriction along f : J → I is simply substitution along y f .We can consider U as an element of Ty (Γ).As such we can, as in the syntactic counterpart, define a composition structure on U using semantic glueing, so that U ∈ FTy(Γ).Note that semantic glueing preserves smallness.
For T ∈ Ter(Γ; U) we can define decoding El T ∈ FTy 0 (Γ) by (El T )ρ = (T ρ) id I and likewise for the composition structure.For A ∈ FTy 0 (Γ) we get its code A ∈ Ter(Γ; U) by setting A ρ ∈ FTy 0 (y I) to be given by the sets ( A ρ)f = A(ρf ) and likewise for restrictions and composition structure.These operations satisfy El A = A and El T = T .

Interpretation of the syntax
Following [24] we define a partial interpretation function from raw syntax to the CwF with fibrant types given in the previous section.
To interpret the universe rules à la Russell we assume two Grothendieck universes in the underlying set theory, say tiny and small sets.So that any tiny set is small, and the set of tiny sets is small.For a cubical set X we define FTy 0 (X) and FTy 1 (X) as in the previous section, now referring to tiny and small sets, respectively.We get semantic universes U i (I) = FTy i (y I) for i = 0, 1; we identify those with their lifts to types.As noted above, these lifts carry a composition structure, and thus are fibrant.We also have U 0 ⊆ U 1 and thus Ter(X; U 0 ) ⊆ Ter(X; U 1 ).Note that coding and decoding are, as set-theoretic operations, the same for both universes.We get that U 0 ∈ Ter(X; U 1 ) which will serve as the interpretation of U.
In what follows, we define a partial interpretation function of raw syntax: , and [[∆; σ]] by recursion on the raw syntax.Since we want to interpret a universe à la Russell we cannot assume terms and types to have different syntactic categories.The definition is given below and should be read such that the interpretation is defined whenever all interpretations on the right-hand sides are defined and make sense; so, e.The interpretation for raw contexts is given by: , and where j is fresh and ρ ′ = (ρs j , i = j) with s j : I, j → I induced from the inclusion I ⊆ I, j.
The where * is the unique element of ⊤(I).This concludes the definition of the interpretation of syntax.
In the following α stands for either a raw term or raw substitution.In the latter case, ασ denotes composition of substitutions.
Lemma 19.Let Γ ′ be like Γ but with some ϕ's inserted, and assume both [ [Γ]] and [[Γ ′ ]] are defined; then: 9 Extensions: identity types and higher inductive types In this section we consider possible extensions to cubical type theory.The first is an identity type defined using path types whose elimination principle holds as a judgmental equality.The second are two examples of higher inductive types.

Identity types
We can use the path type to represent equalities.Using the composition operation, we can indeed build a substitution function P (a) → P (b) from any path between a and b.However, since we don't have in general the judgmental equality transp i A a 0 = a 0 if A is independent of i (which is an equality that we cannot expect geometrically in general, as shown in Appendix C), this substitution function does not need to be the constant function when the path is constant.This means that, as in the previous model [6,13], we don't get an interpretation of Martin-Löf identity type [19] with the standard judgmental equalities.
However, we can define another type which does give an interpretation of this identity type following an idea of Andrew Swan.

Identity types
The basic idea of Id A a 0 a 1 is to define it in terms of Path A a 0 a 1 but also mark the paths where they are known to be constant.Formally, the formation and introduction rules are together with the following judgmental equality in case β is of the form (ω, ϕ) where Γ, i : I ⊢ β * (i) : Id A a (ω i) is given by Note that with this definition we get J d a (r a) = d as desired.
The composition operation for Id is explained as follows.Given Γ, i : I ⊢ Id A a 0 a 1 , Γ, ϕ, i : I ⊢ (ω, ψ) : Id A a 0 a 1 , and Γ ⊢ (ω 0 , ψ 0 ) : (Id A a 0 a 1 )(i0)[ϕ → (ω(i0), ψ(i0))] we have the judgmental equality It can then be shown that the types Id A a b and Path A a b are (Path)-equivalent.In particular, a type is (Path)-contractible if, and only if, it is (Id)-contractible.The univalence axiom, proved in Section 7.2 for the Path-type, hence holds as well for the Id-type. 6

Cofibration-trivial fibration factorization
The same idea can be used to factorize an arbitrary map of (not necessary fibrant) cubical sets f : A → B into a cofibration followed by a trivial fibration.We define a "trivial fibration" to be a first projection from a total space of a contractible family of types and a "cofibration" to be a map that has the left lifting property against any trivial fibration.For this we define, for b : B, the type T f (b) to be the type of elements [ϕ → a] with ϕ ⊢ a : A and ϕ ⊢ f a = b : B.
Theorem 24.The type T f (b) is contractible and the map is a cofibration.
The definition of the identity type can be seen as a special case of this, if we take the B the type of paths in A and for f the constant path function.

Higher inductive types
In this section we consider the extension of cubical type theory with two different higher inductive types: spheres and propositional truncation.The presentation in this section is syntactical, but it can be directly translated into semantic definitions.

Extension to dependent path types
In order to formulate the elimination rules for higher inductive types, we need to extend the path type to dependent path type, which is described by the following rules.If i : I ⊢ A and ⊢ a 0 : A(i0), a 1 : A(i1), then ⊢ Path i A a 0 a 1 .The introduction rule is that ⊢ i t : Path i A t(i0) t(i1) if i : I ⊢ t : A. The elimination rule is ⊢ p r : A(i/r) if ⊢ p : Path i A a 0 a 1 with equalities p 0 = a 0 : A(i0) and p 1 = a 1 : A(i1).

Spheres
We define the circle, S 1 , by the rules: with the equalities loop(0) = loop(1) = base.
Since we want to represent the free type with one base point and a loop, we add composition as a constructor operation hcomp i : Γ, ϕ, i : Given a dependent type x : S 1 ⊢ A and a : A(x/base) and l : Path i A(x/loop(i)) a a we can define a function g : (x : S 1 ) → A by the equations7 g base = a and g loop(r) = l r and This definition is non ambiguous since l 0 = l 1 = a.
We have a similar definition for S n taking as constructors base and loop(r 1 , . . ., r n ).

Propositional truncation
We define the propositional truncation, inh A, of a type A by the rules: with the equalities squash(u 0 , u 1 , 0) = u 0 and squash(u 0 , u 1 , 1) = u 1 .
As before, we add composition as a constructor, but only in the form 8Γ, ϕ, i : This provides only a definition of comp i (inh A) [ϕ → u] u 0 in the case where A is independent of i, and we have to explain how to define the general case.
In order to do this, we define first two operations Γ, i : where S is the system and δ = ∀i.ϕ,using Lemma 2.
Using these operations, we can define the general composition Γ, i : Given Γ ⊢ B and Γ ⊢ q : (x y : B) → Path B x y and f : A → B we define g : inh A → B by the equations 10 Related and future work Cubical ideas have proved useful to reason about equality in homotopy type theory [18].In cubical type theory these techniques could be simplified as there are new judgmental equalities and better notations for manipulating higher dimensional cubes.Indeed some simple experiments using the Haskell implementation have shown that we can simplify some constructions in synthetic homotopy theory. 9 Other approaches to extending intensional type theory with extensionality principles can be found in [2,23].These approaches have close connections to techniques for internalizing parametricity in type theory [5].Further, nominal extensions to λ-calculus and semantical ideas related to the ones presented in this paper have recently also proved useful for justifying type theory with internalized parametricity [4].
The paper [11] provides a general framework for analyzing the uniformity condition, which applies to simplicial and cubical sets.
Large parts of the semantics presented in this paper have been formally verified in NuPrl by Mark Bickford 10 , in particular, the definition of Kan filling in terms of composition as in Section 4.4 and composition for glueing as given in Section 6.2.
Following the usual reducibility method, we expect it to be possible to adapt our presheaf semantics to a proof of normalization and decidability of type checking.A first step in this direction is the proof of canonicity in [14].We end the paper with a list of open problems and conjectures: 1. Extend the semantics of identity types to the semantics of inductive families.
2. Give a general syntax and semantics of higher inductive types.
3. Extend the system with resizing rules and show normalization.Acknowledgements This work originates from discussions between the four authors around an implementation of a type system corresponding to the model described in [6].This implementation indicated a problem with the representation of higher inductive types, e.g., the elimination rule for the circle, and suggested the need of extending this cubical model with a diagonal operation.The general framework (uniformity condition, connections, semantics of spheres and propositional truncation) is due to the second author.In particular, the glueing operation with its composition was introduced as a generalization of the operation described in [6] transforming an equivalence into a path, and with the condition A = Glue [] A. In a first attempt, we tried to force "regularity", i.e., the equation transp i A a 0 = a 0 if A is independent of i (which seemed to be necessary in order to get filling from compositions, and which implies Path = Id).There was a problem however for getting regularity for the universe, that was discovered by Dan Licata (from discussions with Carlo Angiuli and Bob Harper).Thanks to this discovery, it was realized that regularity is actually not needed for the model to work.In particular, the second author adapted the definition of filling from composition as in Section 4.4, the third author noticed that we can remove the condition A = Glue [] A, and together with the last author, they derived the univalence axiom from the glueing operation as presented in the appendix.This was surprising since glueing was introduced a priori only as a way to transform equivalences into paths, but was later explained by a remark of Dan Licata (also presented in the appendix: we get univalence as soon as the transport map associated to this path is path equal to the given equivalence).The second author introduced then the restriction operation Γ, ϕ 9 For details see: https://github.com/mortberg/cubicaltt/tree/master/examples/ 10For details see: http://www.nuprl.org/wip/Mathematics/cubical!type!theory/ on contexts, which, as noticed by Christian Sattler, can be seen as an explicit syntax for the notion of cofibration, and designed the other proof of univalence in Section 7.2 from discussions between Nicola Gambino, Peter LeFanu Lumsdaine and the third author.Not having regularity, the type of paths is not the same as the Id type but, as explained in Section 9.1, we can recover the usual identity type from the path type, following an idea of Andrew Swan.As intermediate steps, we gradually build elements that satisfy more and more of the equations that the final elements t 1 and a 1 should satisfy.The construction of these is given in five steps.

A Details of composition for glueing
Before explaining how we can define them and why they are well defined, we illustrate the construction in Figure 5, with ψ = (j = 1) and ϕ = (i = 0) ∨ (j = 1) ∨ (i = 1).
We pose δ = ∀i.ϕ(cf.Section 3), so that we have that δ is independent from i, and in our example δ = (j = 1) and it represents the right-hand side of the picture.
unglue b 0 Step 5: a 1 Step 1: a ′ natrec a b : (x : N) → P Type equality, Γ ⊢ A = B (Congruence and equivalence rules which are omitted) Term equality, Γ ⊢ a = b : A (Congruence and equivalence rules are omitted)

Figure 1 :
Figure 1: Inference rules of the basic type theory

4 .
Is there a model where Path and Id coincide?