Internal Parametricity for Cubical Type Theory

We define a computational type theory combining the contentful equality structure of cartesian cubical type theory with internal parametricity primitives. The combined theory supports both univalence and its relational equivalent, which we call relativity. We demonstrate the use of the theory by analyzing polymorphic functions between higher inductive types, observe how cubical equality regularizes parametric type theory, and examine the similarities and discrepancies between cubical and parametric type theory, which are closely related. We also abstract a formal interface to the computational interpretation and show that this also has a presheaf model.


Introduction
In the past decade or so, the study of dependent type theory has been transformed by a growing recognition of the importance of contentful (or proof-relevant) equality. At its root, the idea is simple: a proof of an equality is a piece of data. To go a bit a farther, a proof of equality may play a non-trivial role in computation. From the type-theoretic perspective, where the computational content of proofs has always been emphasized ("proofs as programs"), it is completely natural to think of equality this way. Nevertheless, it has been common to treat proofs of equality as irrelevant: we prove equalities to check code correctness or to prove a theorem, but we do not expect those proofs to influence how our code runs.
That expectation was shaken by Hofmann and Streicher's groupoid model [HS98] of Martin-Löf's intensional type theory (ITT) [ML75]. Intensional type theory includes the identity type: for every type A and elements M, N ∈ A, there is a type Id A (M, N ) whose elements are proofs that M and N are "equal". (We henceforth call these elements identities or identifications.) Hofmann and Streicher's model is designed to falsify the principle of uniqueness of identity proofs, which states that all proofs of a given identity are themselves identical. They thereby show that this principle is, oddly enough, independent of ITT. Far from being a contrived counter-model, the groupoid model demonstrates that contentful equality arises quite naturally in mathematics. Hofmann and Streicher highlight isomorphism as the premiere example: two isomorphic sets are essentially "the same", but the same two sets can be isomorphic in many different ways. Awodey and Warren [War08,AW09] and van den Berg and Garner [vdBG12] generalized the groupoid model construction to produce models where there are not only distinct proofs of identities, but distinct proofs of identities between proofs of identities and so on. Voevodsky, who was separately developing a simplicial model with similar properties [KL12], proposed to extend ITT with his univalence axiom, which asserts precisely that identifications between types correspond to isomorphisms.
Voevodsky's univalence axiom codifies a kind of reasoning that is already ubiquitous in informal mathematics, that of treating isomorphic objects as interchangeable. In fact, the axiom has far-reaching consequences, as subsequently explored in the fields of homotopy type theory [Uni13] and univalent foundations [Voe15, VAG + ]. As a simple but characteristic example, it implies function extensionality as a corollary: functions are identical when they are identical on all arguments [Uni13,§4.9]. Analogous extensionality principles for equality in coinductive types (e.g., [ACS15]) and quotients (e.g., [KvR19]) follow as well. In short, univalence regularizes the behavior of equality throughout type theory.
Of course, there is one sense in which univalent ITT is spectacularly ill-behaved: by introducing an axiom, we destroy the computational content of type theory. There is no way to run a program written in ITT that uses the univalence axiom, because the "proof" of the axiom does not compute. This was finally addressed by the development of cubical type theories [CCHM15, AFH18, OP18, ABC + 19, CMS20], a family of univalent type theories (with constructive models) where the univalence axiom follows from more fundamental primitives that do compute. The central principle of cubical type theory is that equalities in a type A-now called paths-are represented by maps from an interval object I into A.
Cubical type theory will be our starting point, our setting to explore contentful equality. In this work, we develop internal parametricity as an effective tool to reason about contentful equality, which-despite its remarkable usefulness-presents new difficulties as well.
The challenges of contentful equality. As users of ITT have long known, a lack of uniqueness of identity proofs has some frustrating consequences. To put it pithily, when equalities are not always equal, we sometimes need to prove that they are. For example, we typically need to know that composition of equalities (i.e., transitivity) is associative. When we have contentful equality in mind, these "coherence" proofs are mathematically significant, but their proofs are often tedious, uninteresting, and difficult to conceptualize, especially as one gets to the point of proving equalities between equalities between equalities.
The problem is most acute when we work with quotients. In cubical type theory, as in homotopy type theory and the univalent foundations, inductive types and quotient types both arise as specializations of higher inductive types [Uni13,CHM18,CH19a]. Where an inductive type is defined by constructors that generate elements of the type, a higher inductive type is defined by a specification of element and path constructors. As a simple example, we can specify the type Z/2Z of integers mod 2 in cubical type theory as the following higher inductive type.
The first constructor of this type is standard: whenever we have an integer n : Z, we get in(n) ∈ Z/2Z. The second is a path constructor: whenever we have n : Z, we get a path from in(n) to in(n + 2). That path is represented by a term mod(n, x) depending on an interval variable x, together with equations declaring that mod(n, 0) is in(n) and mod(n, 1) is in(n + 2). The interval is to be thought of roughly as the real interval from analysis: as x : I varies from 0 to 1, the constructor mod(n, x) draws a line from in(n) to in(n + 2). Pictorially, we have something like the following.
To construct a map from Z/2Z to another type, we simply explain where to send in(n) and mod(n, x), just as in ordinary induction. For example, the increment map inc ∈ Z/2Z → Z/2Z is defined by the clauses inc(in(n)) := in(n + 1) and inc(mod(n, x)) := mod(n + 1, x). In order for the definition to be sensible, we need to check that inc(mod(n, 0)) = inc(in(n)) and inc(mod(n, 1)) = inc(in(n + 2)). Similarly, we can define addition by an iterated induction of the following form.
in(m) + in(n) := in(m + n) mod(m, x) + in(n) := · · · in(m) + mod(n, y) := · · · mod(m, x) + mod(n, y) := · · · The final clause of this definition depends on two interval variables x, y : I. We can visualize it as a square with a boundary determined by the other clauses. Finding a term to fill this square is not so simple, particularly if the edge clauses are already defined in a complicated way. Iterated induction on higher inductive types is a frequent source of such coherence obligations. Particularly notorious instances, which will serve as a test case in this paper, are proofs establishing the algebraic structure of the smash product [Uni13, §6.8]. The smash product ∧ * is a binary operator on pointed types, pairs A * = A, a 0 of types A equipped with a chosen "basepoint" element a 0 ∈ A. We will define the product in Section 3.4; for now, it suffices to know that we define its underlying type as a higher inductive type. The smash product is a natural notion of tensor product for the category of pointed types. In particular, suppose we write A * → B * for the type of basepoint-preserving functions between pointed types A * and B * , which we can make into a pointed type A * → * B * by taking the unique basepoint-preserving constant function as its basepoint. Then we have a (pointed) isomorphism A * → * (B * → * C * ) (A * ∧ * B * ) → * C * . The smash product appears as a We will indeed be able to use parametricity to characterize types of this form, showing that their only inhabitants are identity and constant functions.
Internalizing parametricity. Rather than constructing a model and showing that the denotations of terms satisfy parametricity properties, as Reynolds did, we follow Bernardy, Coquand, and Moulin's recent work [BM12,BM13,BCM15,Mou16] by internalizing parametricity as part of our type theory. Bernardy and Moulin introduce so-called parametricity primitives, new type and term formers that make it possible to prove theorems such as the following.
(f :(A:U) → A → A) (A:U) (a:A) → Id A (f Aa, a) Notably, these primitives have a computational interpretation. We take the ideas of internal parametricity and apply them to contentful equality, producing a parametric cubical type theory.
Internalizing parametricity has the advantage of allowing us to use parametricity results without going outside the theory. It is, moreover, coherent with the perspective that leads us to the univalence axiom. From one angle, univalence serves to internalize the action of type-theoretic constructions on isomorphisms. In much the same way, internal parametricity expresses the action of constructions on relations. We are not the first to remark on the similarity between the two-both Atkey et al. and Bernardy et al. make the observation-but we will endeavor here to sharpen the comparison. Parametric type theory bears a strong resemblance to cubical type theory, particularly as presented by Bernardy, Coquand, and Moulin (BCM) [BCM15]. We will explore that resemblance here, with special attention to the points at which cubical and parametric type theory diverge.
Contributions. Our results can be divided into several camps, depending on how they relate to the interplay between internal parametricity and cubical equality.
First, we establish that parametricity primitives can in fact be added to cubical type theory. Our combined type theory is grounded in a computational interpretation in the style of Allen [All87], following the work of Angiuli et al. for cubical type theory [AFH18]. Starting from the computational interpretation, we abstract a formal, generalized algebraic type theory. We show that this theory also has interpretation in (some variety of) Kan bicubical sets. In all these constructions, the cubical side is already fairly well understood, so we focus on the parametricity primitives.
Next, we come to applications. On the one hand, we use internal parametricity as a tool for proving theorems in cubical type theory. Here, the smash product is our representative example of a higher inductive type with complex algebraic structure. We show that in internally parametric type theory, we can obtain the higher coherence properties of the smash product in a uniform way. While the proofs are still not trivial, they are distinguished from the prior work by their scalability: it is not much more difficult to obtain n-coherent structure than 1-coherent structure.
On the other hand, we use the well-behaved equality of cubical type theory to regularize parametric type theory. Just as cubical equality produces an extensionality principle for function types, it implies extensionality principles for the parametricity primitives. In the presence of univalence, we can also make do with a weaker version of Gel-types, the other parametricity primitive, than is used in the BCM theory. This allows us to give a simpler model of the theory, avoiding the technical device of refined presheaves used in the BCM model. Finally, we compare the design principles underlying cubical and parametric type theory. In both cases, some kind of structures on pairs of types are represented by maps out of an interval object. In cubical type theory, the structures are isomorphisms; in parametric type theory, they are relations. As we will see, parametric type theory has its own analogue of the univalence axiom. However, in parametric type theory it is key that relations are represented by affine, not structural, maps out of the interval object. This puts parametric type theory in especially close correspondence with the Bezem-Coquand-Huber (BCH) cubical set model [BCH13], the first constructive model of univalent type theory. Conversely, an affine path interval does not give rise to a particularly well-behaved contentful equality, being particularly problematic for modeling higher inductive types; the BCH model has largely been supplanted by structural cubical type theories and models.
Outline. We begin by informally reviewing cubical type theory in Section 1, closely following the presentations of Angiuli et al. [AFH18, ABC + 19, Ang19]. In Section 2, we mix in the parametricity primitives. As we go, we compare the components of internal parametricity to their cubical counterparts.
In Section 3, we put the theory to work, going through a variety of examples that display first ordinary internal parametricity, then the regularizing effects of cubical equality, and finally the application of parametricity to the problem of the smash product. In particular, we show how the interaction between the parametricity primitives and inductive types can be characterized using the relational equivalence of univalence. We also define and explore the properties of the sub-universe of bridge-discrete types, which plays a role in internal parametricity analogous to that of the identity extension lemma in external parametricity. Some of our results are already valid in non-cubical parametric type theory but are observed for the first time here.
We get precise about the theory beginning in Section 4, where we lay out its computational interpretation. In Section 5 we abstract a generalized algebraic formal type theory which has the computational interpretation as a model, and in Section 6 we describe a second model in Kan cartesian-affine bicubical sets. We consider related work and future directions in Section 7.

