Contents

# Contents

## Idea

In dependent type theory, a heterogeneous identity type or dependent identity type is a version of the identity type where given a type $A$, a type family $x:A \vdash B(x)$, terms $a:A$, $b:A$, and an identification $p:a =_A b$, the heterogeneous identity type between two elements $y:B(a)$ and $z:B(b)$ is a type whose elements witness that $y$ and $z$ are “equal” over or modulo the identification $p$.

### Note on terminology

There are many different names used for this particular dependent type, as well as many different names used for the terms of this dependent type. These include the following:

name of typename of terms
heterogeneous identity typeheterogeneous identities
heterogeneous path typeheterogeneous paths
heterogeneous identification typeheterogeneous identifications
heterogeneous equality typeheterogeneous equalities

These four names have different reasons behind the use of the name:

• The name “heterogeneous identity type” comes from the fact that the dependent identity type is the canonical one-to-one correspondence $x:B(a), y:B(b) \vdash \mathrm{Id}_B^p(x, y)$ of the transport equivalence $\mathrm{tr}_B^p:B(a) \simeq B(b)$ on a type family $x:A \vdash B(x)$ and an identification $p:a =_A b$, which is the dependent/heterogeneous version of the identity type for the identity equivalence $\mathrm{id}_A:A \simeq A$

• The name “heterogeneous path type” comes from the fact that, in a context where terms of ordinary identity types can be represented as functions from an interval type, the terms of the heterogeneous identity type can similarly be represented as dependent functions from the interval type. For instance, this is true in some categorical semantics and in cubical type theory.

## Definitions

### Using identity types

There are many different ways to define heterogeneous identity types. The simplest definition states that given a type family $x:A \vdash B(x)$, heterogeneous identity types are an inductive family of types

$a:A, b:A, p:\mathrm{Id}_A(a, b), y:B(a), z:B(b) \vdash \mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$

generated by the family of elements called “heterogeneous reflexivity”

$a:A, y:B(a) \vdash \mathrm{hrefl}_{x:A.B(x)}(a, y):\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)$

#### Inference rules

The inference rules for forming heterogeneous identity types and terms are as follows. First the inference rule that defines the heterogeneous identity type itself, as a dependent type, in some context $\Gamma$.

Formation rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:\mathrm{Id}_A(a, b) \quad \Gamma \vdash y:B(a) \quad \Gamma \vdash z:B(b) \end{array} }{\Gamma \vdash \mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \; \mathrm{type}}$

Now the basic “introduction” rule, which says that everything is equal to itself in a canonical way.

Introduction rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \mathrm{hrefl}_{x:A.B(x)}(a, y):\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)}$

Next we have the “elimination” rule:

Elimination rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), y:B(a), z:B(b), q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \vdash C(a, b, p, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:\mathrm{Id}_A(a, b) \quad \Gamma \vdash y:B(a) \quad \Gamma \vdash z:B(b) \quad \Gamma \vdash q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \end{array} }{\Gamma \vdash \mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, a, b, p, y, z, q):C(a, b, p, y, z, q)}$

The elimination rule then says that if:

1. for any elements $a:A$ and $b:A$, any identification $p:\mathrm{Id}_A(a,b)$, any elements $y:B(a)$ and $z:B(b)$, and any heterogeneous identification $q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$ we have a type $C(a, b, p, y, z, q)$, and
2. we have a specified dependent function
$t:\prod_{a:A} \prod_{y:B(a)} C(a,a,\mathrm{refl}_A(x),y,y,\mathrm{hrefl}_{x:A.B(x)}(a, y))$

then we can construct a canonically defined term called the eliminator

$\mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t,a,b,p,y,z,q):C(a,b,p,y,z,q)$

for any $a$, $b$, $p$, $y$, $z$, and $q$.

Then, we have the computation rule or beta-reduction rule. This says that for all elements $a:A$ and $y:B(a)$, substituting the dependent function $t:\prod_{a:A} \prod_{y:B(a)} C(a,a,\mathrm{refl}_A(x),y,y,\mathrm{hrefl}_{x:A.B(x)}(a, y))$ into the eliminator along heterogeneous reflexivity for $a$ and $y$ yields an element equal to $t(a, y)$ itself. Normally “equal” here means judgmental equality (a.k.a. definitional equality), but it is also possible for it to mean propositional equality (a.k.a. typal equality), so there are two possible computation rules.

