2.13 Natural numbers

2.13 Natural numbers

We use the encode-decode method to characterize the path space of the

natural numbers

, which are also a positive type.
In this case, rather than fixing one

endpoint

, we characterize the two-sided path space all at once.
Thus, the codes for

identities

are a type family

𝖼𝗈𝖽𝖾

:

ℕ

→

ℕ

→

𝒰

,

defined by double recursion over

ℕ

as follows:

𝖼𝗈𝖽𝖾

⁢

(

0

,

0

)

:

≡

𝟏

𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

0

)

:

≡

𝟎

𝖼𝗈𝖽𝖾

⁢

(

0

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

)

:

≡

𝟎

𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

)

:

≡

𝖼𝗈𝖽𝖾

(

m

,

n

)

.

We also define by

recursion

a dependent

function

r

:

∏

(

n

:

ℕ

)

𝖼𝗈𝖽𝖾

⁢

(

n

,

n

)

, with

r

⁢

(

0

)

:

⁣

≡

⁣

⋆

r

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

n

)

)

:

≡

r

(

n

)

.

Theorem 2.13.1

.

For all

m

,

n

:

N

we have

(

m

=

n

)

≃

code

(

m

,

n

)

.

Proof.

We define

𝖾𝗇𝖼𝗈𝖽𝖾

:

∏

m

,

n

:

ℕ

(

m

=

n

)

→

𝖼𝗈𝖽𝖾

(

m

,

n

)

by transporting,

𝖾𝗇𝖼𝗈𝖽𝖾

(

m

,

n

,

p

)

:

≡

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

𝖼𝗈𝖽𝖾

⁢

(

m

,

–

)

(

p

,

r

(

m

)

)

.
And we define

𝖽𝖾𝖼𝗈𝖽𝖾

:

∏

m

,

n

:

ℕ

𝖼𝗈𝖽𝖾

(

m

,

n

)

→

(

m

=

n

)

by double

induction

on

m

,

n

.
When

m

and

n

are both

0

, we need a function

𝟏

→

(

0

=

0

)

, which we define to send everything to

𝗋𝖾𝖿𝗅

0

.
When

m

is a

successor

and

n

is

0

or vice versa, the domain

𝖼𝗈𝖽𝖾

⁢

(

m

,

n

)

is

𝟎

, so the eliminator for

𝟎

suffices.
And when both are successors, we can define

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

)

to be the composite

𝖼𝗈𝖽𝖾

(

𝗌𝗎𝖼𝖼

(

m

)

,

𝗌𝗎𝖼𝖼

(

n

)

)

≡

𝖼𝗈𝖽𝖾

(

m

,

n

)

→

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

)

(

m

=

n

)

→

𝖺𝗉

𝗌𝗎𝖼𝖼

(

𝗌𝗎𝖼𝖼

(

m

)

=

𝗌𝗎𝖼𝖼

(

n

)

)

.

Next we show that

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

m

,

n

)

and

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

)

are

quasi-inverses

for all

m

,

n

.

On one hand, if we start with

p

:

m

=

n

, then by induction on

p

it suffices to show

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

n

,

n

,

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

n

,

n

,

𝗋𝖾𝖿𝗅

n

)

)

=

𝗋𝖾𝖿𝗅

n

.

But

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

n

,

n

,

𝗋𝖾𝖿𝗅

n

)

≡

r

⁢

(

n

)

, so it suffices to show that

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

n

,

n

,

r

⁢

(

n

)

)

=

𝗋𝖾𝖿𝗅

n

.
We can prove this by induction on

n

.
If

n

≡

0

, then

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

0

,

0

,

r

⁢

(

0

)

)

=

𝗋𝖾𝖿𝗅

0

by

definition

of

𝖽𝖾𝖼𝗈𝖽𝖾

.
And in the case of a successor, by the

inductive hypothesis

we have

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

n

,

n

,

r

⁢

(

n

)

)

=

𝗋𝖾𝖿𝗅

n

, so it suffices to observe that

𝖺𝗉

𝗌𝗎𝖼𝖼

⁢

(

𝗋𝖾𝖿𝗅

n

)

≡

𝗋𝖾𝖿𝗅

𝗌𝗎𝖼𝖼

⁢

(

n

)

.

On the other hand, if we start with

c

:

𝖼𝗈𝖽𝖾

⁢

(

m

,

n

)

, then we proceed by double induction on

m

and

n

.
If both are

0

, then

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

0

,

0

,

c

)

≡

𝗋𝖾𝖿𝗅

0

, while

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

0

,

0

,

𝗋𝖾𝖿𝗅

0

)

≡

r

⁢

(

0

)

≡

⋆

.
Thus, it suffices to recall from §2.8 (

http://planetmath.org/28theunittype

) that every inhabitant of

𝟏

is equal to

⋆

.
If

m

is

0

but

n

is a successor, or vice versa, then

c

:

𝟎

, so we are done.
And in the case of two successors, we have

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

,

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

,

c

)

)

=

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

n

)

,

𝖺𝗉

𝗌𝗎𝖼𝖼

⁢

(

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

c

)

)

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

–

)

⁢

(

𝖺𝗉

𝗌𝗎𝖼𝖼

⁢

(

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

c

)

)

,

r

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

)

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

𝖼𝗈𝖽𝖾

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

,

𝗌𝗎𝖼𝖼

⁢

(

–

)

)

⁢

(

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

c

)

,

r

⁢

(

𝗌𝗎𝖼𝖼

⁢

(

m

)

)

)

=

𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍

𝖼𝗈𝖽𝖾

⁢

(

m

,

–

)

⁢

(

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

c

)

,

r

⁢

(

m

)

)

=

𝖾𝗇𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

𝖽𝖾𝖼𝗈𝖽𝖾

⁢

(

m

,

n

,

c

)

)

=

c

using the inductive hypothesis.
∎

In particular, we have

𝖾𝗇𝖼𝗈𝖽𝖾

(

𝗌𝗎𝖼𝖼

(

m

)

,

0

)

:

(

𝗌𝗎𝖼𝖼

(

m

)

=

0

)

→

𝟎

(2.13.2)

which shows that “

0

is not the successor of any natural number”.
We also have the composite

(

𝗌𝗎𝖼𝖼

(

m

)

=

𝗌𝗎𝖼𝖼

(

n

)

)

→

𝖾𝗇𝖼𝗈𝖽𝖾

𝖼𝗈𝖽𝖾

(

𝗌𝗎𝖼𝖼

(

m

)

,

𝗌𝗎𝖼𝖼

(

n

)

)

≡

𝖼𝗈𝖽𝖾

(

m

,

n

)

→

𝖽𝖾𝖼𝗈𝖽𝖾

(

m

=

n

)

(2.13.3)

which shows that the function

𝗌𝗎𝖼𝖼

is

injective

.

We will study more general positive types in

http://planetmath.org/node/87578

Chapter 5,

http://planetmath.org/node/87579

Chapter 6.
In

http://planetmath.org/node/87582

Chapter 8, we will see that the same technique used here to characterize the identity types of coproducts and

ℕ

can also be used to calculate homotopy groups of spheres.

Title

2.13 Natural numbers

\metatable

Generated on Thu Feb 8 19:33:12 2018 by

LaTeXML