Cubical type theory
Cubical type theory is an extension of Martin-Löf type theory with an explicitly contentful equality. These equalities are called paths, as they intuitively mimic the notion of path from topology. To wit, a path in a topological space X is a function p : I → X from the unit interval I = [0, 1] into X. Such a path connects the endpoints p(0), p(1) ∈ X. In cubical type theory, we likewise have a type-like object, the interval "I", which contains two distinguished constants 0, 1. We express paths by hypothesizing interval variables: a path in a type Γ A type is a term Γ, x : I P ∈ A depending on an interval variable x. The path connects two endpoints, Γ P [0/x] ∈ A and Γ P [1/x] ∈ A, obtained by substituting the constants 0, 1 for the interval variable. This judgmental notion of path is internalized by path types. Beyond this basic apparatus, every type in cubical type theory supports Kan operations, called coercion and composition, which are used to manipulate paths. Coercion transports terms between types that are connected by a path; composition implements 5:8

E. Cavallo and R. Harper
Vol. 17:4 operations such as transitivity and symmetry of paths. Finally, additional machinery is required to obtain univalence, the correspondence between paths of types and isomorphisms. We follow Angiuli et al.'s account of cubical type theory [AFH18, ABC + 19], known as cartesian cubical type theory. Other cubical type theories and models [BCH13, CCHM15, Awo18, OP18, CMS20] vary in their treatment of the interval and formulation of the Kan operations. Although we commit to one theory here for simplicity, we expect that this paper can be replayed without difficulty using any other.
To begin at the beginning, cubical type theory is-like Martin-Löf's type theories [ML75,ML82]-based on four judgments: A is a type, A and B are equal types, M has type A, and M and N are equal elements of type A, all relative to a context Γ of typed variables.
A final judgment Γ ctx (Γ is a context) specifies the well-formed variable contexts, which are lists of assumptions of the form a : A (a ranges over terms of type A) among others we will introduce in a moment. (We will follow standard practice in omitting the prefix Γ from judgments when the context is irrelevant to the discussion.) Note that the equality judgments express an external, contentless equality, which is distinct from the contentful path equality. The external "exact" equality is necessary on the judgmental level, but it need not be accessible from within the theory. It is useful to further introduce a substitution judgment Γ γ ∈ Γ (with equality counterpart Γ γ = γ ∈ Γ); a substitution is a list γ = (M 1 /a 1 , . . ., M n /a n ) instantiating each variable in Γ with a term over the variables in Γ . We write N γ for the application of γ to a term N , that is, the result of replacing each occurrence of a i in N with M i . Each of the judgments above is preserved by substitution; for example, if Γ γ ∈ Γ and Γ M ∈ A, then Γ M γ ∈ Aγ. We think of these judgments as speaking about programs A, B, M, N in some untyped language with an operational semantics. They are behavioral specifications: Γ A type means that for any instantiation of the hypotheses Γ, the program A computes a value that names some specification. Likewise, Γ M ∈ A means that M computes to a value satisfying the specification computed by A. We use the notation and ∈ (as opposed to the typical and :) to indicate that we are speaking about this computational interpretation; we will develop a purely formal counterpart for the theory in Section 5. For the moment, we will be vague about the exact meaning of "computes" in the cubical setting, in the interest of first giving a sense of the shape of cubical and parametric type theory. We lay out the computational interpretation in detail in Section 4. Until that point, we describe the system by presenting inference rules that will turn out to be true in the semantics; note that these are theorems, not definitions.
1.1. The interval. Cubical type theory adds a new form of judgment, Γ r ∈ I (r is an interval term), and its associated equality judgment Γ r = s ∈ I. The two endpoints are interval terms, and we can add interval variables to the context.
Interval variables behave just like term variables, at least in the sense that they are structural : we have weakening, contraction, and exchange principles, as embodied by the following Path-Form We may also exchange interval variable assumptions with term variable assumptions when it makes type sense to do so. The contraction and exchange substitutions may be derived from the following more fundamental rule, which allows us to extend a substitution by a path interval term.
Finally, cubical type theory includes one more way to extend the context: with a constraint, an assumption that two interval terms are (exactly) equal. These become relevant when we introduce composition below.
Once again, we have weakening, exchange, and contraction for constraints. Aside from these additions, the judgmental apparatus of cubical type theory matches ordinary Martin-Löf type theory. We take standard type formers (functions, products, universes) for granted and proceed to the novel components: Path-types, the Kan operations, V-types (which underlie univalence), and higher inductive types.
1.2. Path-types. Path-types simply internalize dependence on an interval variable, much as function types internalize dependence on a term variable. When we have a type x : I A type depending on an interval variable x and elements M 0 ∈ A[0/x] and M 1 ∈ A[1/x] inhabiting its endpoints, we can form the type Path x.A (M 0 , M 1 ) of paths from M 0 to M 1 over x.A. Recall that the univalence axiom, which we will validate in due time, identifies paths between types with isomorphisms. With that intuition in mind, we think of an element of Although many theorems rely on the Kan operations introduced in the next section, we can observe some basic facts about paths already. First, we have reflexive paths given by interval variable weakening.
Second, functions act on paths. Note that we also use weakening here when we apply F in a context extended with x : I.
Finally, we have function extensionality: functions are path-equal when they are pointwise path-equal. Although function extensionality is a (non-trivial) consequence of univalence [Uni13, §4.9], cubically it follows more directly from exchange of term and interval variables.
It is easy to see that this function is an isomorphism-its inverse simply exchanges the arguments in the opposite order. The preceding argument can more generally characterize Path x.(a:A)→ B (F 0 , F 1 ) when B depends on x, but not when A does: if A depends on x, then the type "(a:A) → Path x.B (F 0 a, F 1 a)" is nonsensical. In the most general case, we can instead construct a map taking paths between functions to functions from paths to paths: "equal functions take equal arguments to equal results."   Constructing an inverse to this function will require the coercion operator introduced in the following section.
1.3. Kan operations: coercion and composition. The judgmental path structure of cubical type theory endows each type with a "path" relation. So far, this relation is not quite a proper notion of equality. For one, while it is reflexive, it need not be symmetric or transitive. Perhaps more importantly, we do not know that type families respect paths in the following sense. If we have some family a : A B type and a path P ∈ Path A (M 0 , M 1 ), we expect that for every element of BM 0 , there is a corresponding element of BM 1 . If we think of B as a predicate on elements of A, we are saying that M 1 should satisfy the same properties as M 0 . In fact, we would expect that BM 0 and BM 1 are isomorphic. At the moment, however, we only know that there is a path x.B(P @x) from BM 0 to BM 1 . What we need, then, is one direction of the univalence axiom: the ability to transform paths between types into isomorphisms. This is effected by the coercion operator coe, which satisfies the first rule in Figure 2.
Given a term at some index r of a type path x.A, coercion produces an element at any other s. We can show that coe r s x.A (−) ∈ A[r/x] → A[s/x] is in fact an isomorphism. The full proof relies on composition, which we have not yet introduced, but we can at least see Homogeneous composition (which we will often just call composition) serves a more technical purpose: to evaluate coercions along lines of the form x.Path y.A (N 0 , N 1 ). For the moment, let us assume that A does not depend on x. In order to execute such a coercion, we must be able to adjust the endpoints of a given path by another pair of paths. That is, given M ∈ Path y.A (M 0 , M 1 ) and lines x.N 0 , x.N 1 fitting into the following shape, we should be able to produce a new, "adjusted" path shown as a dashed line below.
Homogeneous composition, written hcom, is a generalized form of this operation that adjusts the boundary of a term, a boundary being specified by a sequence of constraints on interval variables. As an example, the adjusted path above is obtained as the following composite.
y : I hcom 0 1 A (M @y; y = 0 → x.N 0 , y = 1 → x.N 1 ) ∈ A The general operator has the form hcom r s A (M ; ; it is characterized by the second rule of Figure 2. We use the notation − −−−−−− ξ i → x.N i to denote a finite list of constraint-line pairs ξ 1 → x.N 1 , . . . , ξ n → x.N n , implicitly quantifying over an indexing variable i. Like coercion, we define homogeneous composition by case analysis of the type argument. Where the special case involving a pair of constraints y = 0 and y = 1 on a single interval variable is enough for coercion in the path type, the general form becomes necessary to implement composition in the path type; the general form thus represents a "strengthened induction hypothesis". To handle coercion along x.Path y.A (N 0 , N 1 ) when A does depend on x, we can combine coercion and composition into a unified heterogeneous composition operator, com, which coerces an input across a type line while simultaneously adjusting by a boundary path along that line. Defined as follows, com satisfies the third rule shown in Figure 2.
) Both hcom and coe can be recovered from com, so the latter is may be taken as primitive instead, as in [CCHM15,AFH18]. Either way, the ability to decompose com into hcom and coe plays a key role in defining Kan operations for higher inductive types [CHM18,CH19a]. Coercion and composition are together referred to as the Kan operations, being inspired by the Kan condition of algebraic topology [Kan55]. For each type we wish to introduce to cubical type theory, we must explain how the Kan operations evaluate at that type. This can be carried out for all the standard type formers of Martin-Löf type theory (functions, products, inductive types, universes); we refer to Angiuli [Ang19] for a thorough accounting of those results.
Using coercion, we can prove the converse to Lemma 1.1: if two functions take equal arguments to equal results, then they are equal as functions.
). Essentially, given an interval variable x : I and an element a of A (at index x), we can extend the point a to a path over x.A by coercion.
Coercion and composition also give us an analogue of the Martin-Löf identity type elimination principle (often called "J") for paths. Proof. Define an auxiliary x : I, y : I Q ∈ A as follows.
Q := hcom 0 y A (P @0; x = 0 → .P @0, x = 1 → y.P @y) Set J a.p.C (N, P ) := coe 0 1 x.C[Q[1/y],λ I y.Q/a,p] (N ). This is slightly weaker than the elimination principle enjoyed by Martin-Löf's elimination principle, as it is not the case that J a.p.C (N, λ I .M ) = N ∈ C[M, λ I .M/a, p] in general; this equation may be shown to hold up to a path, but does not hold up to exact equality. One may separately introduce identity types to cubical type theory that do satisfy this principle, either via a special construction [CCHM15, ABC + 19] or as particular indexed inductive types [CH19a], and in this case one has Id A (M, M ) Path A (M, M ). By univalence, this isomorphism implies that path and identity types satisfy the same theorems; in particular, it justifies our citing theorems about identity types in homotopy type theory as theorems about path types going forward. Of course, these theorems are often more easily proven in cubical type theory by reasoning directly with paths.
1.4. V-types and univalence. The Kan operations account for one direction of the univalence axiom: the mapping from paths between types to isomorphisms. The inverse is defined using V-types, which produce paths in the universe from isomorphisms. 1 First, let us take the opportunity to define isomorphism precisely.
1 Some formulations of cubical type theory instead use Glue-types, which have V-types as a special case.
The points we make here about V-types apply equally well to Glue-types.  We say F is an isomorphism when it is equipped with a left and right inverse. While the V-type is used principally to convert isomorphisms to paths, it is a bit more general: it takes a path and an isomorphism and composes them to produce a new path. That is, if we have a path of types B in a direction x and an isomorphism I between some A and B[0/x], their V-type fits into the following ("V-shaped") diagram.
Rules for V-types are shown in Figure 3. We convert isomorphisms to paths in the universe by applying V with a degenerate path.
Here, x does not appear in B, so we are composing the isomorphism I with the reflexive path .B. This reflexive path corresponds to the identity isomorphism on B, so when we pre-compose with I we simply get a path corresponding to I.
We will not be using V-types directly in the future, only the univalence axiom that they enable. Rather, we introduce them here in order to make a comparison with their parametric equivalent in Section 2.4. For that purpose, let us give some intuition as to why V is formulated as it is. Univalence involves a "dimension shift": it takes a point in the type of isomorphisms and produces a path in the universe, which is an element one dimension higher. However, we cannot impose in the typing rule for V x (A, B, I) that A, B, I live "one dimension lower," i.e., are degenerate in x, because this property is not stable under substitution. For example, mod(M, x) may be degenerate in some y, but mod(M, x)[y/x] is certainly not degenerate in y[y/x]. All aspects of type theory should be stable under substitution, so this is a non-starter. Instead, we structure V r in such a way that it does not involve a dimension shift; both the input and the output vary in the direction r.
1.5. Higher inductive types. Finally, cubical type theory can include a variety of higher inductive types. These can be seen as a mutual generalization of inductive types and quotients; they are inductive definitions that permit path constructors in addition to ordinary constructors.
It is beyond the scope of this work to give a comprehensive account of higher inductive types in cartesian cubical type theory; for that, we refer to [CH19a]. We will instead go by way of example, expanding on the type Z/2Z of integers mod 2 specified in the introduction.
The mod constructor exemplifies the format of a path constructor: it takes one or more interval variables as arguments, and it has a specified boundary which can refer to its arguments and previous construtors. This specification indicates the following introduction and boundary rules for in and mod. The eliminator for Z/2Z naturally takes clauses to handle the in and mod cases. The mod case is required to cohere with the in case on its boundary, which ensures that every function out of Z/2Z takes in(n) and in(n + 2) to path-equal results.
When applied to a constructor, the eliminator steps accordingly as shown below.