Computation rules for heterogeneous identity types:

• Judgmental computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), y:B(a), z:B(b), q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \vdash C(a, b, p, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \quad \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \equiv t(a, y):C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))}$
• Propositional computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), y:B(a), z:B(b), q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \vdash C(a, b, p, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \quad \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \beta_{\mathrm{hId}_{x:A.B(x)}}(t, a, y):\mathrm{Id}_{C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))}(\mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y), t(a, y))}$

Finally, one might consider a uniqueness rule or eta-conversion rule. But similar to the case for identity types, a judgmental uniqueness rule for heterogeneous identity types implies that the type theory is an extensional type theory, in which case there is not much need for heterogeneous identity types, so such a rule is almost never written down. And as for identity types and other inductive types, the propositional/typal uniqueness rule is provable from the other four inference rules, so we don’t write it out explicitly.

#### Dependent universal property

The elimination, typal computation, and typal uniqueness rules for heterogeneous identity types state that heterogeneous identity types satisfy the dependent universal property of heterogeneous identity types. If the dependent type theory also has dependent sum types and product types, allowing one to define the uniqueness quantifier, the dependent universal property of heterogeneous identity types could be simplified to the following rule:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), y:B(a), z:B(b), q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \vdash C(a, b, p, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \\ \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \mathrm{up}_{\mathrm{hId}_{x:A.B(x)}}(t, f, a, b, p): \begin{array}{c} \exists!J:\left(\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))\right) \\ \to \left(\prod_{c:A} \prod_{d:A} \prod_{r:\mathrm{Id}_A(c, d)} \prod_{e:B(c)} \prod_{f:B(c)} \prod_{s:\mathrm{hId}_{x:A.B(x)}(c, d, r, e, f)} C(c, d, r, e, f, s)\right) \\ .\mathrm{Id}_{C(a, a, \mathrm{refl}_A(a), y, y)}(J(t, a, a, \mathrm{refl}_A, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)), t(a, y)) \end{array} }$

In natural language this states that given a type $A$, a type family $B(x)$ indexed by elements $x:A$, and given a type family $C(a, b, p, y, z, q)$ indexed by elements $a:A$, $b:A$, $p:\mathrm{Id}_A(a, b)$, $y:B(a)$, $z:B(b)$, and $q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$, for all elements $t:\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))$, $a:A$, and $y:B(a)$, there exists a unique function $J$ with domain

$\prod_{a:A} \prod_{y:B(a)} C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))$

and codomain

$\prod_{c:A} \prod_{d:A} \prod_{r:\mathrm{Id}_A(c, d)} \prod_{e:B(c)} \prod_{f:B(c)} \prod_{s:\mathrm{hId}_{x:A.B(x)}(c, d, r, e, f)} C(c, d, r, e, f, s)$

such that $J(t, a, a, \mathrm{refl}_A, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))$ is equal to $t(a, y)$ in the type $C(a, a, \mathrm{refl}_A(a), y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))$.

### Using function types from the interval type

There is another notion of heterogeneous identity type, which uses functions from the interval type $f:\mathbb{I} \to A$, rather than elements $a:A$, $b:A$, and $p:a =_A b$:

Given a type family $x:A \vdash B(x)$, heterogeneous identity types are an inductive family of types

$f:\mathbb{I} \to A, y:B(f(0)), z:B(f(1)) \vdash \mathrm{hId}_{x:A.B(x)}(f, y, z)$

generated by the family of elements called “heterogeneous reflexivity”

$a:A, y:B(a) \vdash \mathrm{hrefl}_{x:A.B(x)}(a, y):\mathrm{hId}_{x:A.B(x)}(\lambda i:\mathbb{I}.a, y, y)$

since by definition of constant function we have that

$(\lambda i:\mathbb{I}.a)(0) \equiv a \qquad (\lambda i:\mathbb{I}.a)(1) \equiv a$

#### Inference rules

The inference rules for forming heterogeneous identity types and terms are as follows. First the inference rule that defines the heterogeneous identity type itself, as a dependent type, in some context $\Gamma$.

