5.8 Identity types and identity systems

5.8 Identity types and identity systems

We now wish to point out that the

identity types

, which play so

central

a role in

homotopy type theory

, may also be considered to be defined inductively.
Specifically, they are an “inductive family” with indices, in the sense of §5.7 (

http://planetmath.org/57generalizationsofinductivetypes

).
In fact, there are

two

ways to describe identity types as an
inductive family, resulting in the two

induction

principles described in

http://planetmath.org/node/87533

Chapter 1, path induction and based path induction.

In both

definitions

, the type

A

is a

parameter

.
For the first definition, we inductively define a family

=

A

:

A

→

A

→

𝒰

, with two indices belonging to

A

, by the following constructor:

•

for any

a

:

A

, an

element

𝗋𝖾𝖿𝗅

A

:

a

=

A

a

.

By

analogy

with the other inductive families, we may extract the induction principle from this definition.
It states that given any

C

:

∏

(

a

,

b

:

A

)

(

a

=

A

b

)

→

𝒰

,

along with

d

:

∏

(

a

:

A

)

C

⁢

(

a

,

a

,

𝗋𝖾𝖿𝗅

a

)

, there exists

f

:

∏

(

a

,

b

:

A

)

∏

(

p

:

a

=

A

b

)

C

⁢

(

a

,

b

,

p

)

such that

f

⁢

(

a

,

a

,

𝗋𝖾𝖿𝗅

a

)

≡

d

⁢

(

a

)

.
This is exactly the path induction principle for identity types.

For the second definition, we consider one element

a

0

:

A

to be a parameter along with

A

:

𝒰

, and we inductively define a family

(

a

0

=

A

–

)

:

A

→

𝒰

, with

one

index belonging to

A

, by the following constructor:

•

an element

𝗋𝖾𝖿𝗅

a

0

:

a

0

=

A

a

0

.

Note that because

a

0

:

A

was fixed as a parameter, the constructor

𝗋𝖾𝖿𝗅

a

0

does not appear inside the inductive definition as a

function

, but only an element.
The induction principle for this definition says that given

C

:

∏

(

b

:

A

)

(

a

0

=

A

b

)

→

𝒰

along with an element

d

:

C

⁢

(

a

0

,

𝗋𝖾𝖿𝗅

a

0

)

, there exists

f

:

∏

(

b

:

A

)

∏

(

p

:

a

0

=

A

b

)

C

⁢

(

b

,

p

)

with

f

⁢

(

a

0

,

𝗋𝖾𝖿𝗅

a

0

)

≡

d

.
This is exactly the based path induction principle for identity types.

The view of identity types as inductive types has historically caused some confusion, because of the intuition mentioned in §5.1 (

http://planetmath.org/51introductiontoinductivetypes

) that all the elements of an inductive type should be obtained by repeatedly applying its constructors.
For ordinary inductive types such as

𝟐

and

ℕ

, this is the case: we saw in (

http://planetmath.org/18thetypeofbooleans#1

) that indeed every element of

𝟐

is either

0

𝟐

or

1

𝟐

, and similarly one can prove that every element of

ℕ

is either

0

or a

successor

.

However, this is

not

true for identity types: there is only one constructor

𝗋𝖾𝖿𝗅

, but not every path is equal to the

constant

path.
More precisely, we cannot prove, using only the induction principle for identity types (either one), that every inhabitant of

a

=

A

a

is equal to

𝗋𝖾𝖿𝗅

a

.
In order to actually exhibit a

counterexample

, we need some additional principle such as the univalence axiom — recall that in Example 3.1.9 (

http://planetmath.org/31setsandntypes#Thmpreeg6

) we used univalence to exhibit a particular path

𝟐

=

𝒰

𝟐

which is not equal to

𝗋𝖾𝖿𝗅

𝟐

.

The point is that, as validated by the study of homotopy-initial

algebras

, an inductive definition should be regarded as

freely generated

by its constructors.
Of course, a freely generated

structure

may contain elements other than its

generators

: for

instance

, the

free group

on two symbols

x

and

y

contains not only

x

and

y

but also words such as

x

⁢

y

,

y

⁢

x

-

1

⁢

y

, and

x

3

⁢

y

2

⁢

x

-

2

⁢

y

⁢

x

.
In general, the elements of a free structure are obtained by applying not only the generators, but also the

operations

of the ambient structure, such as the

group operations

if we are talking about free groups.

In the case of inductive types, we are talking about freely generated

types

— so what are the “operations” of the structure of a type?
If types are viewed as like

sets

, as was traditionally the case in

type theory