Parametric type theory
We now proceed to add parametricity primitives to our cubical type theory. We follow the blueprint of Bernardy, Coquand, and Moulin (BCM) [BCM15], which is a substantial simplification of Bernardy and Moulin's original parametric theory [BM12]. The BCM parametric type theory has the same basic shape as cubical type theory: relatedness is represented by maps out of an interval object I. We henceforth refer to I as the path interval and I as the bridge interval ; we call maps out of I bridges, following [NVD17]. (As a general rule, we use boldface to distinguish bridge constructs from their path equivalents.) The connection between internal parametricity and cubical type theory has never been a secret; Bernardy and Moulin already remark on the similarity in [BM12], and later iterations of their work resemble cubical type theory even more strongly.
We go a bit further and compare the two in detail over the course of this section. First, there is the obvious difference: parametric type theory has no analogues of coercion and composition. More subtle is the difference between the two intervals I and I: the path interval behaves structurally, but the bridge interval is affine. This has two essential effects on the theory. First, it enables a "function extensionality" principle analogous to Lemma 1.2 that does not rely on coercion. Second, it means that we can avoid the V-shape of V-types, instead supporting a type former (Gel) that directly converts relations to bridges.
On a more mundane level, we present the parametricity elements using a notation more similar to that of cubical type theory. For a translation to Bernardy et al.'s (substantially different) notation, see Figure 10 on page 51. We start with a judgment Γ r ∈ I. Like the path interval, it is populated by two endpoint 0 and 1, and we can suppose bridge interval variables. Unlike path variables, however, we will only have weakening and exchange for the bridge interval: the contraction principle fails. The bridge interval is thus substructural, in particular affine.
The lack of contraction means that we cannot always apply a bridge variable substitution −[y/x] to a term M : if M already mentions y, this amounts to contracting y and x. What we have is fresh substitution: we can substitute a variable y for x in M when y does not occur in M (i.e., is apart from M ). To formulate fresh substitution for open terms, we define the following context restriction operation, roughly following Cheney's approach to nominal type theory [Che12]. Intuitively, given a context Γ and interval term r in that context, Γ\r is the part of Γ guaranteed to be apart from r: when r is a variable x, it includes all other bridge variables, all path variables, constraints that do not involve r, and those term variables that are introduced before r. The constants 0 and 1 are considered to be apart from everything. That is, we define Γ\r := Γ when Γ r = ε ∈ I for some ε ∈ {0, 1} and as follows otherwise.
(Γ, y : I)\x := Γ\x, y : I We then have the following rule for extending a substitution by a bridge interval term.
The restriction in the premises prevents us from deriving, in particular, the following contraction or "diagonal" substitution, which attempts to substitute the same bridge variable x for two distinct variables y and z.
x : I (x/y, x/z) ∈ (y : I, z : I) When working with a context of the form (Γ, x : I, Γ ), we therefore think of the variables in Γ as being apart from x: we are disallowed from substituting a term that mentions x for a variable in Γ: in a substitution. On the other hand, we can substitute terms that mention x for variables in Γ . In accordance with this intuition, we can exchange term variables past bridge variables in one direction but not the other, as witnessed by the following substitution.
In the domain of this substitution, a : A ranges over fewer terms: only those elements of A that are apart from x.
In keeping with the lack of contraction, we allow constraints only to identify bridge variables with constants, not with other variables.
We note that affine variables are also central to nominal sets [Pit13], where they are used to represent variable names in syntax. The BCH model of univalent type theory in 5:18

E. Cavallo and R. Harper
Vol. 17:4 Bridge-Form cubical sets [BCH13,BCH19] is also based on an affine interval (and has been presented in a nominal style by Pitts [Pit14]). We say more about the BCH model in Section 2.5.
2.2. Bridge-types. We define Bridge-types exactly as we define Path-types: elements of Bridge x.A (M 0 , M 1 ) are elements of A in an abstracted bridge variable x that agree with M 0 and M 1 on their endpoints. We give rules for Bridge-types in Figure 4. The only difference is that a bridge can only be applied to a fresh variable, in keeping with the judgmental structure: P @r makes sense when r is apart from P . 2.3. The extent operator. As we have mentioned, the first reason for using affine variables is connected to function extensionality. If we follow the standard relational model of type theory-more generally, the standard definition of a logical relation at function type-we expect the following isomorphism, a bridge equivalent of Lemmas 1.1 and 1.2.
To go from bottom to top, we can repeat the proof of Lemma 1.1 without issue. On the other hand, the proof of Lemma 1.2 relies on the presence of coe, which has no equivalent in parametric type theory. Instead, we will introduce a new operator to validate this principle, extent, which relies on the substructurality of the bridge interval. Rules for extent are displayed in Figure 5. The operator is essentially a fully applied version of the principle we are looking for.
As shown in the rule Extent-β, extent r evaluates by capturing the occurrences of r in its principal argument M . That is, extent x (M ; a 0 .F 0 a 0 , a 1 .F 1 a 1 , a 0 .a 1 .a.Ha 0 a 1 a) evaluates by passing M [0/x], M [1/x], and λ I x.M to H. That this is possible depends on affinity because λ I x.− does not necessarily commute with diagonal substitutions. Specifically, if we have some term M (x, y) that depends on two variables, we can get different results by abstracting before or after substitution as follows.
We call the operator extent because extent r (M ; · · · ) reveals the extent of the term M in the direction r: either r is a constant, in which case M is simply a point, or r is a variable x, in which case M is a point on a line λ I x.M in that direction.
The conditions under which Extent-β applies are somewhat subtle. In short, the requirement is that M not depend on any term variables that are not apart from x. For example, extent x (a; · · · ) can be reduced only when a appears prior to x in the context. Once again, this relates to the commutativity of substitutions and capture, in this case the difference between (λ I x.a)[Q(x)/a] and λ I x.(a[Q(x)/a]). Note, however, that an extent term containing no term variables always reduces, so this issue is invisible to the closed operational semantics; it is merely a matter of the degree to which we can extend the closed reduction rule to an equality for open terms.
We can show that bridge-funext is in fact an isomorphism, with inverse given by the bridge equivalent of Lemma 1.1. One inverse condition is Extent-β, while the other is an 5:20