Formation rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma \vdash f:\mathbb{I} \to A \quad \Gamma \vdash y:B(f(0)) \quad \Gamma \vdash z:B(f(1)) \end{array} }{\Gamma \vdash \mathrm{hId}_{x:A.B(x)}(f, y, z) \; \mathrm{type}}$

Now the basic “introduction” rule, which says that everything is equal to itself in a canonical way.

Introduction rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \mathrm{hrefl}_{x:A.B(x)}(a, y):\mathrm{hId}_{x:A.B(x)}(\lambda i:\mathbb{I}.a, y, y)}$

Next we have the “elimination” rule:

Elimination rule for heterogeneous identity types:

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, f:\mathbb{I} \to A, y:B(f(0)), z:B(f(1)), q:\mathrm{hId}_{x:A.B(x)}(f, y, z) \vdash C(f, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(\lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \\ \Gamma \vdash f:\mathbb{I} \to A \quad \Gamma \vdash y:B(f(0)) \quad \Gamma \vdash z:B(f(1)) \quad \Gamma \vdash q:\mathrm{hId}_{x:A.B(x)}(f, y, z) \end{array} }{\Gamma \vdash \mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, f, y, z, q):C(f, y, z, q)}$

The elimination rule then says that if:

1. for any function $f:\mathbb{I} \to A$, any elements $y:B(f(0))$ and $z:B(f(1))$, and any heterogeneous identification $q:\mathrm{hId}_{x:A.B(x)}(f, y, z)$ we have a type $C(f, y, z, q)$, and
2. we have a specified dependent function
$t:\prod_{a:A} \prod_{y:B(a)} C(\lambda i:\mathbb{I}.a,y,y,\mathrm{hrefl}_{x:A.B(x)}(a, y))$

then we can construct a canonically defined term called the eliminator

$\mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t,f,y,z,q):C(a,b,p,y,z,q)$

for any $f$, $y$, $z$, and $q$.

Then, we have the computation rule or beta-reduction rule. This says that for all elements $a:A$ and $y:B(a)$, substituting the dependent function $t:\prod_{a:A} \prod_{y:B(a)} C(\lambda i:\mathbb{I}.a,y,y,\mathrm{hrefl}_{x:A.B(x)}(a, y))$ into the eliminator along heterogeneous reflexivity for $a$ and $y$ yields an element equal to $t(a, y)$ itself. Normally “equal” here means judgmental equality (a.k.a. definitional equality), but it is also possible for it to mean propositional equality (a.k.a. typal equality), so there are two possible computation rules.

Computation rules for heterogeneous identity types:

• Judgmental computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, f:\mathbb{I} \to A, y:B(f(0)), z:B(f(1)), q:\mathrm{hId}_{x:A.B(x)}(f, y, z) \vdash C(f, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(\lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \quad \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, \lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \equiv t(a, y):C(\lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))}$
• Propositional computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \\ \Gamma, f:\mathbb{I} \to A, y:B(f(0)), z:B(f(1)), q:\mathrm{hId}_{x:A.B(x)}(f, y, z) \vdash C(f, y, z, q) \; \mathrm{type} \\ \Gamma \vdash t:\prod_{a:A} \prod_{y:B(a)} C(\lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y)) \quad \Gamma \vdash a:A \quad \Gamma \vdash y:B(a) \end{array} }{\Gamma \vdash \beta_{\mathrm{hId}_{x:A.B(x)}}(t, a, y):\mathrm{Id}_{C(\lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y))}(\mathrm{ind}_{\mathrm{hId}_{x:A.B(x)}}(t, \lambda i:\mathbb{I}.a, y, y, \mathrm{hrefl}_{x:A.B(x)}(a, y), t(a, y))}$

Finally, one might consider a uniqueness rule or eta-conversion rule. But similar to the case for identity types, a judgmental uniqueness rule for heterogeneous identity types implies that the type theory is an extensional type theory, in which case there is not much need for heterogeneous identity types, so such a rule is almost never written down. And as for identity types and other inductive types, the propositional/typal uniqueness rule is provable from the other four inference rules, so we don’t write it out explicitly.

### From two-type identity types

