2.13 Natural numbers


We use the encode-decode method to characterize the path space of the natural numbersMathworldPlanetmath, 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 inductionMathworldPlanetmath 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 successorMathworldPlanetmathPlanetmathPlanetmath 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-inversesPlanetmathPlanetmath 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 injectivePlanetmathPlanetmath.

We will study more general positive types in http://planetmath.org/node/87578Chapter 5,http://planetmath.org/node/87579Chapter 6. In http://planetmath.org/node/87582Chapter 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