E. Cavallo and R. Harper
Vol. 17:4 "η-principle for extent" that can be proven up to path equality using extent itself, much as dependent elimination for inductive types gives such weak η-principles.
given. Then we have the following.
We can also show that the function extensionality principle induces a corresponding principle for bridges in isomorphism types. We leave the proof to the reader; one can prove it using extent directly, but it also follows formally from Proposition 2.2 and the correspondence between bridges over path types and paths over bridge types.
2.4. Gel-types and relativity. Finally, we come to the equivalent of univalence in parametric type theory, which we call relativity: the correspondence between bridges of types and relations. One direction of the correspondence is given by Bridge-types: given a bridge of types x : I A type, we have a relation Bridge x.A (−, −) on A[0/x] and A[1/x] (which we henceforth simply write as Bridge x.A ). As with V-types for univalence, the inverse will be effected by introducing a new type constructor, which we call the Gel-type. These resemble the G-types of the BCH model, but apply to relations rather than isomorphisms, hence the name.
We provide rules for Gel-types in Figure 6. Unlike the V-type, the Gel-type directly converts relations to bridges of types: for any relation a 0 : A 0 , a 1 : over the corresponding Gel-type, while the elimination rule conversely turns such a bridge into a witness. When we have a relation in the form The problem of shifting dimensions in V-types, described in Section 1.4, is no longer an issue when we have affine interval variables; we can express degeneracy in r using the context restriction −\r. This is fortunate, as the trick for deriving univalence from V-types would not apply here. For univalence, we rely on the fact that the constant path λ I .B corresponds to the identity isomorphism on B; thus we can transform isomorphisms A B into paths by composing with λ I .B in a V-type. On the other hand, the constant bridge λ I .A does not necessarily correspond to the identity relation (i.e., the path relation Path B ); rather, it corresponds to the bridge relation Bridge B . In particular, λ I .U will correspond to λ A, B .(A × B → U), not λ A, B .(A B). Thus, a V-like type would only give us bridges for those relations that factor through the bridge relation on one endpoint-more generally, through some bridge x.B we already have in hand.
We only mean in the above to give some intuition for the difference between the affine and structural situation, not for example to prove beyond a shadow of a doubt that no ungel(x.Q)) ∈ Gel r (A 0 , A 1 , a 0 .a 1 .R) Figure 6: Rules for Gel-types.
Gel-like type can exist structurally. However, we note that in the bisimplicial set semantics of Riehl and Shulman's directed type theory [RS17], a similar setting, an issue of dimension shift does indeed prevent the existence of a universe where arrows correspond to relations [Rie18]. We now proceed to prove the relativity principle.
is an isomorphism.
Proof. As candidate inverse, we of course take λR.λ I x.Gel x (A 0 , A 1 , R).
First we show that this is a left inverse, i.e., that the following holds.
Let R : A 0 × A 1 → U be given. We need to construct a path in A 0 × A 1 → U, so we apply function extensionality and univalence. Then for every a 0 : A 0 and a 1 : A, we need an isomorphism Bridge x.Gelx(A 0 ,A 1 ,R) (a 0 , a 1 ) R a 0 , a 1 . This isomorphism is implemented exactly by the introduction and elimination forms of the Gel-type, and the inverse conditions hold (up to exact equality) by Gel-β and Gel-η. Now we show it is also a right inverse. Let C : Bridge U (A 0 , A 1 ) be given. We are asked to provide a square with the following boundary.
x y By "flipping" this square-i.e., using the correspondence between bridges of paths and paths of bridges given by exchange of variables-it suffices to show the following.
Now we apply univalence, converting the path type in the universe to a type of isomorphisms.
Here we use the fact that the constant paths λ I .A ε correspond to identity isomorphisms idiso(A ε ) across univalence. This reduces our goal to the following.
Finally we apply Proposition 2.3, reducing the goal once more.
This is a consequence of the left inverse condition we have already proven.
Note that the proof of relativity relies on univalence; not surprising, since it is an isomorphism between types that involve the universe. (It also relies directly on function extensionality, both for paths and bridges.) In [BCM15], which does not include univalence, relativity is instead ensured by imposing stronger equations on Gel-types-precisely the equations Bridge x.Gelx(A 0 ,A 1 ,R) = R and C = λ I x.Gel x (A 0 , A 1 , Bridge x.C@x ) required for the proof. (These equations are there named Pair-Pred and Surj-Typ.) These equations make it more difficult to construct a presheaf model, as we discuss further in Section 6.
2.5. Using affine variables for paths. Before we dive into using parametric cubical type theory, let us take one more moment to reflect on structural and substructural interval variables. We have seen why affinity is important for parametric type theory, but is structurality important for cubical type theory? The Bezem-Coquand-Huber model gives a partial negative answer: there is a model of univalent type theory in presheaves on the affine cube category [BCH13,BCH19]. While no one has attempted to design a type theory based on this model, it is plausible that it could be done.
Unfortunately, affine interval variables create problems for modeling higher inductive types. Consider, for example, the following extremely simple type, which has a single path constructor with no fixed boundary. This specification generates the following elimination principle and computation rule, which essentially says that maps out of line correspond to terms in a context extended with an interval variable. Γ, a : line The issue is in the computation rule, which applies the interval substitution −[r/x] to Q in . If our interval is affine, then this substitution will be nonsensical if Q in already mentions r. Moreover, it is not clear how to restrict the premises of interval-elim to ensure the substitution is sensible without ending up with an insufficiently powerful principle. On a more conceptual level, the line type is suspicious in an affine system in that structural maps out of line correspond to affine maps out of the interval. The problem of higher inductive types is one reason why research in cubical type theory and models has shifted from substructural to structural interval variables. There is also the fact that structural variables are simply easier to work with. Still, the BCH model does have some intriguing advantages; for one, univalence can be implemented in Gel-like rather V-like fashion, and the former admits simpler implementations of coercion and composition.