Given two-type identity types in the type theory, heterogeneous identity types between $y:B(a)$ and $z:B(b)$ across the path $p:a =_A b$ could be defined as the two-type identity type between $y:B(a)$ and $z:B(b)$ across the transport equivalence $\mathrm{transport}_{x:A.B(x)}(a, b, p)$

$\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \coloneqq \mathrm{Id}_{B(a), B(b)}(\mathrm{transport}_{x:A.B(x)}(a, b, p), y, z)$

## Properties

### Groupoidal structure of heterogeneous identity types

Reflexivity of heterogeneous identifications is already given in the introduction rule of heterogeneous identity types.

###### Definition

Given

• a type family $x:A \vdash B(x)$,

• elements $a_1:A$, $a_2:A$, $a_3:A$,

• identifications $p_1:\mathrm{Id}_A(a_1, a_2)$ and $p_2:\mathrm{Id}_A(a_2, a_3)$,

• elements $y_1:B(a_1)$, $y_2:B(a_2)$, and $y_3:B(a_3)$,

there is a function called the concatenation of heterogeneous identifications

$(-) \bullet (-):\mathrm{hId}_{x:A.B(x)}(a_1, a_2, p_1, y_1, y_2) \times \mathrm{hId}_{x:A.B(x)}(a_2, a_3, p_2, y_2, y_3) \to \mathrm{hId}_{x:A.B(x)}(a_1, a_3, p_1 \bullet p_2, y_1, y_3)$

defined by double induction on heterogeneous reflexivity for $a:A$ and $y:B(a)$

$\mathrm{hrefl}_A(a, y) \bullet \mathrm{hrefl}_A(a, y) \equiv \mathrm{hrefl}_A(a, y)$

in the type

$\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)$

###### Definition

Given

• a type family $x:A \vdash B(x)$,

• elements $a:A$, $b:A$

• identifications $p:\mathrm{Id}_A(a, b)$

• elements $y:B(a)$, $z:B(b)$,

there is a dependent function called the left unitor of heterogeneous identifications

$\mathrm{hlunitor}:\prod_{q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)} \mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)}(\mathrm{hrefl}_A(a, y) \bullet q, q)$

defined by induction on heterogeneous reflexivity for $a:A$ and $y:B(a)$:

$\mathrm{hlunitor}(\mathrm{hrefl}_A(a, y)) \equiv \mathrm{refl}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)}(\mathrm{hrefl}_A(a, y))$

in the type

$\mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)}(\mathrm{hrefl}_A(a, y) \bullet \mathrm{hrefl}_A(a, y), \mathrm{hrefl}_A(a, y))$

###### Definition

Given

• a type family $x:A \vdash B(x)$,

• elements $a:A$, $b:A$

• identifications $p:\mathrm{Id}_A(a, b)$

• elements $y:B(a)$, $z:B(b)$,

there is a dependent function called the right unitor of heterogeneous identifications

$\mathrm{hrunitor}:\prod_{q:\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)} \mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)}(q \bullet \mathrm{hrefl}_A(b, z), q)$

defined by induction on heterogeneous reflexivity for $b:B$ and $z:B(b)$

$\mathrm{hrunitor}(\mathrm{hrefl}_A(b, z)) \equiv \mathrm{refl}_{\mathrm{hId}_{x:A.B(x)}(b, b, \mathrm{refl}_A(b), z, z)}(\mathrm{hrefl}_A(b, z))$

in the type

$\mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(b, b, \mathrm{refl}_A(b), z, z)}(\mathrm{hrefl}_A(b, z) \bullet \mathrm{hrefl}_A(b, z), \mathrm{hrefl}_A(b, z))$

###### Definition

Given

• a type family $x:A \vdash B(x)$,

• elements $a_1:A$, $a_2:A$, $a_3:A$, $a_4:A$

• identifications $p_1:\mathrm{Id}_A(a_1, a_2)$, $p_2:\mathrm{Id}_A(a_2, a_3)$, $p_3:\mathrm{Id}_A(a_3, a_4)$,

• elements $y_1:B(a_1)$, $y_2:B(a_2)$, $y_3:B(a_3)$, $y_4:B(a_4)$,

there is a dependent function called the associator of heterogeneous identifications