, then there are no such operations, and hence we expect there to be no elements in an inductive type other than those resulting from its constructors.
In homotopy type theory, we view types as like

spaces

or

∞

-

groupoids

,
in which case there are many operations on the

paths

(

concatenation

,

inversion

, etc.) — this will be important in

http://planetmath.org/node/87579

Chapter 6 — but there are still no operations on the

objects

(elements).
Thus, it is still true for us that, e.g., every element of

𝟐

is either

0

𝟐

or

1

𝟐

, and every element of

ℕ

is either

0

or a successor.

However, as we saw in

http://planetmath.org/node/87569

Chapter 2, viewing types as

∞

-groupoids entails also viewing functions as

functors

, and this includes type families

B

:

A

→

𝒰

.
Thus, the identity type

(

a

0

=

A

–

)

, viewed as an inductive type family, is actually a

freely generated functor

A

→

𝒰

.
Specifically, it is the functor

F

:

A

→

𝒰

freely generated by one element

𝗋𝖾𝖿𝗅

a

0

:

F

⁢

(

a

0

)

.
And a functor does have operations on objects, namely the action of the

morphisms

(paths) of

A

.

In

category theory

, the

Yoneda lemma

tells us that for any

category

A

and object

a

0

, the functor freely generated by an element of

F

⁢

(

a

0

)

is the

representable functor

hom

A

⁡

(

a

0

,

–

)

.
Thus, we should expect the identity type

(

a

0

=

A

–

)

to be this representable functor, and this is indeed exactly how we view it:

(

a

0

=

A

b

)

is the space of morphisms (paths) in

A

from

a

0

to

b

.

One reason for viewing identity types as inductive families is to apply the uniqueness principles of §5.2 (

http://planetmath.org/52uniquenessofinductivetypes

),§5.5 (

http://planetmath.org/55homotopyinductivetypes

).
Specifically, we can characterize the family of identity types of a type

A

, up to

equivalence

, by giving another family of types over

A

×

A

satisfying the same induction principle.
This suggests the following definitions and

theorem

.

Definition 5.8.1

.

Let

A

be a type and

a

0

:

A

an element.

•

A

pointed

predicate

over

(

A

,

a

0

)

is a family

R

:

A

→

𝒰

equipped with an element

r

0

:

R

⁢

(

a

0

)

.

•

For pointed predicates

(

R

,

r

0

)

and

(

S

,

s

0

)

, a family of maps

g

:

∏

(

b

:

A

)

R

⁢

(

b

)

→

S

⁢

(

b

)

is

pointed

if

g

⁢

(

a

0

,

r

0

)

=

s

0

.
We have

𝗉𝗉𝗆𝖺𝗉

(

R

,

S

)

:

≡

∑

g

:

∏

(

b

:

A

)

R

⁢

(

b

)

→

S

⁢

(

b

)

(

g

(

a

0

,

r

0

)

=

s

0

)

.

•

An

identity

system at

a

0

is a pointed predicate

(

R

,

r

0

)

such that for any type family

D

:

∏

(

b

:

A

)

R

⁢

(

b

)

→

𝒰

and

d

:

D

⁢

(

a

0

,

r

0

)

, there exists a function

f

:

∏

(

b

:

A

)

∏

(

r

:

R

(

b

)

)

D

⁢

(

b

,

r

)

such that

f

⁢

(

a

0

,

r

0

)

=

d

.

Theorem 5.8.2

.

For a pointed predicate

(

R

,

r

0

)

, the following are

logically equivalent

.

1.

(

R

,

r

0

)

is an identity system at

a

0

.

2.

For any pointed predicate

(

S

,

s

0

)

, the type

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

S

)

is

contractible

.

3.

For any

b

:

A

, the function

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

R

(

¯

,

r

0

)

:

(

a

0

=

A

b

)

→

R

(

b

)

is an equivalence.

4.

The type

∑

(

b

:

A

)

R

⁢

(

b

)

is contractible.

Note that the equivalences

1

⇔

2

⇔

3

are a version of Lemma 5.5.4 (

http://planetmath.org/55homotopyinductivetypes#Thmprelem1

) for identity types

a

0

=

A

–

, regarded as inductive families varying over one element of

A

.
Of course,

2

–

4

are mere propositions, so that logical equivalence implies actual equivalence.
(Condition

1

is also a mere proposition, but we will not prove this.)

Proof.

First, assume

1

and let

(

S

,

s

0

)

be a pointed predicate.
Define

D

(

b

,

r

)

:

≡

S

(

b

)

and

d

:

≡

s

0

:

S

(

a

0

)

≡

D

(

a

0

,

r

0

)

.
Since

R

is an identity system, we have

f

:

∏

(

b

:

A

)

R

⁢

(

b

)

→

S

⁢

(

b

)

with

f

⁢

(

a

0

,

r

0

)

=

s

0

; hence

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

S

)

is inhabited.
Now suppose

(

f

,

f

r

)

,

(

g

,

g

r

)

:

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

S

)

, and define

D

(

b

,

r

)

:

≡

(

f

(

b

,

r

)

=

g

(

b

,

r

)

)

, and let

d

:

≡

f

r

\centerdot

g

r

-

1

:

f

(

a

0

,

r

0

)

=

s

0

=

g

(

a

0

,

r

0

)

.
Then again since

R

is an identity system, we have

h

:

∏

(

b

:

A

)

∏

(

r

:

R

(

b

)

)

D

⁢

(

b

,

r

)

such that

h

⁢

(

a

0

,

r

0

)

=

f

r

⁢

\centerdot

⁢

g

r

-

1

.
By the

characterization

of paths in

Σ

-types and path types, these data yield an equality

(

f

,

f

r

)

=

(

g

,

g

r

)

.
Hence

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

S

)

is an inhabited mere proposition, and thus contractible; so

2

holds.

Now suppose

2

, and define

S

(

b

)

:

≡

(

a

0

=

b

)

with

s

0

:

≡

𝗋𝖾𝖿𝗅

a

0

:

S

(

a

0

)

.
Then

(

S

,

s

0

)

is a pointed predicate, and

λ

b

.

λ

p

.

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

R

(

p

,

r

)

:

∏

(

b

:

A

)

S

(

b

)

→

R

(

b

)

is a pointed family of maps from

S

to

R

.
By

assumption

,

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

S

)

is contractible, hence inhabited, so there also exists a pointed family of maps from

R

to

S

.
And the composites in either direction are pointed families of maps from

R

to

R

and from

S

to

S

, respectively, hence equal to identities since

𝗉𝗉𝗆𝖺𝗉

⁢

(

R

,

R

)

and

𝗉𝗉𝗆𝖺𝗉

⁢

(

S

,

S

)

are contractible.
Thus

3

holds.

Now supposing

3

, condition

4

follows from Lemma 3.11.8 (

http://planetmath.org/311contractibility#Thmprelem5

), using the fact that

Σ

-types respect equivalences (the “if” direction of Theorem 4.7.7 (

http://planetmath.org/47closurepropertiesofequivalences#Thmprethm4

)).

Finally, assume

4

, and let

D

:

∏

(

b

:

A

)

R

⁢

(

b

)

→

𝒰

and

d

:

D

⁢

(

a

0

,

r

0

)

.
We can equivalently express

D

as a family

D

′

:

(

∑

(

b

:

A

)

R

⁢

(

b

)

)

→

𝒰

.
Now since

∑

(

b

:

A

)

R

⁢

(

b

)

is contractible, we have

p

:

∏

u

:

∑

(

b

:

A

)

R

⁢

(

b

)

(

a

0

,

r

0

)

=

u

.

Moreover, since the path types of a contractible type are again contractible, we have

p

⁢

(

(

a

0

,

r

0

)

)

=

𝗋𝖾𝖿𝗅

(

a

0

,

r

0

)

.
Define

f

(

u

)

:

≡

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

D

′

(

p

(

u

)

,

d

)

, yielding

f

:

∏

(

u

:

∑

(

b

:

A

)

R

(

b

)

)

D

′

⁢

(

u

)

, or equivalently

f

:

∏

(

b

:

A

)

∏

(

r

:

R

(

b

)

)

D

⁢

(

b

,

r

)

.
Finally, we have

f

⁢

(

a

0

,

r

0

)

≡

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

D

′

⁢