Applying internal parametricity
Now that we have laid out what we need of parametric cubical type theory, we can get started proving theorems. We will begin with a classic application of parametricity: relating inductive types to their Church encodings, in this case booleans.
3.1. Booleans. The Church booleans are the polymorphic binary operators, the elements of the type B := (A:U) → A → A → A. Clearly this type has at least two elements, λA.λt.λ .t and λA.λ .λf.f . It is a classical consequence of parametricity that these are the only two elements of B. Using internal parametricity, we can prove that B is indeed isomorphic to the standard type of booleans (bool).
Proof. It is easy to define functions F ∈ bool → B and G ∈ B → bool in either direction.
Moreover, it is easy to check by case-analysis that G(F b) is path-equal to b for any b : bool.
We use parametricity to prove the other inverse condition. Let some k : B along with A : U, t : A, f : A be given. We intend to show that F (Gk)Atf is path-equal to kAtf . We define a relation R ∈ bool × A → U as follows.
That is, R is the graph of λb.F bAtf . Abstracting a bridge interval variable x, we can apply k at the Gel-type corresponding to R. We see that tt and t are related by R: we have λ I .t ∈ R tt, t . Likewise, we have λ I .f ∈ R ff, f . We apply k at the two gel terms corresponding to these witnesses of the relation.
If we substitute 0 for x, each Gel and gel term reduces to its first term argument, leaving k(bool)(tt)(ff), which is Gk. Likewise, if we substitute 1, we get kAtf . When we bind x and project the relation witness from this term, we therefore wind up with the following.
By definition of R, this is exactly our goal: a path from F (Gk)Atf to kAtf . By function extensionality, we get a term in Path B (F (Gk), k).
This argument follows the shape of a classical parametricity proof: we define a relation, apply a function to related arguments (here represented by gel terms), and conclude that the outputs are also related (via ungel). We can apply similar arguments to characterize other Church encodings. For example, we can show that the type (A:U) → A → (A → A) → A is isomorphic to the natural numbers; in that case, we would also use extent to construct a bridge in the function type.
Note that because the system is predicative, it does not appear possible to simply define inductive types using Church encodings. In the absence of a primitive boolean type in U, B can only eliminate into small types (that is, types in the universe U). When there is a primitive boolean type, however, B inherits its properties: we can define functions from B into large type by induction by factoring through the map B → bool.
The picture gets more complex when we consider Church encodings that are parameterized over "external" types, such as the following encoding of the coproduct.
A classical proof would rely on the identity extension lemma [Rey83], which implies in particular that the relational interpretation of a closed type (A or B here) is the identity relation. This is not the case in BCM-style internal parametricity. In particular, the principle fails for the universe: the types Bridge U (A, B) and Path U (A, B) are not the same, as one is isomorphic to A × B → U and the other is isomorphic to A B.
If we focus our attention on small types, we will see that any concrete type A we can think of will satisfy Bridge A (a, b) Path A (a, b) for all a, b : A; however, there is no way to prove for an arbitrary A. We say that types that do satisfy this principle are bridge-discrete. We can show that the universe of bridge-discreteness types is well-behaved and closed under most type formers.
3.2. Bridge-discrete types. In any type, we have a canonical map from paths to bridges induced by coercion. A type is bridge-discrete when this map is an isomorphism.  Definition 3.4. Given A type, define isBDisc(A) type as follows.
isBDisc(A) := (a:A) (b:A) → isIso (Path A (a, b), Bridge A (a, b), loosen A ) As we mentioned in Section 2.4, the type isIso is always a proposition [Uni13, Theorem 4.3.2]; any two proofs of isIso are connected by a path. A function type with propositional codomain is again a proposition [Uni13, Example 2.6.2], so isBDisc(A) is a proposition. We define the universe of bridge-discrete types as U BDisc := (A : U) × isBDisc(A).
Before continuing, we recall some standard results from univalent type theory. The proofs we reference are conducted using Martin-Löf identity types, but can be readily adapted to cubical path types by way of Lemma 1.3.    Taken together, these results give us a convenient method for showing that a type is bridge-discrete without reference to loosen A .
Lemma 3.10. Suppose we have a family of maps with right inverses: A (a, b) and Path A (a, b) are isomorphic for all a, b : A, then A is bridge-discrete.
Proof. By Proposition 3.5, F ab is an isomorphism for all a, b : A. By Proposition 3.6, we conclude that (b : A) × Bridge A (a, b) and (b : A) × Path A (a, b) are isomorphic for all a : A. The latter is contractible by Proposition 3.9, so the former is contractible as well. Thus A (a, b) is an isomorphism for all b : A, so A is bridge-discrete by Proposition 3.6.
Lemma 3.11. Let A type and a : A B type be given. If B is bridge-discrete for all a : A, then we have the following isomorphism for all a 0 , a 1 : A, t : B[a 0 /a], t : B[a 1 /a], and p : Path A (a 0 , a 1 ). Proof. By Lemma 1.3, it suffices to prove the theorem when a 1 is a 0 and p is λ I . a 0 . In that case it follows from Remark 3.3 and the assumption that B is bridge-discrete.
Theorem 3.12. Given A type and a : A B type, if A is bridge-discrete and B is bridgediscrete for all a : A, then (a : A) × B is bridge-discrete.
Proof. Given t, t : (a : A) × B, we can characterize paths between t and t as pairs of paths between their components.
In the forward direction we have λp. λ I x.fst(p@x), λ I x.snd(p@x) , and in the reverse we have λ q 0 , q 1 .λ I x. q 0 @x, q 1 @x ; these are clearly inverses. We can repeat the proof to obtain an analogous characterization of bridges in (a : A) × B.
By assumption, we know that Path A (fst(t), fst(t )) and Bridge A (fst(t), fst(t )) are isomorphic via loosen A . To show that the product types are isomorphic, it then suffices to show the second component types are isomorphic over loosen A , i.e., that the following holds for all p : Path A (fst(t), fst(t )).
Theorem 3.13. Given A type and a : A B type, if A is bridge-discrete and B is bridgediscrete for all a : A, then (a:A) → B is bridge-discrete.
Theorem 3.14. If A type is bridge-discrete, then Path A (a, b) is bridge-discrete for all a, b : A.
Proof. Given p, q : Path A (a, b), We have the following chain of isomorphisms.
The first step is by reordering interval abstractions, the second by Remark 3.3, the third by assumption that A is bridge-discrete, and the fourth by reordering abstractions again.  Proof. We must define a right inverse to loosen bool ∈ Path bool (b, b ) → Bridge bool (b, b ) for every b, b : bool. For simplicity, we prove the case where b = tt and b = ff; the other cases follow by the same argument. In this case, we first need a function of the following type. We make use of the type Gel x (bool, bool, Path bool ), the bridge from bool to bool corresponding to the path relation. This type has two canonical elements given by reflexivity at tt and ff. tt x := gel x (tt, tt, λ I .tt) ff x := gel x (ff, ff, λ I .ff) Given x : I, we define an auxiliary function tighten x ∈ bool → Gel x (bool, bool, Path bool ) sending each b : bool to the corresponding such element.
To equate loosen bool (tighten(q)) with q, we need a term as follows.
inv ∈ (q:Bridge bool (tt, ff)) → Path Bridge bool (tt,ff) (loosen bool (tighten(q)), q) We again begin by defining an auxiliary function inv x of the following type.
We define inv x (b) by induction on b. When b is tt, we have the following chain of equalities.
x y tt ff tt ff (bridge-funext(loosen bool • tighten)@x)(q@x) q@x tt ff inv x (q@x)@y By Extent-β, the top of this square is equal to loosen bool (tighten(q))@x. We may therefore define inv := λq.λ I y.λ I x.inv x (q@x)@y.
The pattern of argument we used for bool generalizes to characterize the bridge types of other inductive types, and in particular to show that inductive types preserve bridgediscreteness. (We will see something like it again in Section 3.4.) The fact that relativity is used (via Gel-types) in these proofs is an interesting parallel to the use of univalence to characterize the path types of higher inductive types (e.g., [Uni13, §8.1]).
The bridge-discrete types are even closed under Gel-types, which means that we can also carry out parametricity arguments in U BDisc . For example, we can show that the Church encoding (A:U BDisc ) → fst(A) → fst(A) → fst(A) is also isomorphic to bool.

E. Cavallo and R. Harper
Vol. 17:4 Theorem 3.17. Let A 0 , A 1 type and a 0 : A 0 , a 1 : A 1 R type be given. If A 0 and A 1 are bridge-discrete and Ra 0 a 1 is bridge-discrete for all a 0 , a 1 , then Gel x (A 0 , A 1 , a 0 .a 1 .R) is bridge-discrete for all x : I.
Proof. Abbreviate G x := Gel x (A 0 , A 1 , a 0 .a 1 .R). We show Path Gx (g, g ) Bridge Gx (g, g ) for all x : I and g, g ∈ G x . Note that when x is an endpoint, this holds by the assumptions that A 0 and A 1 are bridge-discrete.
We apply extent at x, first with g and then with g . It then remains to show that for all a 0 , a 0 : A 0 , a 1 , a 1 : A 1 , q : Bridge x.Gx (a 0 , a 1 ), q : Bridge x.Gx (a 0 , a 1 ), and x : I, we have Path Gx (q@x, q @x) Bridge Gx (q@x, q @x) agreeing with the loosen A isomorphism when x = 0 and loosen B isomorphism when x = 1. By Proposition 2.3, it is enough to give an isomorphism Bridge x.Path Gx (q@x,q @x) (p 0 , p 1 ) Bridge x.Bridge Gx (q@x,q @x) (loosen A 0 (p 0 ), loosen A 1 (p 1 )) for every p 0 : Path A 0 (a 0 , a 0 ) and p 1 : Path A 1 (a 1 , a 1 ). By identity elimination (Lemma 1.3), we may assume that p 0 and p 1 are reflexive paths, in which case (with the help of Remark 3.3) we need to show the following for all q, q : Bridge x.Gx (a 0 , a 1 ).
Now we flip the binders on either side, leaving us to prove the following.
In other words, we need to show that Bridge x.Gx (a 0 , a 1 ) is bridge-discrete; this type is isomorphic to R by relativity, so we are finished by assumption.
3.3. The law of the excluded middle. As a corollary to the bridge-discreteness of bool, we can refute the law of the excluded middle for propositions. First, let us introduce a few variations on the excluded middle. The unrestricted excluded middle, LEM ∞ , is already refuted by univalence [Uni13, Corollary 4.2.7]. In short, we can obtain a contradiction by examining the action of LEM ∞ on the negation isomorphism not ∈ bool bool between bool and itself. In univalent type theory, it is therefore customary to restrict the law to propositions (Definition 1.5). The excluded middle for propositions, LEM −1 , is validated in the simplicial model of univalent type theory [KL20].
In parametric type theory, however, even this law is refuted. In fact, we can contradict the weak excluded middle, WLEM, which applies only to negated types. It follows from function extensionality that negated types are always propositions, so we have LEM −1 → WLEM.
Lemma 3.18. If A type is bridge-discrete, then any function F ∈ U → A is constant.
Proof. For any pair of types B 0 , B 1 , we can apply F at the empty relation between them.
When A is bridge-discrete, this induces a path between F B 0 and F B 1 . Theorem 3.19. ¬WLEM.
Proof. Suppose we have w ∈ WLEM. By Lemma 3.18, we know that fst • w is constant, so fst(w ) and fst(w⊥) are equal. We obtain a contradiction by case analysis; clearly fst(w ) must be ff and fst(w⊥) must be tt.
For a deeper exploration of the relationship between parametricity and the excluded middle, we refer to Booij, Escardó, Lumsdaine, and Shulman [BELS16].
3.4. The smash product. Now we come to our motivating example: proving coherence laws for the smash product. In this section, we adopt some conventions for dealing with pointed types, elements of U pt := (A : U) × A. We give pointed types names like A * , B * , . . . and write A, B, . . . and a 0 , b 0 , . . . for their first and second components respectively. Given two pointed types A * , B * , the type of basepoint-preserving functions between them is defined as A * → B * := (f : A → B) × Path B (f a 0 , b 0 ). The identity function is a basepointpreserving function λa.a, λ I .a 0 ∈ A * → A * , and there is a unique pointed constant function λ .b 0 , λ I .b 0 ∈ A * → B * between any pair of pointed types. The type of pointed functions can itself be made a pointed type A * → * B * by taking the pointed constant function as basepoint, but we will not need this here. As with types, we write f * for basepoint-preserving functions, f for the underlying function, and f 0 for the proof that it preserves the basepoint. Finally, we write bool * for the booleans with basepoint tt.
The underlying type of the smash product is given by the following higher inductive type. data In words, A * ∧ B * is the ordinary product A × B quotiented by the relation collapsing together all elements of the form a 0 , b or a, b 0 . Elements of the former form are identified with a new "hub" point L , while elements of the latter are identified with a separate point R , producing a shape shown in Figure 7. We write A * ∧ * B * for the smash product viewed as a pointed type with basepoint ⟪a 0 , b 0 ⟫.
We will begin by focusing on the following theorem. In an effort to show we have nothing up our sleeves, we will avoid sweeping gory detailsthat is, coherence proofs-under the rug. However, we encourage the reader to focus on the broad strokes of the argument, and as such we will be less diligent about explaining the gory details.
The relations we use in the following will all be graphs of functions. As such, we introduce the following shorthand notation.  r (A, B, a.b.Path B (f a, b)). We prove a graph lemma (Lemma 3.25) that relates the smash product of Gr * -types with the action of the smash product on their underlying functions. First, the following two technical definitions will be handy for concisely filling coherence conditions.   The smash product has a functorial action on pointed functions, which we define as follows.
Definition 3.24. Given f * : A * → C * and g * : B * → D * , we inductively define a map f * ∧ g * ∈ A * ∧ B * → C * ∧ D * as follows. y)) := conc-inv y,0 C * ∧D * (spoke L (gb, y), z.⟪f 0 @z, gb⟫) (f * ∧ g * )(spoke R (a, y)) := conc-inv y,0 C * ∧D * (spoke R (y, f a), z.⟪f a, g 0 @z⟫) We now prove the graph lemma: that there is a map from the smash product of two Gr * -types to the Gr-type corresponding to the smash of their underlying functions. We expect that this map is in fact an isomorphism and that a similar principle holds for Gel-types more generally, but such results are not necessary here.
Lemma 3.25 (Graph Lemma for ∧). For any r ∈ I, there is a map to the identity function on A * ∧ * B * when r = 0 and on C * ∧ * D * when r = 1.
Proof. We define the map by induction on the smash product in the domain.
Case ⟪m, n⟫: We test whether r is a constant or variable using extent. In the constant cases, we return ⟪m, n⟫. In the case r is a variable x, we learn that m and n are the instantiation at x of bridges over their types; by Gel-η, they are of the form m = gel x (a, c, p) and n = gel x (b, d, q). We return gel x (⟪a, b⟫, ⟪c, d⟫, λ I z.⟪p@y, q@y⟫). Case L : We return gel r ( L , L , λ I . L ). Case R : Symmetric to L . Case spoke L (n, y): We test whether r is a constant or variable using extent. In the constant cases, we return spoke L (n, y). In the case r is a variable x, we learn that n is the instantiation at x of a bridge; by Gel-η, it is of the form n = gel x (b, d, q). We return gel x (spoke L (b, y), spoke L (d, y), λ I z. · · · ), where · · · is the following composite.
Case spoke R (m, y): Symmetric to spoke L (n, y). When r is a constant, the resulting function simplifies to the η-expansion of the identity function on A * ∧ B * . By a simple induction on A * ∧ B * , the η-expansion is path-equal to the identity function. We may therefore apply an hcom to adjust the boundary and obtain a function that is exactly the identity when r = 0 or r = 1.
Finally, we use the fact that bool * ∧ bool * is isomorphic to bool * . This is a consequence of more general facts-that bool * is a unit for the smash product, or alternatively that (1 + X) ∧ (1 + Y ) 1 + (X × Y ) when we take 1 for each basepoint-but we prove the 5:32