$\mathrm{hassoc}:\prod_{q_1:\mathrm{hId}_{x:A.B(x)}(a_1, a_2, p_1, y_1, y_2)} \prod_{q_2:\mathrm{hId}_{x:A.B(x)}(a_2, a_3, p_2, y_2, y_3)} \prod_{q_3:\mathrm{hId}_{x:A.B(x)}(a_3, a_4, p_3, y_3, y_4)} \mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a_1, a_4, \mathrm{assoc}(p_1, p_2, p_3), y_1, y_4)}(q_1 \bullet (q_2 \bullet q_3), (q_1 \bullet q_2) \bullet q_3)$

defined by triple induction on heterogeneous reflexivity for $a:A$ and $y:B(a)$

$\mathrm{hassoc}(\mathrm{hrefl}_A(a, y), \mathrm{hrefl}_A(a, y), \mathrm{hrefl}_A(a, y)) \equiv \mathrm{refl}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)}(\mathrm{hrefl}_A(a, y))$

in the type

$\mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)}(\mathrm{hrefl}_A(a, y) \bullet (\mathrm{hrefl}_A(a, y) \bullet \mathrm{hrefl}_A(a, y)), (\mathrm{hrefl}_A(a, y) \bullet \mathrm{hrefl}_A(a, y)) \bullet \mathrm{hrefl}_A(a, y))$

###### Definition

Given

• a type family $x:A \vdash B(x)$,

• elements $a_1:A$, $a_2:A$

• identifications $p_1:\mathrm{Id}_A(a_1, a_2)$

• elements $y_1:B(a_1)$, $y_2:B(a_2)$,

there is a function called the inverse of heterogeneous identifications

$\mathrm{inv}(a_1, a_2, p_1, y_1, y_2):\mathrm{hId}_{x:A.B(x)}(a_1, a_2, p_1, y_1, y_2) \to \mathrm{hId}_{x:A.B(x)}(a_2, a_1, p_1^{-1}, y_2, y_1)$

defined by induction on heterogeneous reflexivity:

$a:A, y:B(a) \vdash \mathrm{inv}(a, a, \mathrm{refl}_A(a), y, y)(\mathrm{hrefl}_A(a, y)) \equiv \mathrm{hrefl}_A(a, y):\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y) \to \mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), y, y)$

### Relation between identity types and heterogeneous identity types

There are equivalences between identity types and heterogeneous identity types

$\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \simeq \mathrm{Id}_{B(b)}(\mathrm{transport}_{x:A.B(x)}(a, b, p)(y), z)$

and

$\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z) \simeq \mathrm{Id}_{B(a)}(y, \mathrm{transport}_{x:A.B(x)}(a, b, p)^{-1}(z))$

for all $a:A$, $b:A$, $p:\mathrm{Id}_A(a, b)$, $y:B(a)$, and $z:B(b)$. For constant families $x:A \vdash B$, $\mathrm{transport}_{x:A.B}(a, b, p)(y) \coloneqq y$ and $\mathrm{transport}_{x:A.B}(a, b, p)^{-1}(z) \coloneqq z$, so the above two equivalences simplify down to

$\mathrm{hId}_{x:A.B}(a, b, p, y, z) \simeq \mathrm{Id}_{B}(y, z)$

for constant type families $x:A \vdash B$.

### One-to-one correspondence structure

Heterogeneous identity types are one-to-one correspondences. Given elements $a:A$, $b:A$, and $p:\mathrm{Id}_A(a, b)$,

• for all elements $z:B(b)$, there exists a unique element $y:B(a)$ such that $\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$; the witness is given by the right projection function of transport across $p$, $\mathrm{transport}_{x:A.B(x)}(a, b, p):B(a) \simeq B(b)$
$\pi_2(\mathrm{transport}_{x:A.B(x)}(a, b, p)):\prod_{z:B(b)} \exists!y:B(a).\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$
• for all elements $y:B(a)$, there exists a unique element $z:B(b)$ such that $\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$; the witness is given by the right projection function of the inverse transport across $p$, $\mathrm{transport}_{x:A.B(x)}(a, b, p)^{-1}:B(b) \simeq B(a)$
$\pi_2(\mathrm{transport}_{x:A.B(x)}(a, b, p)^{-1}):\prod_{y:B(a)} \exists!z:B(b).\mathrm{hId}_{x:A.B(x)}(a, b, p, y, z)$