(

p

⁢

(

(

a

0

,

r

0

)

)

,

d

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

D

′

⁢

(

𝗋𝖾𝖿𝗅

(

a

0

,

r

0

)

,

d

)

=

d

.

Thus,

1

holds.
∎

We can deduce a

similar

result for identity types

=

A

, regarded as a family varying over two elements of

A

.

Definition 5.8.3

.

An

identity system

over a type

A

is a family

R

:

A

→

A

→

U

equipped with a function

r

0

:

∏

(

a

:

A

)

R

⁢

(

a

,

a

)

such that for any type family

D

:

∏

(

a

,

b

:

A

)

R

⁢

(

a

,

b

)

→

U

and

d

:

∏

(

a

:

A

)

D

⁢

(

a

,

a

,

r

0

⁢

(

a

)

)

, there exists a function

f

:

∏

(

a

,

b

:

A

)

∏

(

r

:

R

(

b

)

)

D

⁢

(

a

,

b

,

r

)

such that

f

⁢

(

a

,

a

,

r

0

⁢

(

a

)

)

=

d

⁢

(

a

)

for all

a

:

A

.

Theorem 5.8.4

.

For

R

:

A

→

A

→

U

equipped with

r

0

:

∏

(

a

:

A

)

R

⁢

(

a

,

a

)

, the following are logically equivalent.

1.

(

R

,

r

0

)

is an identity system over

A

.

2.

For all

a

0

:

A

, the pointed predicate

(

R

⁢

(

a

0

)

,

r

0

⁢

(

a

0

)

)

is an identity system at

a

0

.

3.

For any

S

:

A

→

A

→

𝒰

and

s

0

:

∏

(

a

:

A

)

S

⁢

(

a

,

a

)

, the type

∑

(

g

:

∏

(

a

,

b

:

A

)

R

(

a

,

b

)

→

S

(

a

,

b

)

)

∏

(

a

:

A

)

g

⁢

(

a

,

a

,

r

0

⁢

(

a

)

)

=

s

0

⁢

(

a

)

is contractible.

4.

For any

a

,

b

:

A

, the map

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

R

⁢

(

a

)

(

¯

,

r

0

(

a

)

)

:

(

a

=

A

b

)

→

R

(

a

,

b

)

is an equivalence.

5.

For any

a

:

A

, the type

∑

(

b

:

A

)

R

⁢

(

a

,

b

)

is contractible.

Proof.

The equivalence

1

⇔

2

follows exactly the proof of equivalence between the path induction and based path induction principles for identity types; see §1.12 (

http://planetmath.org/112identitytypes

).
The equivalence with

4

and

5

then follows from Theorem 5.8.2 (

http://planetmath.org/58identitytypesandidentitysystems#Thmprethm1

), while

3

is straightforward.
∎

One reason this characterization is interesting is that it provides an alternative way to state univalence and function extensionality.
The univalence axiom for a

universe

𝒰

says exactly that the type family

(

–

≃

–

)

:

𝒰

→

𝒰

→

𝒰

together with

𝗂𝖽

:

∏

(

A

:

𝒰

)

(

A

≃

A

)

satisfies

Theorem 5.8.4 (

http://planetmath.org/58identitytypesandidentitysystems#Thmprethm2

)

4

.
Therefore, it is

equivalent

to the corresponding version of

1

, which we can state as follows.

Corollary 5.8.5

(Equivalence induction).

Given any type family

D

:

∏

(

A

,

B

:

U

)

(

A

≃

B

)

→

U

and function

d

:

∏

(

A

:

U

)

D

⁢

(

A

,

A

,

id

A

)

, there exists

f

:

∏

(

A

,

B

:

U

)

∏

(

e

:

A

≃

B

)

D

⁢

(

A

,

B

,

e

)

such that

f

⁢

(

A

,

A

,

id

A

)

=

d

⁢

(

A

)

for all

A

:

U

.

In other words, to prove something about all equivalences, it suffices to prove it about

identity maps

.
We have already used this principle (without stating it in generality) in Lemma 4.1.1 (

http://planetmath.org/41quasiinverses#Thmprelem1

).

Similarly, function extensionality says that for any

B

:

A

→

𝒰

, the type family

(

–

∼

–

)

:

(

∏

a

:

A

B

(

a

)

)

→

(

∏

a

:

A

B

(

a

)

)

→

𝒰

together with

λ

⁢

f

.

λ

⁢

a

.

𝗋𝖾𝖿𝗅

f

⁢

(

a

)

satisfies Theorem 5.8.4 (

http://planetmath.org/58identitytypesandidentitysystems#Thmprethm2

)

4

.
Thus, it is also equivalent to the corresponding version of

1

.

Corollary 5.8.6

(Homotopy induction).

Given any

D

:

∏

(

f

,

g

:

∏

(

a

:

A

)

B

(

a

)

)

(

f

∼

g

)

→

U

and

d

:

∏

(

f

:

∏

(

a

:

A

)

B

(

a

)

)

D

(

f

,

f

,

λ

x

.

refl

f

⁢

(

x

)

)

, there exists

k

:

∏

(

f

,

g

:

∏

(

a

:

A

)

B

(

a

)

)

∏

(

h

:

f

∼

g

)

D

⁢

(

f

,

g

,

h

)

such that

k

(

f

,

f

,

λ

x

.

refl

f

⁢

(

x

)

)

=

d

(

f

)

for all

f

.

Title

5.8 Identity types and identity systems

\metatable

Generated on Thu Feb 8 19:37:11 2018 by

LaTeXML