E. Cavallo and R. Harper
Vol. 17:4 special case directly for simplicity's sake. The importance of bool * arises from the fact that elements of a pointed type X * are in correspondence with pointed maps bool * → X * . As such, we can use naturality conditions with respect to functions bool * → X * to "probe" the behavior of a function polymorphic in pointed types, as we will see in Lemma 3.27.
Proof. In one direction, we define F ∈ bool → bool * ∧ bool * to send tt to ⟪tt, tt⟫ and ff to ⟪ff, ff⟫. In the other, we define G ∈ bool * ∧ bool * → bool to send ⟪ff, ff⟫ to ff and all other constructors to tt. Clearly G • F is the identity. For the other inverse condition, we show (s:bool * ∧ bool * ) → Path bool * ∧bool * (s, F (Gs)) by smash product induction as follows.
The following result, which characterizes terms F ∈ (A * , B * :U pt ) → A → B → A * ∧ B * , is the linchpin of the argument; all uses of internal parametricity in the final results factor through this lemma. As we only use internal parametricity with relations that are graphs of functions, this result may also be cast as a corollary of the naturality of such terms, a special case of parametricity. In particular, we use the following naturality square for a : A and b : B, where [c] * ∈ bool * → C * is the pointed function sending tt to c 0 and ff to c.
Proof. We show that the identity of F is determined by the value of F (bool * )(bool * )(ff)(ff). Let A * : U pt , B * : U pt , a : A, and b : B be given.
We have a function [a] * ∈ bool * → A * sending tt to a 0 and ff to a, likewise [b] * ∈ bool * → B * sending tt to b 0 and ff to b. Abstract a bridge variable x : I. We abbreviate G a * := Gr * x (bool * , A * , [a] * ) and G b * := Gr * x (bool * , B * , [b] * ). Applying F at G a * and G b * , we have the following.
F G a * G b * (gel x (ff, a, λ I .a))(gel x (ff, b, λ I .b)) ∈ G a * ∧ G b * At x = 0, this term is F (bool * )(bool * )(ff)(ff), and at x = 1 it is F A * B * ab. Now we apply the Graph Lemma to obtain a term in Gr x (bool * ∧ bool * , A * ∧ B * , [a] * ∧ [b] * ) with the same boundary. Finally, we apply ungel to extract a path from ([a] * ∧ [b] * )(F (bool * )(bool * )(ff)(ff)) to F A * B * ab. We therefore see that F is the pairing function if F (bool * )(bool * )(ff)(ff) is ⟪ff, ff⟫ and the constant function if it is ⟪tt, tt⟫; by Lemma 3.26, we are in one of these two cases.
Corollary 3.28. (A * , B * :U pt ) → A → B → A * ∧ B * is a set: any pair of paths between two elements of the type are path-equal.
Proof. Lemma 3.27 shows that the type is isomorphic to bool, which is a set.
This is everything we need to prove the final result.
Proof of Theorem 3.20. Let F * ∈ (A * , B * :U pt ) → A * ∧ * B * → A * ∧ * B * be given. To characterize F * , we need to characterize its behavior on each constructor of A * ∧ B * as well as the proof that it preserves the basepoint of A * ∧ * B * . First, by Lemma 3.27, we know that λ I a.λ I b.F A * B * (⟪a, b⟫) is either pairing or constant. The values of F A * B * L and F A * B * R must be path-equal to L and R respectively, as F is basepoint-preserving and L ( R ) is connected to the basepoint by spoke L (b 0 , −) (spoke R (a 0 , −)).
Next, observe that we can capture the behavior of F on spoke L by the following term, which is a path in (A * , B * :U pt ) → A → B → A * ∧ * B * between λA * .λB * .λ .λ .F A * B * L and λA * .λB * .λ .λb.F A * B * (⟪a, b⟫). λ I y.λA * .λB * .λ .λb.F A * B * (spoke L (b, y)) By Corollary 3.28, this path is path-equal to any other path in this type, in particular path-equal to whatever we need it to be to complete this proof. The same applies to R . Finally, we can apply the same trick for the basepoint path, writing it as a path in the type from Corollary 3.28 as follows.
λ I y.λA * .λB * .λ .λ .f 0 A * B * @y Now we argue that this strategy can be used to prove the n-ary generalization in a uniform way. (The binary version is in fact not very useful on its own; the direct proof of commutativity for the smash product is uncharacteristically straightforward, because the definition of ∧ is completely symmetric.) Theorem 3.29. Any function (A 0 * , . . . , A n * :U pt ) → (A 0 * ∧ * · · · ∧ * A n * ) → (A 0 * ∧ * · · · ∧ * A n * ) (associating ∧ * to the right) is either the polymorphic identity or the polymorphic constant pointed function.
Proof. We show by induction on i ≤ n + 1 that any is either given by iterated pairing or constant. For i = 0, it follows from a simple n-ary generalization of the workhorse lemma (instantiating each type argument with a graph and applying the binary Graph Lemma repeatedly). For i > 0, it follows from the induction hypothesis by the same argument as in the proof of Theorem 3.20.

E. Cavallo and R. Harper
Vol. 17:4 The key here is that we are never involved in an iterated induction on smash products: for each i in the proof of Theorem 3.29, we have an argument by induction on one occurrence of the smash product, but these arguments do not overlap.

Computational interpretation
We now develop the computational interpretation underlying parametric cubical type theory, building on the work of Allen for Martin-Löf type theory [All87] and Angiuli et al. for cartesian cubical type theory [AFH18]. We closely follow the presentation in Angiuli's thesis [Ang19]; we will give a reasonably complete tour through the definitions, but rely on [Ang19] for many results that are essentially unaffected by the addition of bridge intervals and parametricity primitives.
An interpretation in these frameworks is built from two components: a deterministic operational semantics on closed untyped terms and a value type system. The former explains the evaluation of terms; the latter explains which closed values are names for types and which closed values are elements of said types. Given these two components, we derive an interpretation of the open judgments-Γ A type and so on-by extending the value type system first to arbitrary closed terms (roughly, a term is well-typed when it evaluates to a well-typed value) and then to open terms (an open term is well-typed when its closed instances are well-typed).

4.1.
Interval contexts and terms. In the above and the following, closed refers to terms that do not contain term variables but that may contain interval variables. It is essential to consider evaluation of terms containing interval variables in order to accommodate the terms coe r s x.A (M ) and ungel(x.N ), which evaluate terms (here A and N ) under interval binders. We use Ψ to denote contexts consisting solely of path and bridge interval variables. Ψ ::= · | Ψ, x : I | Ψ, x : I We write Ψ ψ ∈ Ψ for interval substitutions, which take terms M in context Ψ to terms M ψ in context Ψ . As always, path interval variables are structural and bridge interval variables are affine; ψ cannot identify two bridge variables except by sending both to 0 or 1.
Definition 4.1. The path interval term judgment Ψ r ∈ I is defined to hold when either r ∈ {0, 1} or r = x where (x : I) ∈ Ψ; the bridge interval term judgment Ψ r ∈ I is defined likewise. The interval substitution judgment is then inductively generated by the following rules.
The judgment Ψ ξ constraint is likewise inductively generated by constraints of the form Ψ (r = s) constraint and Ψ (r = ε) constraint.  We give the defining rules for our operational semantics in Figure 8. We show only those rules that involve the parametricity primitives; for everything else, we refer to [Ang19, §4.1]. Although we choose a specific operational semantics here, the interpretation goes through for any operational semantics that extends it; we need only the presence of these rules, not the absence of others. 4.3. Judgments from a value type system. A value type system specifies the values that are names for types and the values that each such type classifies. For practical purposes, it 5:36