### Function application to identifications

The dependent function application to identifications is defined in the usual way, by induction on the identity type of the index type:

• given a type $A$, a type family $x:A \vdash B(x)$, and a dependent function $f:\prod_{x:A} B(x)$, there are dependent functions
$\mathrm{apd}_{x:A.B(x)}(f):\prod_{a:A} \prod_{b:A} \prod_{p:\mathrm{Id}_A(a, b)} \mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), f(b))$

inductively defined respectively by:

$\mathrm{apd}_{x:A.B(x)}(f, a, a, \mathrm{refl}_A(a)) \equiv \mathrm{hrefl}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), f(a), f(a)):\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), f(a), f(a))$

### Extensionality principles

Heterogeneous identity types are used in many extensionality principles.

$\mathrm{ext}_{\to}:\prod_{f:A \to B} \prod_{g:A \to B} \mathrm{Id}_{A \to B}(f, g) \simeq \prod_{a:A} \prod_{b:A} \prod_{p:\mathrm{Id}_A(a, b)} \mathrm{hId}_{B}(a, b, p, f(a), g(b))$
$\mathrm{ext}_\Pi:\prod_{f:\prod_{x:A} B(x)} \prod_{g:\prod_{x:A} B(x)} \mathrm{Id}_{\prod_{x:A} B(x)}(f, g) \simeq \prod_{a:A} \prod_{b:A} \prod_{p:\mathrm{Id}_A(a, b)} \mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), g(b))$
• The extensionality principle for product types states that there is an equivalence
$\mathrm{ext}_{\times}:\prod_{s:A \times B} \prod_{t:A \times B} \mathrm{Id}_{A \times B}(s, t) \simeq \sum_{p:\mathrm{Id}_A(\pi_1(s), \pi_1(t))} \mathrm{hId}_{B}(\pi_1(s), \pi_1(t), p, \pi_2(s), \pi_2(t))$
$\mathrm{ext}_\Sigma:\prod_{s:\sum_{x:A} B(x)} \prod_{t:\sum_{x:A} B(x)} \mathrm{Id}_{\sum_{x:A} B(x)}(s, t) \simeq \sum_{p:\mathrm{Id}_A(\pi_1(s), \pi_1(t))} \mathrm{hId}_{x:A.B(x)}(\pi_1(s), \pi_1(t), p, \pi_2(s), \pi_2(t))$

### Inference rules for higher inductive types

Whenever there is an identification given in an introduction rule for a higher inductive type, one of the hypothesis in the elimination and computation rules for the higher inductive types is a judgment of a term of the corresponding heterogeneous identification type along the given identification in the introduction rule.

For example, the introduction rules for the circle type $S^1$ state that one could construct an element $\mathcal{b}:S^1$ and an identification $\mathcal{l}:\mathrm{Id}_{S^1}(\mathcal{b}, \mathcal{b})$. The elimination rule for the circle type states that given the hypotheses of

• a type family $x:S^1 \vdash C(x)$,

• an element $c_\mathcal{b}:C(\mathcal{b})$,

• a heterogeneous identification $c_\mathcal{l}:\mathrm{hId}_{x:S^1.C(x)}(\mathcal{b}, \mathcal{b}, \mathcal{l}, c_\mathcal{b}, c_\mathcal{b})$,

one could construct the family of elements $p:S^1 \vdash \mathrm{ind}_{S^1}(c_\mathcal{b}, c_\mathcal{l})(p):C(p)$.

## Categorical semantics

needs to be written

## In cubical type theory

The path types in cubical type theory are heterogeneous path types. See cubical path type for more details.

## In higher observational type theory

In higher observational type theory, the heterogeneous identity type is a primitive type former (although depending on the presentation, it can also be obtained using $ap$ into the universe). In its general form, the type family can depend not just on a single type but on a type telescope $\Delta$. The resulting heterogeneous identity type then depends on an “identification in that telescope”, which is defined by mutual recursion as a telescope of heterogeneous identity types. The formation rule is then