E. Cavallo and R. Harper
Vol. 17:4 useful to first introduce candidate value type systems and then impose additional conditions under which a candidate is an actual type system.
Definition 4.3. A candidate value type system τ is a quaternary relation τ (Ψ, V, V , ϕ) ranging over contexts Ψ, values V, V in context Ψ, and binary relations ϕ on values in context Ψ.
We read an instance τ (Ψ, V, V , ϕ) of the relation as specifying that (1) the values V and V are equal types in context Ψ and that (2) these type names stand for the relation ϕ: values W and W are equal elements of V (likewise V ) in context Ψ when ϕ(W, W ) holds.
Given a candidate value type system, we derive candidate judgments extending the defining relations to non-value terms. In [All87], a term is a type (resp. well-typed) when it evaluates to a type value (resp. well-typed value). In a setting with interval variables, it becomes necessary to require a stronger "coherent evaluation" condition: to be well-typed, a term must not merely evaluate to a well-typed value, but do so in a way that interacts in a sensible way with interval substitutions. First, we define "incoherent" extensions of value type systems and terms to terms.
Definition 4.4. Given a candidate value type system, we write τ ⇓ (Ψ, A, A , ϕ) for (possibly non-value) terms A, A to mean that A ⇓ V and A ⇓ V for some V, V with τ (Ψ, V, V , ϕ). Given a relation ϕ on values, we define a relation ϕ ⇓ on terms: To cut down to the coherently well-behaved types and terms, we introduce a notion of Ψ-relation, a family of relations indexed by the substitutions into Ψ.
We now define the coherent candidate judgments: Ψ A ∼ A ↓ α ∈ τ , which asserts that A and A coherently evaluate to equal type names standing for the Ψ-relation α, and Ψ M ∼ M ∈ α, which asserts that M and M coherently evaluate to values equal in α.
Definition 4.6. We define the candidate judgments as follows.
The conditions in the definition of Ψ A ∼ A ↓ α ∈ τ , for example, ask that we have the square shown below: whether we apply ψ 2 to Aψ 1 or first evaluate and then apply ψ 2 , we get the same result up to the equality defined by τ ⇓ .
Note that the candidate judgments are stable under interval substitution by definition: for example, if Ψ M ∼ M ∈ α, then Ψ M ψ ∼ M ψ ∈ αψ for any Ψ ψ ∈ Ψ. A candidate is a value type system when the typing relation satisfies several additional conditions, which require that each type names at most one relation, that the type and element relations are partial equivalence relations, and that any value type is coherently a type.
Likewise, we will require that the values related by the relations associated to types are in fact coherently related.
Given a value type system, we obtain typing judgments first on closed and then on open terms. For types, we also distinguish between pretypes and types, the latter of which are required to support Kan operations. For the following series of definitions, we fix an ambient value type system τ .
Definition 4.9. We define the closed judgments as follows.
We define Ψ A pretype to mean Ψ A = A pretype, likewise Ψ M ∈ A to mean Ψ M = M ∈ A. We will abbreviate future reflexive judgments in this fashion without comment. When we have Ψ A pretype, we write A for the (necessarily unique) value Ψ-relation assigned to A by the value type system.
We now extend the closed judgments to open judgments, defined on terms containing arbitrary variables. We do so by means of a context instantiation judgment Ψ γ = γ ∈ Γ, which specifies the ways a general context Γ may be instantiated by closed terms over Ψ.
The open type and term judgments are then defined to hold when their closed instantiations hold.
We define the open judgments as follows.
We note that, in contrast, we define the open interval judgments without reference to the terms in the context Γ. It is therefore not the case that, for example, v : ⊥ 0 = 1 ∈ I; interval judgments are prior to term judgments.
Definition 4.12. The judgment Γ r ∈ I is defined to hold when either r ∈ {0, 1} or (x : I) ∈ Γ; an equality Γ r = s ∈ I is defined to hold when Γ r, s ∈ I are in the equivalence relation closure of the constraints appearing in Γ. The judgments Γ r = s ∈ I and Γ ξ = ξ constraint are defined likewise. A pretype A is a (Kan) type when it supports the Kan operations, that is, when the operators coe and hcom are well-typed at A and satisfy the necessary equations. ψ ∈ Ψ, if Ψ r, s ∈ I, n ∈ N, Ψ ξ i constraint for all i < n, and The extension of the type judgment to open terms is defined as for the pretype judgment: Γ A = A type holds when Ψ Aγ = A γ type for all Ψ γ = γ ∈ Γ. We may also define the open substitution judgment following the pattern of the instantiation judgment.  Γ (γ, r/x) = (γ, r /x) ∈ (Γ, x : I) when Γ γ = γ ∈ Γ and Γ r = r ∈ I. Γ (γ, r/x) = (γ, r /x) ∈ (Γ, x : I) when Γ r = r ∈ I and Γ\r γ = γ ∈ Γ. Γ γ = γ ∈ (Γ, ξ) when Γ γ = γ ∈ Γ and ξγ is true. Now that we have laid out the extrapolation of open judgments from a value type system, it remains to construct a particular type system that will validate the inference rules we presented in Sections 1 and 2.
4.4. Constructing a value type system. We obtain a value type system by a fixed-point construction, first defining the least candidate value type system closed under our desired type formers and then showing that it constitutes a value type system. To start, we define the pieces corresponding to each type former. Relative to [Ang19], the novelties here are the Bridgeand Gel-types.
Next, we have an operator on candidate value type systems that applies one level of type formers.
Finally, we obtain a least fixed-point τ 0 of this operator by the Knaster-Tarski fixed-point theorem [DP02,2.35]. It is tedious but straightforward to check that this candidate value type system is in fact a value type system [Ang19, Lemma 4.8]. To construct a value type system with a universe, we can repeat the fixed-point construction with the addition of a type U interpreted by the relation τ 0 , producing a new type system τ 1 that is closed under the same type formers as τ 0 but also contains τ 0 as a universe. This can be repeated further to produce a hierarchy of value type systems τ 0 ⊆ τ 1 ⊆ τ 2 ⊆ · · · each containing its predecessors as universes; for our purposes, a single universe is sufficient.
As an immediate consequence of the way the typing judgments are defined, we have a canonicity theorem: any closed well-typed term is guaranteed to evaluate to a value of that type. In particular, any closed term of natural number type evaluates to a numeral. 4.5. Building up inference rules. With a value type system in hand, it remains to verify that the judgments are closed under the inference rules introduced in Sections 1 and 2. We go through the typing rules for Gel-types in detail. The rules for Bridge-types are simpler to verify, as the reduction rules are all "cubically stable": they do not depend on the status of any interval term. (In comparison, gel r (M 0 , M 1 , P ) may be a value or step depending on whether r is a variable or constant.) The rules for extent do involve unstable transitions, but require no ideas that are not present in the proofs for Gel-types; in particular, the hcom reduction for Gel involves extent-like variable capture. The reader may see [CH19b] for complete proofs of these results.
We rely on the following five lemmas to work with the candidate judgments. These are rephrasings of Lemmas A.2, A.3, and A.5 from [CH18]; each follows straightforwardly by unfolding definitions.  Lemma 4.18 (Coherent type expansion). Suppose A is a term and (A ψ ) Ψ ψ∈Ψ is a family of terms such that Aψ −→ * A ψ and Ψ  We now check the rules for Gel-types as presented in Figure 6. We prove that each rule holds when the ambient context is an arbitrary interval context Ψ. The open rules-for an arbitrary context Γ-then follow mechanically, as the open type and term judgments are defined by their closed instantiations.
It is convenient to prove the boundary reduction equations for a type or term former before the general introduction rule; for example, we show first Gel ε (A 0 , A 1 , a 0 .a 1 .R) = A ε pretype and then Gel r (A 0 , A 1 , a 0 .a 1 .R) pretype.
Proof. A combination of Lemma 4.22 and Gel-Intro, the latter of which shows that the relation for Gel is value-coherent. Proof. By Lemma 4.19: we have ungel(x.gel x (M 0 , M 1 , P ))ψ −→ P ψ for all ψ.
Ψ Gel r (A 0 , A 1 , a 0 .a 1 .R) = Gel r (A 0 , A 1 , a 0 .a 1 .R ) type Proof. We must check that Gel supports the Kan operations. We give the proof for hcom. Abbreviate G := Gel r (A 0 , A 1 , a 0 .a 1 .R) and G := Gel r (A 0 , A 1 , a 0 .a 1 .R ). Let Ψ ψ ∈ Ψ, Ψ r, s ∈ I, n ∈ N, Ψ ξ i constraint for all i < n, Ψ Q = Q ∈ Gψ, Ψ , y : I Q i = Q j ∈ Gψ for all i, j < n, and Ψ Q = Q i [r/y] ∈ Gψ for all i < n be given. If rψ is a constant, then we simply apply Gel-Form-∂ and Lemma 4.29 everywhere. Γ ctx Γ is a context Γ r : I r is a bridge interval term in context Γ Γ A type A is a type in context Γ Γ M : A M is a term of type A in context Γ Γ δ : ∆ δ is a substitution for context ∆ in context Γ Gψ follows from the fact that Ψ gel x (M 0,s , M 1,s , P ) = gel x (M 0,s , M 1,s , P ) ∈ Gψ, which holds by Gel-Intro-∂, Gel-Elim, and the assumption that the A ε and R are Kan. Ψ hcom r s G (Q; Gψ if ξ i is true follows by cases on ξ i . If x does not occur in ξ i , then ∀x.ξ i = ξ i . It follows by the boundary equations for hcom in A ε and R that the composite is equal to gel x (Q i [0/x], Q i [1/x], ungel(x.Q i ))[s/y], and this term is equal to Q i [s/y] by Gel-η. If x does occur in ξ i , then the constraint must be either Gψ holds by the corresponding Kan equations for the A ε and R together with Gel-Intro and Gel-η.

Formal parametric type theory
While we have anchored our type theory in a computational interpretation, we would also like to use parametric cubical type theory as a logic for reasoning about other settings. For this reason, we abstract a formal type theory from the collection of inference rules we have developed in the preceding sections. The proofs of those inference rules, as given for Gel-types in Section 4.5, establish that the computational interpretation is one model of the formalism. In Section 6, we see that the theory can also be interpreted in cartesian-affine bicubical sets.
We focus on parametric type theory here; for the cubical ingredients, we defer to prior work [Ang19, Appendix B]. In the pure parametric case, the theory is defined by the judgments shown in Figure 9 and their equality counterparts. We take care to ensure our definition constitutes a generalized algebraic theory (GAT) [Car86], using for example explicit substitutions. 2 Ensuring admissibility of substitution-that every term is equal to one containing no explicit substitutions-requires some innovation. In particular, the theory presented in [BCM15] does not satisfy admissibility of substitution, a consequence of the way rules using interval terms (such as bridge elimination) are formulated. Rectifying this issue motivates the introduction of the context restriction operator −\− we have already encountered. We present a formulation of context restriction as an explicit context former characterized as a left adjoint to extension by an interval variable. Ψ ε(Ψ) := (id Ψ , ε/x) ∈ (Ψ, x : I) induces a corresponding transformation ε ! : Id → (− ⊗ I) in the presheaf category interpreting the endpoint substitution subst-face.
6.3. Type and term formers. To interpret the rules for forming types and terms-Bridgetypes, Gel-types, and extent-it is useful to observe that the semantic judgments, like the computational ones in Section 4, are determined by their instantiations at interval contexts (i.e., representables). For example, a semantic type T in context G is determined by the types g * T for g : Ψ → G: recalling that the Yoneda lemma identifies morphisms g : Ψ → G with elements g ∈ G(Ψ), we have as we have T (Ψ, g) = (g * T )(Ψ, id Ψ ). Conversely, if we have a family of types T g over Ψ for every g : Ψ → G such that ( ψ) * T g = T g• ψ for all Ψ ψ ∈ Ψ, then this determines a type T over G: take T (Ψ, g) := T g (Ψ, id Ψ ). A similar principle applies to terms.
The upshot is that we may verify that rules hold in an arbitrary context by showing they hold (naturally) in any interval context, as we did for the computational interpretation in Section 4.5. In the restricted case we may take advantage of the characterizations Res ! ( Ψ, r) ∼ = (Ψ\r) and Ext ! ( Ψ) ∼ = (x/x) : (Ψ, x : I) → (x : I), saving us from formal reasoning with the general Kan extension. Proof. Per the argument above, we narrow our attention without loss of generality to the cases where the ambient context is representable.

Formation.
Let a semantic pretype T in context Ψ ⊗ I ∼ = (Ψ, x : I) be given together with endpoint elements t 0 of (0/x) * T and t 1 of (1/x) * T . We define a semantic pretype Bridge(T, t 0 , t 1 ) over Ψ as follows.

Introduction.
Similarly, given a semantic element t of T such that (1/x) * t = t 0 and (1/x) * t = t 1 , we have an abstracted element lam I (t) of Bridge(T, t 0 , t 1 ) defined as follows.

Elimination.
To interpret application, we assume now that we have some r : Ψ → (Ψ, x : I) and that the pretype T lies in context Res ! ( Ψ, r) ⊗ I ∼ = (Ψ\r, x : I). Given an element u of Bridge(T, t 0 , t 1 ), app I (u)(Ψ , ψ) := T (rψ/x)(u(Ψ \rψ, ψ\r)) Here Ψ \rψ ψ\r ∈ Ψ\r is the functorial action of restriction on ψ. By definition of the bridge type, the term u(Ψ \rψ, ψ\r) is an element of T ((Ψ \rψ, x : I), (ψ\r, x/x)); applying T (rψ/x) thus gives an element of T (Ψ , ψ). We leave it to the reader to check that these definitions are natural and that the β-, η-, and boundary rules are satisfied. We may show that the model interprets Bridge-types-that is, that Bridge-pretypes can be equipped with Kan operations-following the computational definition of coe and hcom in Figure 8; we leave this to the reader. Alternatively, one may follow the definition of composition for Path-types in the BCH model [BCH13, §7.2].
Theorem 6.13. [ op ca , Set] interprets Gel-pretypes. Proof. We prove the formation rule, following the computational definition in Section 4.4. It is straightforward to see how the introduction and elimination rules follow.
Gel r (T 0 , T 1 , R)(Ψ , ψ) := T ε (Ψ , ψ\r) if rψ = ε Gel r (T 0 , T 1 , R)(Ψ , ψ) := (a 0 , a 1 , t) a ε ∈ T ε (Ψ \rψ, ψ\r) t ∈ ( (ψ\r).(a 0 × a 1 )) * R(Ψ \rψ, id) otherwise As with Bridge-types, the Kan operations may be implemented following the computational definition given in Figure 8. We note that homogeneous composition relies on the closure of the decidable subobject classifier Ω dec under ∀x.−; this parallels the use of ∀x.− for composition in G-, Glue-, or V-types in [BCH13, CCHM15, ABC + 19]. As Bridge-types resemble BCH Path-types, so do Gel-types resemble BCH G-types. Coercion for Gel is, however, much simpler than for its cubical equivalents, because the "direction" of a coercion is always a path variable and therefore orthogonal to the direction r of Gel r (A, B, R): one may coerce "across" a V-type, but not across a Gel-type.
We finish by sketching the interpretation of extent. Suppose we are given dimension term r : Ψ → (x : I), type T in context (Ψ\r, x : I), and element t of (r/x) * T , together with clause data for the endpoint and variable cases. For any Ψ and Ψ ψ ∈ Ψ, we have t(Ψ , ψ) ∈ T (Ψ , (ψ, rψ/x)); we proceed by inspecting the status of rψ. If rψ is an endpoint, then we have t(Ψ , ψ) ∈ T (Ψ , (ψ, rψ/x)) = ( (ε/x) * T )(Ψ , ψ) and may pass this term to the appropriate endpoint clause. If rψ is a variable, then we employ the substitution Ψ \rψ, y : I ρ ∈ Ψ that renames rψ to a fresh variable y. We have T (ρ)(t(Ψ , ψ)) ∈ T ((Ψ \rψ, y : I), (ψ\r, y/x)), which per the proof of Theorem 6.12 is exactly a bridge at T . We may then supply this bridge to the variable clause of extent.
7. Related and future work 7.1. Related work. Mechanically, our parametric cubical type theory is not much more than the union of Angiuli et al.'s cartesian cubical type theory [AFH18, ABC + 19, Ang19] and Bernardy, Coquand, and Moulin's parametric type theory [BCM15]. As mentioned in Sections 2.4 and 6, we do drop some equations required for Gel-types in the BCM type theory which are not necessary in the cubical setting and complicate model constructions. Accordingly, our proof of relativity is novel. The formulation of context restriction in formalism is also novel, though inspired by Cheney's work on nominal type theory [Che12], and resolves the issue with admissibility of substitution present in the BCM theory. Finally, Bernardy et al. present unary rather than binary parametricity, but from a conceptual perspective this is only a cosmetic difference, a matter of how many constants are included in Bridge x.A (a 0 , a 1 ) A x a (∀x.A) a λ I x.a a · x ( x a)! p@x (a, x p) a, x p extent x (−; a 0 .t 0 , a 1 .t 1 , a 0 .a 1 .a.u) λa.t, x λa.λa.u |λa.t, x λa.λa.u| Gel x (A 0 , A 1 , a 0 .a 1 .R) (a : A) × x R A x R gel x (a 0 , a 1 , c) (a, x c) a, x p ungel(x.a) a · x ( x a)! Figure 10: Translation dictionary for internal parametricity the bridge interval. 3 As our notation is quite different from that of Bernardy et al., we provide a comparison in Figure 10. Note that the mapping is not one-to-one because of the additional equations imposed in their theory. We also include notations from Moulin's thesis [Mou16].
In that work, the notion of a function (i : I) → A without a fixed endpoint (called a "ray") is included separately from bridge types, and term formers that are primitive in [BCM15] are often implemented as combinations of terms relating first interval dependency to rays and then rays to bridges. In particular, A x R is syntactic sugar for a term A, Ψ A R @x, while |f, x h| is sugar for |f, Φ f h| @x; as a result, the equivalents of Gel and extent are sometimes called Ψ-and Φ-operators respectively in the literature. A second approach to internal parametricity has been proposed by Nuyts, Vezzosi, and Devriese [NVD17]. Their system resembles our own in that it is based on bridges and paths, each of which is represented by a kind of map from an interval. Whereas our bridge and path structures are more-or-less orthogonal to each other, Nuyts et al. use a modality to connect the two. Terms are checked under different modalities depending on whether they are used in type or element positions, capturing the phase separation between type and element-level computation that is often identified as a consequence of parametricity. We see the two approaches of Bernardy et al. and Nuyts et al. as internalizing different perspectives on parametricity: the former internalizes the relational interpretation, while the latter internalizes this phase separation.
Nuyts et al. also distinguish between continuous and parametric function types: the former preserve paths and bridges, while the latter take bridges to paths. By contrast, we consider the former to already be "parametric"-as we have seen, one can prove parametricity theorems in our setting using only this property. However, the stronger condition does obviate the need to identify the class of bridge-discrete types as a replacement for the identity extension lemma. For example, any parametric function U → A in their setting is constant, without any assumptions on A (cf. Lemma 3.18), because it takes the bridges in U to paths. Also notable is that their path and bridge intervals both behave structurally, whereas we use an affine interval for bridges. Given the other divergences from Bernardy et al.'s approach, it is difficult to say how the issues we raise with using structural variables for parametricity affect their system, if at all; it seems that they are ameliorated by the stronger condition on parametric functions. One notable limitation is that iterated parametricity is impossible, that is, the results produced by parametricity are not subject to further parametricity theorems.