$\frac{\varsigma:\delta =_\Delta \delta^{'} \quad \delta \vdash A\; \mathrm{type} \quad a:A[\delta] \quad a^{'}:A[\delta^{'}]}{a =_{\Delta.A}^\varsigma a^{'}\; \mathrm{type}}$

… needs to be finished

### Heterogeneous identity types in universes

Given a term of a universe $A:\mathcal{U}$, a judgment $z:\mathcal{T}_\mathcal{U}(A) \vdash B:\mathcal{U}$, terms $x:\mathcal{T}_\mathcal{U}(A)$ and $y:\mathcal{T}_\mathcal{U}(A)$, and an identity $p:\mathrm{id}_{\mathcal{T}_\mathcal{U}(A)}(x,y)$, we have

$\mathrm{ap}_{z.B}(p):\mathrm{id}_\mathcal{U}(B(x),B(y))$

and

$(u,v):\mathcal{T}_\mathcal{U}(B(x)) \times \mathcal{T}_\mathcal{U}(B(y)) \vdash \pi_1(\nabla(\mathrm{ap}_{z.B}(p)))(u,v):\mathcal{U}$

We could define a heterogeneous identity type as

$\mathrm{id}_{\mathcal{T}_\mathcal{U}(z.B)}^{p}(u, v) \coloneqq \pi_1(\nabla(\mathrm{ap}_{z.B}(p)))(u, v)$

There is a rule

$\frac{A:\mathcal{U} \quad z:\mathcal{T}_\mathcal{U}(A) \vdash B:\mathcal{U} \quad a:\mathcal{T}_\mathcal{U}(A)}{\mathrm{id}_{\mathcal{T}_\mathcal{U}(z.B)}^{\refl_{a}}(u, v) \equiv \mathrm{id}_{\mathcal{T}_\mathcal{U}(B[a/z])}(u, v)}$

and for constant families $B:\mathcal{U}$

$\mathrm{id}_{\mathcal{T}_\mathcal{U}(z.B)}^{p}(u, v) \equiv \mathrm{id}_{\mathcal{T}_\mathcal{U}(B)}(u, v)$

## A variant using dependent function types

There is a variant of heterogeneous identity types which uses a dependent function $f:\prod_{x:A} B(x)$ instead of two elements $y:B(a)$ and $z:B(b)$ in the constructor. This variant is useful for defining dependent function application to identifications.

These are given by the following inference rules:

• Formation rules

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:\mathrm{Id}_A(a, b) \end{array} }{\Gamma \vdash \mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \; \mathrm{type}}$
• Introduction rules

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \\ \Gamma \vdash a:A \end{array} }{\Gamma \vdash \mathrm{hrefl}_{x:A.B(x)}(f, a):\mathrm{fhId}_{x:A.B(x)}(f, a, b, p)}$
• Elimination rules

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), q:\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \vdash C(a, b, p, q) \; \mathrm{type} \\ \Gamma \vdash \vdash t:\prod_{x:A} C(a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a)) \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:\mathrm{Id}_A(a, b) \quad \Gamma \vdash q:\mathrm{hId}_{x:A.B(x)}(f, a, b, p) \end{array} }{\Gamma \vdash \mathrm{ind}_{\mathrm{fhId}_{x:A.B(x)}}(t, f, a, b, p, q):C(a, b, p, q)}$
• Judgmental computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), q:\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \vdash C(a, b, p, q) \; \mathrm{type} \\ \Gamma \vdash \vdash t:\prod_{x:A} C(a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a)) \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:a =_A b \quad \Gamma \vdash q:\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \end{array} }{\Gamma, a:A \vdash \mathrm{ind}_{\mathrm{fhId}_{x:A.B(x)}}(t, f, a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a)) \equiv t(a):C(a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a))}$
• Propositional computational rule

$\frac{ \begin{array}{l} \Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A \vdash B(x) \; \mathrm{type} \quad \Gamma \vdash f:\prod_{x:A} B(x) \\ \Gamma, a:A, b:A, p:\mathrm{Id}_A(a, b), q:\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \vdash C(a, b, p, q) \; \mathrm{type} \\ \Gamma \vdash \vdash t:\prod_{x:A} C(a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a)) \\ \Gamma \vdash a:A \quad \Gamma \vdash b:A \quad \Gamma \vdash p:a =_A b \quad \Gamma \vdash q:\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \end{array} }{\Gamma, a:A \vdash \beta_{\mathrm{hId}_{x:A.B(x)}}(t, f, a):\mathrm{Id}_{C(a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a))}(\mathrm{ind}_{\mathrm{fhId}_{x:A.B(x)}}(t, f, a, a, \mathrm{refl}_A(a), \mathrm{hrefl}_{x:A.B(x)}(f, a)), t(a))}$

Given a dependent function $f:\prod_{x:A} B(x)$, we have

$\mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), f(b)) \simeq \mathrm{fhId}_{x:A.B(x)}(f, a, b, p)$

since by induction we have functions

$\mathrm{hIdTofhId}(f, a, b, p):\mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), f(b)) \to \mathrm{fhId}_{x:A.B(x)}(f, a, b, p)$

and

$\mathrm{fhIdTohId}(f, a, b, p):\mathrm{fhId}_{x:A.B(x)}(f, a, b, p) \to \mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), f(b))$

inductively defined by

$\mathrm{hIdTofhId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{hrefl}_{x:A.B(x)}(a, f(a))) \equiv \mathrm{hrefl}_{x:A.B(x)}(f, a)$

and

$\mathrm{fhIdTohId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{hrefl}_{x:A.B(x)}(f, a)) \equiv \mathrm{hrefl}_{x:A.B(x)}(a, f(a))$

Thus, we have identifications

$H(f, a, b, p):\mathrm{Id}_{\mathrm{fhId}_{x:A.B(x)}(f, a, b, p)}(\mathrm{hIdTofhId}(f, a, b, p)(\mathrm{fhIdTohId}(f, a, b, p)(q), q)$

and

$K(f, a, b, p):\mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, b, p, f(a), f(b))}(\mathrm{fhIdTohId}(f, a, b, p)(\mathrm{hIdTofhId}(f, a, b, p)(q)), q)$

inductively defined by

$H(f, a, a, \mathrm{refl}_A(a)) \equiv \mathrm{refl}_{\mathrm{fhId}_{x:A.B(x)}(f, a, a, \mathrm{refl}_A(a))}(\mathrm{hrefl}_{x:A.B(x)}(f, a))$

and

$K(f, a, a, \mathrm{refl}_A(a)) \equiv \mathrm{refl}_{\mathrm{hId}_{x:A.B(x)}(f, a, a, \mathrm{refl}_A(a))}(\mathrm{hrefl}_{x:A.B(x)}(a, f(a))$

since by the properties of judgmental equality

$\mathrm{Id}_{\mathrm{fhId}_{x:A.B(x)}(f, a, a, \mathrm{refl}_A(a))}(\mathrm{fhIdTofhId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{hIdTofhId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{hrefl}_{x:A.B(x)}(f, a))), \mathrm{hrefl}_{x:A.B(x)}(f, a)) \equiv \mathrm{Id}_{\mathrm{fhId}_{x:A.B(x)}(f, a, a, \mathrm{refl}_A(a))}(\mathrm{hrefl}_{x:A.B(x)}(f, a)), \mathrm{hrefl}_{x:A.B(x)}(f, a))$

and

$\mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), f(a), f(a))}(\mathrm{hIdTofhId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{fhIdTohId}(f, a, a, \mathrm{refl}_A(a))(\mathrm{hrefl}_{x:A.B(x)}(a, f(a))), \mathrm{hrefl}_{x:A.B(x)}(a, f(a))) \equiv \mathrm{Id}_{\mathrm{hId}_{x:A.B(x)}(a, a, \mathrm{refl}_A(a), f(a), f(a))}(\mathrm{hrefl}_{x:A.B(x)}(a, f(a)), \mathrm{hrefl}_{x:A.B(x)}(a, f(a)))$

Then by the properties of quasi-inverse functions and equivalences of types one could prove that both $\mathrm{hIdTofhId}(f, a, b, p)$ and $\mathrm{fhIdTohId}(f, a, b, p)$ are equivalences of types.

## References

Inference rules for heterogeneous identity types (referred to as “dependent identity types” in the article) could be found in section 6 of:

For heterogeneous identity types in the context of higher observational type theory, see:

Last revised on January 25, 2024 at 03:24:00. See the history of this page for a list of all contributions to it.