nLab integers type

Contents

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Deduction and Induction

Foundations

foundations

The basis of it all

 Set theory

set theory

Foundational axioms

foundational axioms

Removing axioms

Contents

Idea

In type theory: the integers type is the type of integers.

Definitions

As the inductive type generated by an element and an equivalence of types

Assuming that identification types, equivalence types and dependent product types exist in the type theory, the integers type is the inductive type generated by an element and an equivalence of types:

Formation rules for the integers type:

ΓctxΓtype\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash \mathbb{Z} \; \mathrm{type}}

Introduction rules for the integers type:

ΓctxΓ0:ΓctxΓs:\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash 0:\mathbb{Z}} \qquad \frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash s:\mathbb{Z} \simeq \mathbb{Z}}

Elimination rules for the integers type:

Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γn:Γind C(c 0,c s,n):C(n)\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x)) \quad \Gamma \vdash n:\mathbb{Z}}{\Gamma \vdash \mathrm{ind}_\mathbb{Z}^C(c_0, c_s, n):C(n)}

Computation rules for the integers type:

  • Judgmental computation rules
Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γind C(c 0,c s,0)c 0:C(0)\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x))}{\Gamma \vdash \mathrm{ind}_\mathbb{Z}^C(c_0, c_s, 0) \equiv c_0:C(0)}
Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γn:Γind C(c 0,c s,s(n))c s(n)(ind C(c 0,c s,n)):C(s(n))\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x)) \quad \Gamma \vdash n:\mathbb{Z}}{\Gamma \vdash \mathrm{ind}_\mathbb{Z}^C(c_0, c_s, s(n)) \equiv c_s(n)(\mathrm{ind}_\mathbb{Z}^C(c_0, c_s, n)):C(s(n))}
  • Typal computation rules
Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γβ 0(c 0,c s):Id C(0)(ind C(c 0,c s,0),c 0)\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x))}{\Gamma \vdash \beta_\mathbb{Z}^0(c_0, c_s):\mathrm{Id}_{C(0)}(\mathrm{ind}_\mathbb{Z}^C(c_0, c_s, 0), c_0)}
Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γn:Γβ s(c 0,c s,n):Id C(s(n))(ind C(c 0,c s,s(n)),c s(n)(ind C(c 0,c s,n)))\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x)) \quad \Gamma \vdash n:\mathbb{Z}}{\Gamma \vdash \beta_\mathbb{Z}^s(c_0, c_s, n):\mathrm{Id}_{C(s(n))}(\mathrm{ind}_\mathbb{Z}^C(c_0, c_s, s(n)), c_s(n)(\mathrm{ind}_\mathbb{Z}^C(c_0, c_s, n)))}

Uniqueness rules for the integers type:

  • Judgmental uniqueness rules
Γ,x:C(x)typeΓc: x:C(x)Γn:Γind C(c(0),λx:.c(s(x)),n)c(n):C(n)\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c:\prod_{x:\mathbb{Z}} C(x) \quad \Gamma \vdash n:\mathbb{Z}}{\Gamma \vdash \mathrm{ind}_\mathbb{Z}^C(c(0), \lambda x:\mathbb{Z}.c(s(x)), n) \equiv c(n):C(n)}
  • Typal uniqueness rules
Γ,x:C(x)typeΓc: x:C(x)Γn:Γη (c,n):Id C(n)(ind C(c(0),λx:.c(s(x)),n),c(n))\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c:\prod_{x:\mathbb{Z}} C(x) \quad \Gamma \vdash n:\mathbb{Z}}{\Gamma \vdash \eta_\mathbb{Z}(c, n):\mathrm{Id}_{C(n)}(\mathrm{ind}_\mathbb{Z}^C(c(0), \lambda x:\mathbb{Z}.c(s(x)), n), c(n))}

The elimination, computation, and uniqueness rules for the integers type state that the integers type satisfy the dependent universal property of the integers. 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 the integers could be simplified to the following rule:

Γ,x:C(x)typeΓc 0:C(0)Γc s: x:C(x)C(s(x))Γup C(c 0,c s):!c: x:C(x).Id C(0)(c(0),c 0)× x:Id C(s(x))(c(s(x)),c s(c(x)))\frac{\Gamma, x:\mathbb{Z} \vdash C(x) \; \mathrm{type} \quad \Gamma \vdash c_0:C(0) \quad \Gamma \vdash c_s:\prod_{x:\mathbb{Z}} C(x) \simeq C(s(x))}{\Gamma \vdash \mathrm{up}_\mathbb{Z}^C(c_0, c_s):\exists!c:\prod_{x:\mathbb{Z}} C(x).\mathrm{Id}_{C(0)}(c(0), c_0) \times \prod_{x:\mathbb{Z}} \mathrm{Id}_{C(s(x))}(c(s(x)), c_s(c(x)))}

As the underlying type of the free infinity-group on the unit type

The integers type is the underlying type of free infinity-group on the unit type

UnderlyingTypeOfFreeGroup(𝟙)\mathbb{Z} \coloneqq \mathrm{UnderlyingTypeOfFree}\infty\mathrm{Group}(\mathbb{1})

As the loop space of the circle type

Given a dependent type theory with identity types, equivalence types, a univalent universe, and the circle type which is an essentially small type relative to the universe universe, the type of integers is defined as the loop space type of the circle type at the canonical element base:S 1\mathrm{base}:S^1:

base= S 1base\mathbb{Z} \coloneqq \mathrm{base} =_{S^1} \mathrm{base}

As a quotient of a product type

Definition

The integers type is defined as the higher inductive type generated by:

  • A function inj:2×inj : \mathbf{2} \times \mathbb{N} \rightarrow \mathbb{Z}.
  • An identity representing that positive and negative zero are equal: ν 0:inj(0,0)=inj(1,0)\nu_0: inj(0, 0) = inj(1, 0).
Definition

The integers type is defined as the higher inductive type generated by:

  • A function inj:×inj : \mathbb{N} \times \mathbb{N} \rightarrow \mathbb{Z}.
  • A dependent product of functions between identities representing that equivalent differences are equal:
    equivdiff: a: b: c: d:(a+d=c+b)(inj(a,b)=inj(c,d))equivdiff : \prod_{a:\mathbb{N}} \prod_{b:\mathbb{N}} \prod_{c:\mathbb{N}} \prod_{d:\mathbb{N}} (a + d = c + b) \to (inj(a,b) = inj(c,d))
  • A set-truncator
    τ 0: a: b:isProp(a=b)\tau_0: \prod_{a:\mathbb{Z}} \prod_{b:\mathbb{Z}} isProp(a=b)

Properties

We assume in this section that the integers type is defined as the inductive type generated by an element and an equivalence of types.

Extensionality principle of the integers type

By the recursion principle of the natural numbers, there is a function

rec (0,π 1(s)):\mathrm{rec}_{\mathbb{N}}(0, \pi_1(s)):\mathbb{N} \to \mathbb{Z}

which takes zero of the natural numbers to zero of the integers and the successor function of the natural numbrers to the successor equivalence of the integers, where π 1\pi_1 is the first projection function of the dependent sum type f:isEquiv(f)\sum_{f:\mathbb{Z} \to \mathbb{Z}} \mathrm{isEquiv}(f). The extensionality principle of the circle type states that the above function is an embedding of types,

ext S 1:isEmbed(rec (0,π 1(s)))\mathrm{ext}_{S^1}:\mathrm{isEmbed}\left(\mathrm{rec}_{\mathbb{N}}(0, \pi_1(s))\right)

or equivalently that application of the above function is an equivalence for all natural numbers m:m:\mathbb{N}, n:n:\mathbb{N}

ext S 1: m: n:isEquiv(ap rec (0,π 1(s))(m,n))\mathrm{ext}_{S^1}:\prod_{m:\mathbb{N}} \prod_{n:\mathbb{N}} \mathrm{isEquiv}\left(\mathrm{ap}_{\mathrm{rec}_{\mathbb{N}}(0, \pi_1(s))}(m, n)\right)

Theorem

The integers type has decidable equality.

Proof

Double induction

From the inference rules for the integers type, one could derive the following rules for double induction, which is important for the definition of addition, subtraction, and multiplication on the integers:

Γ,x:,y:C(x,y)typeΓc 0,0:C(0,0)Γc 0,s: x:C(0,x)C(0,s(x)) Γc s,0: x:C(x,0)C(s(x),0)Γc s,s: x: y:C(x,y)C(s(x),s(y))Γind C(c 0,0,c 0,s,c s,0,c s,s): m: n:C(m,n)\frac{ \begin{array}{c} \Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash C(x, y) \; \mathrm{type} \quad \Gamma \vdash c_{0, 0}:C(0, 0) \quad \Gamma \vdash c_{0, s}:\prod_{x:\mathbb{Z}} C(0, x) \simeq C(0, s(x)) \\ \Gamma \vdash c_{s, 0}:\prod_{x:\mathbb{Z}} C(x, 0) \simeq C(s(x), 0) \quad \Gamma \vdash c_{s, s}:\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} C(x, y) \simeq C(s(x), s(y)) \end{array} }{\Gamma \vdash \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}):\prod_{m:\mathbb{Z}} \prod_{n:\mathbb{Z}} C(m, n)}
Γ,x:,y:C(x,y)typeΓc 0,0:C(0,0)Γc 0,s: x:C(0,x)C(0,s(x)) Γc s,0: x:C(x,0)C(s(x),0)Γc s,s: x: y:C(x,y)C(s(x),s(y))Γβ C,0,0(c 0,0,c 0,s,c s,0,c s,s):ind C(c 0,0,c 0,s,c s,0,c s,s,0,0)= C(0,0)c 0,0\frac{ \begin{array}{c} \Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash C(x, y) \; \mathrm{type} \quad \Gamma \vdash c_{0, 0}:C(0, 0) \quad \Gamma \vdash c_{0, s}:\prod_{x:\mathbb{Z}} C(0, x) \simeq C(0, s(x)) \\ \Gamma \vdash c_{s, 0}:\prod_{x:\mathbb{Z}} C(x, 0) \simeq C(s(x), 0) \quad \Gamma \vdash c_{s, s}:\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} C(x, y) \simeq C(s(x), s(y)) \end{array} }{\Gamma \vdash \beta_\mathbb{Z}^{C, 0, 0}(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}):\mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, 0, 0) =_{C(0, 0)} c_{0, 0}}
Γ,x:,y:C(x,y)typeΓc 0,0:C(0,0)Γc 0,s: x:C(0,x)C(0,s(x)) Γc s,0: x:C(x,0)C(s(x),0)Γc s,s: x: y:C(x,y)C(s(x),s(y))Γβ C,0,s(c 0,0,c 0,s,c s,0,c s,s): n:ind C(c 0,0,c 0,s,c s,0,c s,s,0,s(n))= C(0,s(n))c 0,s(n,ind C(c 0,0,c 0,s,c s,0,c s,s,0,n))\frac{ \begin{array}{c} \Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash C(x, y) \; \mathrm{type} \quad \Gamma \vdash c_{0, 0}:C(0, 0) \quad \Gamma \vdash c_{0, s}:\prod_{x:\mathbb{Z}} C(0, x) \simeq C(0, s(x)) \\ \Gamma \vdash c_{s, 0}:\prod_{x:\mathbb{Z}} C(x, 0) \simeq C(s(x), 0) \quad \Gamma \vdash c_{s, s}:\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} C(x, y) \simeq C(s(x), s(y)) \end{array} }{\Gamma \vdash \beta_\mathbb{Z}^{C, 0, s}(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}):\prod_{n:\mathbb{Z}} \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, 0, s(n)) =_{C(0, s(n))} c_{0, s}(n, \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, 0, n))}
Γ,x:,y:C(x,y)typeΓc 0,0:C(0,0)Γc 0,s: x:C(0,x)C(0,s(x)) Γc s,0: x:C(x,0)C(s(x),0)Γc s,s: x: y:C(x,y)C(s(x),s(y))Γβ C,s,0(c 0,0,c 0,s,c s,0,c s,s): n:ind C(c 0,0,c 0,s,c s,0,c s,s,s(n),0)= C(s(n),0)c s,0(n,ind C(c 0,0,c 0,s,c s,0,c s,s,n,0))\frac{ \begin{array}{c} \Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash C(x, y) \; \mathrm{type} \quad \Gamma \vdash c_{0, 0}:C(0, 0) \quad \Gamma \vdash c_{0, s}:\prod_{x:\mathbb{Z}} C(0, x) \simeq C(0, s(x)) \\ \Gamma \vdash c_{s, 0}:\prod_{x:\mathbb{Z}} C(x, 0) \simeq C(s(x), 0) \quad \Gamma \vdash c_{s, s}:\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} C(x, y) \simeq C(s(x), s(y)) \end{array} }{\Gamma \vdash \beta_\mathbb{Z}^{C, s, 0}(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}):\prod_{n:\mathbb{Z}} \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, s(n), 0) =_{C(s(n), 0)} c_{s, 0}(n, \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, n, 0))}
Γ,x:,y:C(x,y)typeΓc 0,0:C(0,0)Γc 0,s: x:C(0,x)C(0,s(x)) Γc s,0: x:C(x,0)C(s(x),0)Γc s,s: x: y:C(x,y)C(s(x),s(y))Γβ C,s,s(c 0,0,c 0,s,c s,0,c s,s): m: n:ind C(c 0,0,c 0,s,c s,0,c s,s,s(m),s(n))= C(s(m),s(n))c 0,s(m,n,ind C(c 0,0,c 0,s,c s,0,c s,s,m,n))\frac{ \begin{array}{c} \Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash C(x, y) \; \mathrm{type} \quad \Gamma \vdash c_{0, 0}:C(0, 0) \quad \Gamma \vdash c_{0, s}:\prod_{x:\mathbb{Z}} C(0, x) \simeq C(0, s(x)) \\ \Gamma \vdash c_{s, 0}:\prod_{x:\mathbb{Z}} C(x, 0) \simeq C(s(x), 0) \quad \Gamma \vdash c_{s, s}:\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} C(x, y) \simeq C(s(x), s(y)) \end{array} }{\Gamma \vdash \beta_\mathbb{Z}^{C, s, s}(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}):\prod_{m:\mathbb{Z}} \prod_{n:\mathbb{Z}} \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, s(m), s(n)) =_{C(s(m), s(n))} c_{0, s}(m, n, \mathrm{ind}_\mathbb{Z}^C(c_{0, 0}, c_{0, s}, c_{s, 0}, c_{s, s}, m, n))}

Addition on the integers

Definition

The binary operation addition is defined by double induction, where the type family CC is the constant type family \mathbb{Z}, c 0,0c_{0, 0} is 00, c 0,sc_{0, s} and c s,0c_{s, 0} are both the constant function λn:.s\lambda n:\mathbb{Z}.s which takes integers to the successor equivalence, and c s,sc_{s, s} is the constant function λm:.λn:.ss\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s which takes pairs of integers to the composition of the successor equivalence with itself, and is defined pointwise as

x:,y:x+yind (0,λn:.s,λn:.s,λm:.λn:.ss,x,y):x:\mathbb{Z}, y:\mathbb{Z} \vdash x + y \equiv \mathrm{ind}_\mathbb{Z}^\mathbb{Z}(0, \lambda n:\mathbb{Z}.s, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s, x, y):\mathbb{Z}

We have similar definitions for the computation rules of addition:

β +,0,0β ,0,0(0,λn:.s,λn:.s,λm:.λn:.ss):0+0= 0\beta_\mathbb{Z}^{+, 0, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, 0}(0, \lambda n:\mathbb{Z}.s, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s):0 + 0 =_{\mathbb{Z}} 0
β +,0,sβ ,0,s(0,λn:.s,λn:.s,λm:.λn:.ss): x:0+s(x)= ((λn:.s)(x))(0+x)\beta_\mathbb{Z}^{+, 0, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, s}(0, \lambda n:\mathbb{Z}.s, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s):\prod_{x:\mathbb{Z}} 0 + s(x) =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.s)(x))(0 + x)
β +,s,0β ,s,0(0,λn:.s,λn:.s,λm:.λn:.ss): x:s(x)+0= ((λn:.s)(x))(x+0)\beta_\mathbb{Z}^{+, s, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, 0}(0, \lambda n:\mathbb{Z}.s, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s):\prod_{x:\mathbb{Z}} s(x) + 0 =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.s)(x))(x + 0)
β +,s,sβ ,s,s(0,λn:.s,λn:.s,λm:.λn:.ss): x: y:s(x)+s(y)= ((λm:.λn:.ss)(x,y))(x+y)\beta_\mathbb{Z}^{+, s, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, s}(0, \lambda n:\mathbb{Z}.s, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s):\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} s(x) + s(y) =_{\mathbb{Z}} ((\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.s \circ s)(x, y))(x + y)

Theorem

The integers type is a non-coherent H-space with respect to the zero integer 0:0:\mathbb{Z} found in the introduction rule of the integers type and addition x:,y:x+y:x:\mathbb{Z}, y:\mathbb{Z} \vdash x + y:\mathbb{Z} defined above.

Proof

We define the homotopies for the H-space structure of the integers type by induction on the integers type. For the case with the element 0:0:\mathbb{Z}, one gets the identity β +,0,0:0+0= 0\beta_\mathbb{Z}^{+, 0, 0}:0 + 0 =_\mathbb{Z} 0 from the rules for addition. For the case with the equivalence s:s:\mathbb{Z} \simeq \mathbb{Z}, the application to ss is itself a dependent function of a family of equivalences,

ap s: y: x:(y= x)(s(y)= s(x))\mathrm{ap}_{s}:\prod_{y:\mathbb{Z}} \prod_{x:\mathbb{Z}} (y =_\mathbb{Z} x) \simeq (s(y) =_\mathbb{Z} s(x))

Substituting 0+x0 + x and x+0x + 0 in for yy yields the family of equivalences

x:ap s(0+x,x):(0+x= x)(s(0+x)= s(x))x:\mathbb{Z} \vdash \mathrm{ap}_{s}(0 + x, x):(0 + x =_\mathbb{Z} x) \simeq (s(0 + x) =_\mathbb{Z} s(x))
x:ap s(x+0,x):(x+0= x)(s(x+0)= s(x))x:\mathbb{Z} \vdash \mathrm{ap}_{s}(x + 0, x):(x + 0 =_\mathbb{Z} x) \simeq (s(x + 0) =_\mathbb{Z} s(x))

and by the introduction rule of dependent product types, one gets the dependent functions of families of equivalences

λx:.ap s(0+x,x): x:(0+x= x)(s(0+x)= s(x))\lambda x:\mathbb{Z}.\mathrm{ap}_{s}(0 + x, x):\prod_{x:\mathbb{Z}} (0 + x =_\mathbb{Z} x) \simeq (s(0 + x) =_\mathbb{Z} s(x))
λx:.ap s(x+0,x): x:(x+0= x)(s(x+0)= s(x))\lambda x:\mathbb{Z}.\mathrm{ap}_{s}(x + 0, x):\prod_{x:\mathbb{Z}} (x + 0 =_\mathbb{Z} x) \simeq (s(x + 0) =_\mathbb{Z} s(x))

and by the elimination rules for the integers type, one has families of identifications

x:ind 0+x= x(β +,0,0,λx:.ap s(0+x,x),x):0+x= xx:\mathbb{Z} \vdash \mathrm{ind}_\mathbb{Z}^{0 + x =_\mathbb{Z} x}(\beta_\mathbb{Z}^{+, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{ap}_{s}(0 + x, x), x):0 + x =_\mathbb{Z} x
x:ind x+0= x(β +,0,0,λx:.ap s(x+0,x),x):x+0= xx:\mathbb{Z} \vdash \mathrm{ind}_\mathbb{Z}^{x + 0 =_\mathbb{Z} x}(\beta_\mathbb{Z}^{+, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{ap}_{s}(x + 0, x), x):x + 0 =_\mathbb{Z} x

By the introduction rule of dependent product types, one gets homotopies

lunitadd λx:.ind 0+x= x(β +,0,0,λx:.ap s(0+x,x),x): x:0+x= x\mathrm{lunitadd}_\mathbb{Z} \equiv \lambda x:\mathbb{Z}.\mathrm{ind}_\mathbb{Z}^{0 + x =_\mathbb{Z} x}(\beta_\mathbb{Z}^{+, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{ap}_{s}(0 + x, x), x):\prod_{x:\mathbb{Z}} 0 + x =_\mathbb{Z} x
runitadd λx:.ind x+0= x(β +,0,0,λx:.ap s(x+0,x),x): x:x+0= x\mathrm{runitadd}_\mathbb{Z} \equiv \lambda x:\mathbb{Z}.\mathrm{ind}_\mathbb{Z}^{x + 0 =_\mathbb{Z} x}(\beta_\mathbb{Z}^{+, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{ap}_{s}(x + 0, x), x):\prod_{x:\mathbb{Z}} x + 0 =_\mathbb{Z} x

Thus, the integers type is a non-coherent H-space.

Theorem

The integers type is an associative non-coherent H-space.

Proof

Theorem

The integers type is invertible with respect to the H-space structure of addition - such that given an integer x:x:\mathbb{Z}, left addition and right addition by xx is each an equivalence of types.

Proof

Corollary

The integers type is a non-coherent H-group, a non-coherent H-space which is invertible and associative.

Theorem

The integers type is non-coherently abelian with respect to addition.

Proof

Negation on the integers

Definition

The unary operation negation is defined by induction on the integers type, where the type family CC is the constant type family \mathbb{Z}, c 0c_{0} is 00, and c sc_{s} is the constant function λn:.s 1\lambda n:\mathbb{Z}.s^{-1} which takes integers to the inverse of the successor equivalence, and is defined pointwise as

x:xind (0,λn:.s 1,x):x:\mathbb{Z} \vdash -x \equiv \mathrm{ind}_\mathbb{Z}^\mathbb{Z}(0, \lambda n:\mathbb{Z}.s^{-1}, x):\mathbb{Z}

We have similar definitions for the computation rules of negation:

β ,0β ,0(0,λn:.s 1):0= 0\beta_\mathbb{Z}^{-, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0}(0, \lambda n:\mathbb{Z}.s^{-1}):-0 =_{\mathbb{Z}} 0
β ,sβ ,s(0,λn:.s 1): x:s(x)= ((λn:.s 1)(x))(x)s 1(x)\beta_\mathbb{Z}^{-, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s}(0, \lambda n:\mathbb{Z}.s^{-1}):\prod_{x:\mathbb{Z}} -s(x) =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.s^{-1})(x))(-x) \equiv s^{-1}(-x)

Subtraction on the integers

Definition

The binary operation subtraction is defined by double induction, where the type family CC is the constant type family \mathbb{Z}, c 0,0c_{0, 0} is 00, c 0,sc_{0, s} is the constant function λn:.s 1\lambda n:\mathbb{Z}.s^{-1} which takes integers to the inverse of the successor equivalence, c s,0c_{s, 0} is the constant function λn:.s\lambda n:\mathbb{Z}.s which takes integers to the successor equivalence, and c s,sc_{s, s} is the constant function λm:.λn:.id \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z} which takes pairs of integers to the identity equivalence on the integers, and is defined pointwise as

x:,y:xyind (0,λn:.s 1,λn:.s,λm:.λn:.id ,x,y):x:\mathbb{Z}, y:\mathbb{Z} \vdash x - y \equiv \mathrm{ind}_\mathbb{Z}^\mathbb{Z}(0, \lambda n:\mathbb{Z}.s^{-1}, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, x, y):\mathbb{Z}

We have similar definitions for the computation rules of subtraction:

β ,0,0β ,0,0(0,λn:.s 1,λn:.s,λm:.λn:.id ):00= 0\beta_\mathbb{Z}^{-, 0, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, 0}(0, \lambda n:\mathbb{Z}.s^{-1}, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}):0 - 0 =_{\mathbb{Z}} 0
β ,0,sβ ,0,s(0,λn:.s 1,λn:.s,λm:.λn:.id ): x:0s(x)= ((λn:.s 1)(x))(0x)s 1(0x)\beta_\mathbb{Z}^{-, 0, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, s}(0, \lambda n:\mathbb{Z}.s^{-1}, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}):\prod_{x:\mathbb{Z}} 0 - s(x) =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.s^{-1})(x))(0 - x) \equiv s^{-1}(0 - x)
β ,s,0β ,s,0(0,λn:.s 1,λn:.s,λm:.λn:.id ): x:s(x)0= ((λn:.s)(x))(x0)s(x0)\beta_\mathbb{Z}^{-, s, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, 0}(0, \lambda n:\mathbb{Z}.s^{-1}, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}):\prod_{x:\mathbb{Z}} s(x) - 0 =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.s)(x))(x - 0) \equiv s(x - 0)
β ,s,sβ ,s,s(0,λn:.s 1,λn:.s,λm:.λn:.id ): x: y:s(x)s(y)= ((λm:.λn:.id )(x,y))(xy)xy\beta_\mathbb{Z}^{-, s, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, s}(0, \lambda n:\mathbb{Z}.s^{-1}, \lambda n:\mathbb{Z}.s, \lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}):\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} s(x) - s(y) =_{\mathbb{Z}} ((\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z})(x, y))(x - y) \equiv x - y

Theorem

For all x:x:\mathbb{Z} and y:y:\mathbb{Z}, we have an identification of type

xy= x+(y)x - y =_\mathbb{Z} x + (- y)

Set-truncation structure

To do: figure out a way to prove that the integers type is 0-truncated without using the natural numbers type. Then we define the natural numbers type \mathbb{N} as the quotient of the integers type by its group of units / ×\mathbb{Z}/\mathbb{Z}^\times.

Theorem

The natural numbers type \mathbb{N} is 0-truncated.

Proof

Theorem

The natural numbers type \mathbb{N} and the integers type \mathbb{Z} are equivalent to each other.

Proof

Corollary

The integers type are an abelian group.

Proof

Since \mathbb{N} is 0-truncated, and equivalences preserve truncatedness, by the equivalence e:e:\mathbb{N} \simeq \mathbb{Z}, \mathbb{Z} is also 0-truncated. Since \mathbb{Z} is an non-coherently abelian H-group, this implies that \mathbb{Z} is a abelian group.

Multiplication on the integers

To do: figure out a way to prove the various properties of multiplication without using the fact that the integers are a set (i.e. the integers are a non-coherently abelian H-ring).

Definition

Since the integers are a non-coherently abelian H-group with respect to addition, right addition by an integer kk, λz:.z+k\lambda z:\mathbb{Z}.z + k, is an equivalence.

The binary operation multiplication is defined by double induction, where the type family CC is the constant type family \mathbb{Z}, c 0,0c_{0, 0} is 00, c 0,sc_{0, s} and c s,0c_{s, 0} are both the constant function λn:.id \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z} which takes integers to the identity equivalence on the integers, and c s,sc_{s, s} is the function λm:.λn:.λz:.z+s(m+n)\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n) which takes pairs of integers to the equivalence λz:.z+s(m+n)\lambda z:\mathbb{Z}.z + s(m + n), and is defined pointwise as

x:,y:xyind (0,λn:.id ,λn:.id ,λm:.λm:.λn:.λz:.z+s(m+n),x,y):x:\mathbb{Z}, y:\mathbb{Z} \vdash x \cdot y \equiv \mathrm{ind}_\mathbb{Z}^\mathbb{Z}(0, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda m:\mathbb{Z}.\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n), x, y):\mathbb{Z}

We have similar definitions for the computation rules of multiplication:

β ,0,0β ,0,0(0,λn:.id ,λn:.id ,λm:.λm:.λn:.λz:.z+s(m+n)):00= 0\beta_\mathbb{Z}^{\cdot, 0, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, 0}(0, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda m:\mathbb{Z}.\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n)):0 \cdot 0 =_{\mathbb{Z}} 0
β ,0,sβ ,0,s(0,λn:.id ,λn:.id ,λm:.λm:.λn:.λz:.z+s(m+n)): x:0s(x)= ((λn:.id )(x))(0x)0x\beta_\mathbb{Z}^{\cdot, 0, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, 0, s}(0, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda m:\mathbb{Z}.\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n)):\prod_{x:\mathbb{Z}} 0 \cdot s(x) =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z})(x))(0 \cdot x) \equiv 0 \cdot x
β ,s,0β ,s,0(0,λn:.id ,λn:.id ,λm:.λm:.λn:.λz:.z+s(m+n)): x:s(x)0= ((λn:.id )(x))(x0)x0\beta_\mathbb{Z}^{\cdot, s, 0} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, 0}(0, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda m:\mathbb{Z}.\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n)):\prod_{x:\mathbb{Z}} s(x) \cdot 0 =_{\mathbb{Z}} ((\lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z})(x))(x \cdot 0) \equiv x \cdot 0
β ,s,sβ ,s,s(0,λn:.id ,λn:.id ,λm:.λm:.λn:.λz:.z+s(m+n)): x: y:s(x)s(y)= ((λm:.λn:.λz:.z+s(m+n)))(x,y))(xy)xy+s(x+y)\beta_\mathbb{Z}^{\cdot, s, s} \equiv \beta_\mathbb{Z}^{\mathbb{Z}, s, s}(0, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda n:\mathbb{Z}.\mathrm{id}_\mathbb{Z}, \lambda m:\mathbb{Z}.\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n)):\prod_{x:\mathbb{Z}} \prod_{y:\mathbb{Z}} s(x) \cdot s(y) =_{\mathbb{Z}} ((\lambda m:\mathbb{Z}.\lambda n:\mathbb{Z}.\lambda z:\mathbb{Z}.z + s(m + n)))(x, y))(x \cdot y) \equiv x \cdot y + s(x + y)

Theorem

The integers type is an absorption magma with respect to the zero integer 0:0:\mathbb{Z} and multiplication x:,y:xy:x:\mathbb{Z}, y:\mathbb{Z} \vdash x \cdot y:\mathbb{Z} defined above.

Proof

We begin with the left absorption law, that 0x= 00 \cdot x =_\mathbb{Z} 0 for all x:x:\mathbb{Z}. By the computation rules for the integers type, we have

β ,0,0:00= 0\beta_\mathbb{Z}^{\cdot, 0, 0}:0 \cdot 0 =_{\mathbb{Z}} 0

Then we need to show that for all x:x:\mathbb{Z} we have an equivalence

(0x= 0)(0s(x)= 0)(0 \cdot x =_{\mathbb{Z}} 0) \simeq (0 \cdot s(x) =_{\mathbb{Z}} 0)

But that’s given by transport across the identification

β ,0,s(x) 1:0x= 0s(x)\beta_\mathbb{Z}^{\cdot, 0, s}(x)^{-1}:0 \cdot x =_\mathbb{Z} 0 \cdot s(x)

for the type family x= 0x =_\mathbb{Z} 0:

transport x:.x= 0(0x,0s(x),β ,0,s(x) 1):(0x= 0)(0s(x)= 0)\mathrm{transport}_{x:\mathbb{Z}.x =_\mathbb{Z} 0}(0 \cdot x, 0 \cdot s(x), \beta_\mathbb{Z}^{\cdot, 0, s}(x)^{-1}):(0 \cdot x =_{\mathbb{Z}} 0) \simeq (0 \cdot s(x) =_{\mathbb{Z}} 0)

Thus, by induction on the integers, we have

labsorp ind x:.x0= 0(β ,0,0,λx:.transport x:.x= 0(0x,0s(x),β ,0,s(x) 1)): x:0x= 0\mathrm{labsorp}_\mathbb{Z} \equiv \mathrm{ind}_\mathbb{Z}^{x:\mathbb{Z}.x \cdot 0 =_\mathbb{Z} 0}(\beta_\mathbb{Z}^{\cdot, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{transport}_{x:\mathbb{Z}.x =_\mathbb{Z} 0}(0 \cdot x, 0 \cdot s(x), \beta_\mathbb{Z}^{\cdot, 0, s}(x)^{-1})):\prod_{x:\mathbb{Z}} 0 \cdot x =_\mathbb{Z} 0

Similarly, for the right absorption law, we have an equivalence

(x0= 0)(s(x)0= 0)(x \cdot 0 =_{\mathbb{Z}} 0) \simeq (s(x) \cdot 0 =_{\mathbb{Z}} 0)

given by transport across the identification

β ,s,0(x) 1:x0= s(x)0\beta_\mathbb{Z}^{\cdot, s, 0}(x)^{-1}:x \cdot 0 =_\mathbb{Z} s(x) \cdot 0

for the type family x= 0x =_\mathbb{Z} 0:

transport x:.x= 0(x0,s(x)0,β ,s,0(x) 1):(x0= 0)(s(x)0= 0)\mathrm{transport}_{x:\mathbb{Z}.x =_\mathbb{Z} 0}(x \cdot 0, s(x) \cdot 0, \beta_\mathbb{Z}^{\cdot, s, 0}(x)^{-1}):(x \cdot 0 =_{\mathbb{Z}} 0) \simeq (s(x) \cdot 0 =_{\mathbb{Z}} 0)

Thus, by induction on the integers, we have

rabsorp ind x:.0x= 0(β ,0,0,λx:.transport x:.x= 0(x0,s(x)0,β ,s,0(x) 1)): x:x0= 0\mathrm{rabsorp}_\mathbb{Z} \equiv \mathrm{ind}_\mathbb{Z}^{x:\mathbb{Z}.0 \cdot x =_\mathbb{Z} 0}(\beta_\mathbb{Z}^{\cdot, 0, 0}, \lambda x:\mathbb{Z}.\mathrm{transport}_{x:\mathbb{Z}.x =_\mathbb{Z} 0}(x \cdot 0, s(x) \cdot 0, \beta_\mathbb{Z}^{\cdot, s, 0}(x)^{-1})):\prod_{x:\mathbb{Z}} x \cdot 0 =_\mathbb{Z} 0

Thus, the integers are an absorption magma with respect to zero and multiplication.

Theorem

Multiplication in the integers type is bilinear with respect to addition.

Proof

We begin with bilinearity in the right parameter of multiplication, and we prove by double induction on the integers: given an integer x:x:\mathbb{Z}, we need to show the following types have elements:

x(0+0)= x0+x0x \cdot (0 + 0) =_\mathbb{Z} x \cdot 0 + x \cdot 0
y:(x(0+y)= x0+xy)(x(0+s(y))= x0+xs(y))\prod_{y:\mathbb{Z}} (x \cdot (0 + y) =_\mathbb{Z} x \cdot 0 + x \cdot y) \simeq (x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot 0 + x \cdot s(y))
y:(x(y+0)= xy+x0)(x(s(y)+0)= xs(y)+x0)\prod_{y:\mathbb{Z}} (x \cdot (y + 0) =_\mathbb{Z} x \cdot y + x \cdot 0) \simeq (x \cdot (s(y) + 0) =_\mathbb{Z} x \cdot s(y) + x \cdot 0)
y: z:(x(y+z)= xy+xz)(x(s(y)+s(z))= xs(y)+xs(z))\prod_{y:\mathbb{Z}} \prod_{z:\mathbb{Z}} (x \cdot (y + z) =_\mathbb{Z} x \cdot y + x \cdot z) \simeq (x \cdot (s(y) + s(z)) =_\mathbb{Z} x \cdot s(y) + x \cdot s(z))

Now, for the first type, by application of the function λz:.xz\lambda z:\mathbb{Z}.x \cdot z on the identification β +,0,0:0+0= 0\beta_\mathbb{Z}^{+, 0, 0}:0 + 0 =_\mathbb{Z} 0, we have

ap λz:.xz(0+0,0,β +,0,0):x(0+0)= x0\mathrm{ap}_{\lambda z:\mathbb{Z}.x \cdot z}(0 + 0, 0, \beta_\mathbb{Z}^{+, 0, 0}):x \cdot (0 + 0) =_\mathbb{Z} x \cdot 0

Similarly, by the right absorption law of multiplication, we have

rabsorp (x):x0= 0\mathrm{rabsorp}_\mathbb{Z}(x):x \cdot 0 =_\mathbb{Z} 0

and by application of the function λz:.x0+z\lambda z:\mathbb{Z}.x \cdot 0 + z across rabsorp (x)\mathrm{rabsorp}_\mathbb{Z}(x), we have

ap λz:.x0+z(x0,0,rabsorp (x)):x0+x0= x0+0\mathrm{ap}_{\lambda z:\mathbb{Z}.x \cdot 0 + z}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):x \cdot 0 + x \cdot 0 =_\mathbb{Z} x \cdot 0 + 0

By the right unit law for addition, we have

runitadd (x0):x0+0= x0\mathrm{runitadd}_{\mathbb{Z}}(x \cdot 0):x \cdot 0 + 0 =_{\mathbb{Z}} x \cdot 0

Thus, by concatenating identifications we have

rdist 0,0(x)ap λz:.xz(0+0,0,β +,0,0)runitadd (x0) 1ap λz:.x0+z(x0,0,rabsorp (x)) 1:x(0+0)= x0+x0\mathrm{rdist}_\mathbb{Z}^{0, 0}(x) \equiv \mathrm{ap}_{\lambda z:\mathbb{Z}.x \cdot z}(0 + 0, 0, \beta_\mathbb{Z}^{+, 0, 0}) \bullet \mathrm{runitadd}_{\mathbb{Z}}(x \cdot 0)^{-1} \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.x \cdot 0 + z}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x))^{-1}:x \cdot (0 + 0) =_\mathbb{Z} x \cdot 0 + x \cdot 0

Next, we need to show that for all y:y:\mathbb{Z} there is an equivalence of types

(x(0+y)= x0+xy)(x(0+s(y))= x0+xs(y))(x \cdot (0 + y) =_\mathbb{Z} x \cdot 0 + x \cdot y) \simeq (x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot 0 + x \cdot s(y))

By transport across the identification rabsorp (x):x0= 0\mathrm{rabsorp}_\mathbb{Z}(x):x \cdot 0 =_\mathbb{Z} 0 for type families

x(0+y)= z+xyx \cdot (0 + y) =_\mathbb{Z} z + x \cdot y

and

x(0+s(y))= z+xs(y)x \cdot (0 + s(y)) =_\mathbb{Z} z + x \cdot s(y)

we get equivalences

transport z:.x(0+y)= z+xy(x0,0,rabsorp (x)):(x(0+y)= x0+xy)(x(0+y)= 0+xy)\mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + y) =_\mathbb{Z} z + x \cdot y}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):(x \cdot (0 + y) =_\mathbb{Z} x \cdot 0 + x \cdot y) \simeq (x \cdot (0 + y) =_\mathbb{Z} 0 + x \cdot y)

and

transport z:.x(0+s(y))= z+xs(y)(x0,0,rabsorp (x)):(x(0+s(y))= x0+xs(y))(x(0+y)= 0+xs(y))\mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + s(y)) =_\mathbb{Z} z + x \cdot s(y)}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):(x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot 0 + x \cdot s(y)) \simeq (x \cdot (0 + y) =_\mathbb{Z} 0 + x \cdot s(y))

Similarly, by transport across the identification

lunitadd (xy):0+xy= xy\mathrm{lunitadd}_\mathbb{Z}(x \cdot y):0 + x \cdot y =_\mathbb{Z} x \cdot y

for type family

x(0+y)= zx \cdot (0 + y) =_\mathbb{Z} z

we get the equivalence

transport z:.x(0+y)= z(0+xy,xy,lunitadd (xy)):(x(0+y)= 0+xy)(x(0+y)= xy)\mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + y) =_\mathbb{Z} z}(0 + x \cdot y, x \cdot y, \mathrm{lunitadd}_\mathbb{Z}(x \cdot y)):(x \cdot (0 + y) =_\mathbb{Z} 0 + x \cdot y) \simeq (x \cdot (0 + y) =_\mathbb{Z} x \cdot y)

and by transport across the identification

lunitadd (xs(y)):0+xs(y)= xs(y)\mathrm{lunitadd}_\mathbb{Z}(x \cdot s(y)):0 + x \cdot s(y) =_\mathbb{Z} x \cdot s(y)

for type family

x(0+s(y))= zx \cdot (0 + s(y)) =_\mathbb{Z} z

we get the equivalence

transport z:.x(0+s(y))= z(0+xs(y),xs(y),lunitadd (xs(y))):(x(0+s(y))= 0+xs(y))(x(0+s(y))= xs(y))\mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + s(y)) =_\mathbb{Z} z}(0 + x \cdot s(y), x \cdot s(y), \mathrm{lunitadd}_\mathbb{Z}(x \cdot s(y))):(x \cdot (0 + s(y)) =_\mathbb{Z} 0 + x \cdot s(y)) \simeq (x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot s(y))

By transport across the identification

lunitadd (y):0+y= y\mathrm{lunitadd}_\mathbb{Z}(y):0 + y =_\mathbb{Z} y

for type family

xz= xyx \cdot z =_\mathbb{Z} x \cdot y

we get the equivalence

transport z:.xz= xy(0+y,y,lunitadd (y)):(x(0+y)= xy)(xy= xy)\mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(0 + y, y, \mathrm{lunitadd}_\mathbb{Z}(y)):(x \cdot (0 + y) =_\mathbb{Z} x \cdot y) \simeq (x \cdot y =_\mathbb{Z} x \cdot y)

and by transport across the identification

lunitadd (s(y)):0+s(y)= s(y)\mathrm{lunitadd}_\mathbb{Z}(s(y)):0 + s(y) =_\mathbb{Z} s(y)

for type family

xz= xs(y)x \cdot z =_\mathbb{Z} x \cdot s(y)

we get the equivalence

transport z:.xz= xy(0+s(y),s(y),lunitadd (y)):(x(0+s(y))= xs(y))(xs(y)= xs(y))\mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(0 + s(y), s(y), \mathrm{lunitadd}_\mathbb{Z}(y)):(x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot s(y)) \simeq (x \cdot s(y) =_\mathbb{Z} x \cdot s(y))

Thus, it remains to show that there is an equivalence

(xy= xy)(xs(y)= xs(y))(x \cdot y =_\mathbb{Z} x \cdot y) \simeq (x \cdot s(y) =_\mathbb{Z} x \cdot s(y))

But since \mathbb{Z} is a set, both identity types are propositions, and have elements refl (xy)\mathrm{refl}_\mathbb{Z}(x \cdot y) and refl (xs(y))\mathrm{refl}_\mathbb{Z}(x \cdot s(y)) respectively. As a result, both identity types are contractible types, and contractible types are equivalent to each other. Thus, we have an equivalence:

f(x,y):(xy= xy)(xs(y)= xs(y))f(x, y):(x \cdot y =_\mathbb{Z} x \cdot y) \simeq (x \cdot s(y) =_\mathbb{Z} x \cdot s(y))

Finally, by composing all the equivalences above, we get an equivalence

rdist 0,s(x,y)transport z:.x(0+s(y))= z+xs(y)(x0,0,rabsorp (x))transport z:.x(0+s(y))= z(0+xs(y),xs(y),lunitadd (xs(y))) transport z:.xz= xy(0+s(y),s(y),lunitadd (s(y)))f(x,y) transport z:.xz= xy(0+y,y,lunitadd (y))transport z:.x(0+y)= z(0+xy,xy,lunitadd (xy)) transport z:.x(0+y)= z+xy(x0,0,rabsorp (x)):(x(0+y)= x0+xy)(x(0+s(y))= x0+xs(y))\begin{array}{c} \mathrm{rdist}_\mathbb{Z}^{0, s}(x, y) \equiv \mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + s(y)) =_\mathbb{Z} z + x \cdot s(y)}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)) \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + s(y)) =_\mathbb{Z} z}(0 + x \cdot s(y), x \cdot s(y), \mathrm{lunitadd}_\mathbb{Z}(x \cdot s(y)))\\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(0 + s(y), s(y), \mathrm{lunitadd}_\mathbb{Z}(s(y))) \circ f(x, y) \\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(0 + y, y, \mathrm{lunitadd}_\mathbb{Z}(y)) \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + y) =_\mathbb{Z} z}(0 + x \cdot y, x \cdot y, \mathrm{lunitadd}_\mathbb{Z}(x \cdot y)) \\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (0 + y) =_\mathbb{Z} z + x \cdot y}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):(x \cdot (0 + y) =_\mathbb{Z} x \cdot 0 + x \cdot y) \simeq (x \cdot (0 + s(y)) =_\mathbb{Z} x \cdot 0 + x \cdot s(y)) \end{array}

By a similar argument, we have

rdist s,0(x,y)transport z:.x(s(y)+0)= xs(y)+z(x0,0,rabsorp (x))transport z:.x(s(y)+0)= z(xs(y)+0,xs(y),runitadd (xs(y))) transport z:.xz= xy(s(y)+0,s(y),runitadd (s(y)))f(x,y) transport z:.xz= xy(y+0,y,runitadd (y))transport z:.x(y+0)= z(xy+0,xy,runitadd (xy)) transport z:.x(y+0)= xy+z(x0,0,rabsorp (x)):(x(y+0)= xy+x0)(x(s(y)=0)= xs(y)+x0)\begin{array}{c} \mathrm{rdist}_\mathbb{Z}^{s, 0}(x, y) \equiv \mathrm{transport}_{z:\mathbb{Z}.x \cdot (s(y) + 0) =_\mathbb{Z} x \cdot s(y) + z}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)) \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (s(y) + 0) =_\mathbb{Z} z}(x \cdot s(y) + 0, x \cdot s(y), \mathrm{runitadd}_\mathbb{Z}(x \cdot s(y)))\\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(s(y) + 0, s(y), \mathrm{runitadd}_\mathbb{Z}(s(y))) \circ f(x, y) \\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot z =_\mathbb{Z} x \cdot y}(y + 0, y, \mathrm{runitadd}_\mathbb{Z}(y)) \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (y + 0) =_\mathbb{Z} z}(x \cdot y + 0, x \cdot y, \mathrm{runitadd}_\mathbb{Z}(x \cdot y)) \\ \circ \mathrm{transport}_{z:\mathbb{Z}.x \cdot (y + 0) =_\mathbb{Z} x \cdot y + z}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):(x \cdot (y + 0) =_\mathbb{Z} x \cdot y + x \cdot 0) \simeq (x \cdot (s(y) = 0) =_\mathbb{Z} x \cdot s(y) + x \cdot 0) \end{array}

Finally, we need to show that for all y:y:\mathbb{Z} and z:z:\mathbb{Z} there is an equivalence of types

(x(y+z)= xy+xz)(x(s(y)+s(z))= xs(y)+xs(z))(x \cdot (y + z) =_\mathbb{Z} x \cdot y + x \cdot z) \simeq (x \cdot (s(y) + s(z)) =_\mathbb{Z} x \cdot s(y) + x \cdot s(z))

Definition

The integer number one 1:1:\mathbb{Z} is defined as

1s(0):1 \equiv s(0):\mathbb{Z}

Theorem

The integers type is a unital magma with respect to the one integer 1:1:\mathbb{Z} and multiplication x:,y:xy:x:\mathbb{Z}, y:\mathbb{Z} \vdash x \cdot y:\mathbb{Z} both defined above.

Proof

We begin with the right unital laws, that xs(0)= xx \cdot s(0) =_\mathbb{Z} x. By the computation rules for the integers type, we have

β ,0,s(0):0s(0)= 00\beta_\mathbb{Z}^{\cdot, 0, s}(0):0 \cdot s(0) =_{\mathbb{Z}} 0 \cdot 0

Concatenating with β ,0,0\beta_\mathbb{Z}^{\cdot, 0, 0} results in the required identification

β ,0,s(0)β ,0,0:0s(0)= 0\beta_\mathbb{Z}^{\cdot, 0, s}(0) \bullet \beta_\mathbb{Z}^{\cdot, 0, 0}:0 \cdot s(0) =_{\mathbb{Z}} 0

Then we need to show that for all x:x:\mathbb{Z} we have an equivalence

(xs(0)= x)(s(x)s(0)= s(x))(x \cdot s(0) =_{\mathbb{Z}} x) \simeq (s(x) \cdot s(0) =_{\mathbb{Z}} s(x))

We have the family of identifications

x:β ,s,s(x,0):s(x)s(0)= x0+s(x+0)x:\mathbb{Z} \vdash \beta_\mathbb{Z}^{\cdot, s, s}(x, 0):s(x) \cdot s(0) =_{\mathbb{Z}} x \cdot 0 + s(x + 0)

Since multiplication is an absorption magma, we have identifications

rabsorp (x):x0= 0\mathrm{rabsorp}_\mathbb{Z}(x):x \cdot 0 =_\mathbb{Z} 0

so application of the function λz:.z+s(x+0)\lambda z:\mathbb{Z}.z + s(x + 0) to the above identification results in the identification

ap λz:.z+s(x+0)(x0,0,rabsorp (x)):x0+s(x+0)= 0+s(x+0)\mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(x + 0)}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)):x \cdot 0 + s(x + 0) =_{\mathbb{Z}} 0 + s(x + 0)

The left unit law for addition results in

lunitadd (s(x+0)):0+s(x+0)= s(x+0)\mathrm{lunitadd}_\mathbb{Z}(s(x + 0)):0 + s(x + 0) =_{\mathbb{Z}} s(x + 0)

and application of the successor equivalence to the right unit law results in

ap s(x+0,x,runitadd (x)):s(x+0)= s(x)\mathrm{ap}_s(x + 0, x, \mathrm{runitadd}_\mathbb{Z}(x)):s(x + 0) =_{\mathbb{Z}} s(x)

Concatenating all the identifications leads to the identification

β ,s,s(x,0)ap λz:.z+s(x+0)(x0,0,rabsorp (x))lunitadd (s(x+0))ap s(x+0,x,runitadd (x)):s(x)s(0)= s(x)\beta_\mathbb{Z}^{\cdot, s, s}(x, 0) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(x + 0)}(x \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(x)) \bullet \mathrm{lunitadd}_\mathbb{Z}(s(x + 0)) \bullet \mathrm{ap}_s(x + 0, x, \mathrm{runitadd}_\mathbb{Z}(x)):s(x) \cdot s(0) =_{\mathbb{Z}} s(x)

Similarly, by substituting s 1(x)s^{-1}(x) in for xx in the above expression, we have

β ,s,s(s 1(x),0)ap λz:.z+s(s 1(x)+0)(s 1(x)0,0,rabsorp (s 1(x)))lunitadd (s(s 1(x)+0))ap s(s 1(x)+0,s 1(x),runitadd (s 1(x))):s(s 1(x))s(0)= s(s 1(x))\beta_\mathbb{Z}^{\cdot, s, s}(s^{-1}(x), 0) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(s^{-1}(x) + 0)}(s^{-1}(x) \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(s^{-1}(x))) \bullet \mathrm{lunitadd}_\mathbb{Z}(s(s^{-1}(x) + 0)) \bullet \mathrm{ap}_s(s^{-1}(x) + 0, s^{-1}(x), \mathrm{runitadd}_\mathbb{Z}(s^{-1}(x))):s(s^{-1}(x)) \cdot s(0) =_{\mathbb{Z}} s(s^{-1}(x))

In addition, we have the right inverse homotopy

rinv s: x:s(s 1(x))= x\mathrm{rinv}_s:\prod_{x:\mathbb{Z}} s(s^{-1}(x)) =_\mathbb{Z} x

so by transport across the identity rinv s(x)\mathrm{rinv}_s(x) for the type family zs(0)= xz \cdot s(0) =_\mathbb{Z} x, we also have the equivalence

transport z:.zs(0)= x(s(s 1(x)),x,rinv s(x)):(s(s 1(x))s(0)= x)(xs(0)= x)\mathrm{transport}_{z:\mathbb{Z}.z \cdot s(0) =_\mathbb{Z} x}(s(s^{-1}(x)), x, \mathrm{rinv}_s(x)):(s(s^{-1}(x)) \cdot s(0) =_{\mathbb{Z}} x) \simeq (x \cdot s(0) =_{\mathbb{Z}} x)

Thus, we have the identification

transport z:.zs(0)= x(s(s 1(x)),x,rinv s(x))(β ,s,s(s 1(x),0)ap λz:.z+s(s 1(x)+0)(s 1(x)0,0,rabsorp (s 1(x))) lunitadd (s(s 1(x)+0))ap s(s 1(x)+0,s 1(x),runitadd (s 1(x)))rinv s(x)):xs(0)= x\begin{array}{c} \mathrm{transport}_{z:\mathbb{Z}.z \cdot s(0) =_\mathbb{Z} x}(s(s^{-1}(x)), x, \mathrm{rinv}_s(x))(\beta_\mathbb{Z}^{\cdot, s, s}(s^{-1}(x), 0) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(s^{-1}(x) + 0)}(s^{-1}(x) \cdot 0, 0, \mathrm{rabsorp}_\mathbb{Z}(s^{-1}(x))) \\ \bullet \mathrm{lunitadd}_\mathbb{Z}(s(s^{-1}(x) + 0)) \bullet \mathrm{ap}_s(s^{-1}(x) + 0, s^{-1}(x), \mathrm{runitadd}_\mathbb{Z}(s^{-1}(x))) \bullet \mathrm{rinv}_s(x)):x \cdot s(0) =_{\mathbb{Z}} x \end{array}

Since \mathbb{Z} is a set, the identity types xs(0)= xx \cdot s(0) =_{\mathbb{Z}} x and s(x)s(0)= s(x)s(x) \cdot s(0) =_{\mathbb{Z}} s(x) are both propositions, and since they have identifications, both types are contractible types. All contractible types are equivalent to each other; thus there is an equivalence

f(x):(xs(0)= x)(s(x)s(0)= s(x))f(x):(x \cdot s(0) =_{\mathbb{Z}} x) \simeq (s(x) \cdot s(0) =_{\mathbb{Z}} s(x))

Then, by induction on the integers, there is the homotopy

runitmul :ind xs(0)= x(β ,0,s(0)β ,0,0,λx:.f(x)): x:xs(0)= x\mathrm{runitmul}_\mathbb{Z}:\mathrm{ind}_{\mathbb{Z}}^{x \cdot s(0) =_{\mathbb{Z}} x}(\beta_\mathbb{Z}^{\cdot, 0, s}(0) \bullet \beta_\mathbb{Z}^{\cdot, 0, 0}, \lambda x:\mathbb{Z}.f(x)):\prod_{x:\mathbb{Z}} x \cdot s(0) =_{\mathbb{Z}} x

Next, we derive the left unital laws, that s(0)x= xs(0) \cdot x =_\mathbb{Z} x. By the computation rules for the integers type, we have

β ,s,0(0):s(0)0= 00\beta_\mathbb{Z}^{\cdot, s, 0}(0):s(0) \cdot 0 =_{\mathbb{Z}} 0 \cdot 0

Concatenating with β ,0,0\beta_\mathbb{Z}^{\cdot, 0, 0} results in the required identification

β ,s,0(0)β ,0,0:s(0)0= 0\beta_\mathbb{Z}^{\cdot, s, 0}(0) \bullet \beta_\mathbb{Z}^{\cdot, 0, 0}:s(0) \cdot 0 =_{\mathbb{Z}} 0

Then we need to show that for all x:x:\mathbb{Z} we have an equivalence

(s(0)x= x)(s(0)s(x)= s(x))(s(0) \cdot x =_{\mathbb{Z}} x) \simeq (s(0) \cdot s(x) =_{\mathbb{Z}} s(x))

We have the family of identifications

x:β ,s,s(0,x):s(0)s(x)= 0x+s(0+x)x:\mathbb{Z} \vdash \beta_\mathbb{Z}^{\cdot, s, s}(0, x):s(0) \cdot s(x) =_{\mathbb{Z}} 0 \cdot x + s(0 + x)

Since multiplication is an absorption magma, we have identifications

labsorp (x):0x= 0\mathrm{labsorp}_\mathbb{Z}(x):0 \cdot x =_\mathbb{Z} 0

so application of the function λz:.z+s(0+x)\lambda z:\mathbb{Z}.z + s(0 + x) to the above identification results in the identification

ap λz:.z+s(0+x)(0x,0,labsorp (x)):0x+s(0+x)= 0+s(0+x)\mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(0 + x)}(0 \cdot x, 0, \mathrm{labsorp}_\mathbb{Z}(x)):0 \cdot x + s(0 + x) =_{\mathbb{Z}} 0 + s(0 + x)

The left unit law for addition results in

lunitadd (s(0+x)):0+s(0+x)= s(0+x)\mathrm{lunitadd}_\mathbb{Z}(s(0 + x)):0 + s(0 + x) =_{\mathbb{Z}} s(0 + x)

and application of the successor equivalence to the left unit law results in

ap s(0+x,x,runitadd (x)):s(0+x)= s(x)\mathrm{ap}_s(0 + x, x, \mathrm{runitadd}_\mathbb{Z}(x)):s(0 + x) =_{\mathbb{Z}} s(x)

Concatenating all the identifications leads to the identification

β ,s,s(0,x)ap λz:.z+s(0+x)(0x,0,labsorp (x))lunitadd (s(0+x))ap s(0+x,x,lunitadd (x)):s(0)s(x)= s(x)\beta_\mathbb{Z}^{\cdot, s, s}(0, x) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(0 + x)}(0 \cdot x, 0, \mathrm{labsorp}_\mathbb{Z}(x)) \bullet \mathrm{lunitadd}_\mathbb{Z}(s(0 + x)) \bullet \mathrm{ap}_s(0 + x, x, \mathrm{lunitadd}_\mathbb{Z}(x)):s(0) \cdot s(x) =_{\mathbb{Z}} s(x)

Similarly, by substituting s 1(x)s^{-1}(x) in for xx in the above expression, we have

β ,s,s(0,s 1(x))ap λz:.z+s(0+s 1(x))(0s 1(x),0,labsorp (s 1(x)))lunitadd (s(0+s 1(x)))ap s(0+s 1(x),s 1(x),lunitadd (s 1(x))):s(0)s(s 1(x))= s(s 1(x))\beta_\mathbb{Z}^{\cdot, s, s}(0, s^{-1}(x)) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(0 + s^{-1}(x))}(0 \cdot s^{-1}(x), 0, \mathrm{labsorp}_\mathbb{Z}(s^{-1}(x))) \bullet \mathrm{lunitadd}_\mathbb{Z}(s(0 + s^{-1}(x))) \bullet \mathrm{ap}_s(0 + s^{-1}(x), s^{-1}(x), \mathrm{lunitadd}_\mathbb{Z}(s^{-1}(x))):s(0) \cdot s(s^{-1}(x)) =_{\mathbb{Z}} s(s^{-1}(x))

In addition, we have the right inverse homotopy

rinv s: x:s(s 1(x))= x\mathrm{rinv}_s:\prod_{x:\mathbb{Z}} s(s^{-1}(x)) =_\mathbb{Z} x

so by transport across the identity rinv s(x)\mathrm{rinv}_s(x) for the type family s(0)z= xs(0) \cdot z =_\mathbb{Z} x, we also have the equivalence

transport z:.s(0)z= x(s(s 1(x)),x,rinv s(x)):s(0)(s(s 1(x))= x)(s(0)x= x)\mathrm{transport}_{z:\mathbb{Z}.s(0) \cdot z =_\mathbb{Z} x}(s(s^{-1}(x)), x, \mathrm{rinv}_s(x)):s(0) \cdot (s(s^{-1}(x)) =_{\mathbb{Z}} x) \simeq (s(0) \cdot x =_{\mathbb{Z}} x)

Thus, we have the identification

transport z:.s(0)z= x(s(s 1(x)),x,rinv s(x))(β ,s,s(0,s 1(x))ap λz:.z+s(0+s 1(x))(0s 1(x),0,labsorp (s 1(x))) lunitadd (s(0+s 1(x)))ap s(0+s 1(x),s 1(x),lunitadd (s 1(x)))rinv s(x)):s(0)x= x\begin{array}{c} \mathrm{transport}_{z:\mathbb{Z}.s(0) \cdot z =_\mathbb{Z} x}(s(s^{-1}(x)), x, \mathrm{rinv}_s(x)) (\beta_\mathbb{Z}^{\cdot, s, s}(0, s^{-1}(x)) \bullet \mathrm{ap}_{\lambda z:\mathbb{Z}.z + s(0 + s^{-1}(x))}(0 \cdot s^{-1}(x), 0, \mathrm{labsorp}_\mathbb{Z}(s^{-1}(x))) \\ \bullet \mathrm{lunitadd}_\mathbb{Z}(s(0 + s^{-1}(x))) \bullet \mathrm{ap}_s(0 + s^{-1}(x), s^{-1}(x), \mathrm{lunitadd}_\mathbb{Z}(s^{-1}(x))) \bullet \mathrm{rinv}_s(x)):s(0) \cdot x =_{\mathbb{Z}} x \end{array}

Since \mathbb{Z} is a set, the identity types s(0)x= xs(0) \cdot x =_{\mathbb{Z}} x and s(0)s(x)= s(x)s(0) \cdot s(x) =_{\mathbb{Z}} s(x) are both propositions, and since they have identifications, both types are contractible types. All contractible types are equivalent to each other; thus there is an equivalence

g(x):(s(0)x= x)(s(0)s(x)= s(x))g(x):(s(0) \cdot x =_{\mathbb{Z}} x) \simeq (s(0) \cdot s(x) =_{\mathbb{Z}} s(x))

Then, by induction on the integers, there is the homotopy

lunitmul :ind s(0)x= x(β ,s,0(0)β ,0,0,λx:.g(x)): x:s(0)x= x\mathrm{lunitmul}_\mathbb{Z}:\mathrm{ind}_{\mathbb{Z}}^{s(0) \cdot x =_{\mathbb{Z}} x}(\beta_\mathbb{Z}^{\cdot, s, 0}(0) \bullet \beta_\mathbb{Z}^{\cdot, 0, 0}, \lambda x:\mathbb{Z}.g(x)):\prod_{x:\mathbb{Z}} s(0) \cdot x =_{\mathbb{Z}} x

Thus, \mathbb{Z} is a unital magma with respect to one 1s(0):1 \equiv s(0):\mathbb{Z} and multiplication x:,y:xy:x:\mathbb{Z}, y:\mathbb{Z} \vdash x \cdot y:\mathbb{Z}.

Theorem

Multiplication on the integers is associative.

Proof

….

Theorem

Multiplication on the integers is commutative.

Proof

….

Corollary

The integers are a commutative ring.

Exponentiation on the integers

Definition

The binary operation exponentiation is defined by induction on the natural numbers

Introduction rules for exponentiation:

ΓctxΓ,n:,x:,x n:\frac{\Gamma \; \mathrm{ctx}}{\Gamma, n:\mathbb{N}, x:\mathbb{Z}, \vdash x^n:\mathbb{Z}}

Computation rules for exponentiation:

ΓctxΓ,x:,β x (),0(x):x 0= 1\frac{\Gamma \; \mathrm{ctx}}{\Gamma, x:\mathbb{Z}, \vdash \beta_\mathbb{Z}^{x^{(-)}, 0}(x):x^0 =_\mathbb{Z} 1}
ΓctxΓ,n:,x:,β x (),s:x s(n)= x nx\frac{\Gamma \; \mathrm{ctx}}{\Gamma, n:\mathbb{N}, x:\mathbb{Z}, \vdash \beta_\mathbb{Z}^{x^{(-)}, s}:x^{s(n)} =_\mathbb{Z} x^n \cdot x}
Definition

The inclusion of the natural numbers in the integers is inductively defined by induction on the natural numbers

Introduction rules for natural number inclusion:

ΓctxΓ,n:i(n):\frac{\Gamma \; \mathrm{ctx}}{\Gamma, n:\mathbb{N} \vdash i(n):\mathbb{Z}}

Computation rules for natural number inclusion:

ΓctxΓβ i,0:i(0)= 0\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash \beta_\mathbb{Z}^{i, 0}:i(0) =_\mathbb{Z} 0}
ΓctxΓ,n:β i,s(n):i(s(n))= s(i(n))\frac{\Gamma \; \mathrm{ctx}}{\Gamma, n:\mathbb{N} \vdash \beta_\mathbb{Z}^{i, s}(n):i(s(n)) =_\mathbb{Z} s(i(n))}

Decidability of equality

Perhaps it is time to prove that equality is decidable on the integers.

Definition

The observational equality relation is defined by double induction on the integers

Formation rules for observational equality:

ΓctxΓ,x:,y:Eq (x,y)type\frac{\Gamma \; \mathrm{ctx}}{\Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash \mathrm{Eq}_\mathbb{Z}(x, y) \; \mathrm{type}}

Definition rules for observational equality:

ΓctxΓβ Eq ,0,0:Eq (0,0)𝟙\frac{\Gamma \; \mathrm{ctx}}{\Gamma \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, 0, 0}:\mathrm{Eq}_\mathbb{Z}(0, 0) \simeq \mathbb{1}}
ΓctxΓ,x:β Eq ,0,s:Eq (0,s(x))Eq (s 1(0),x)\frac{\Gamma \; \mathrm{ctx}}{\Gamma, x:\mathbb{Z} \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, 0, s}:\mathrm{Eq}_\mathbb{Z}(0, s(x)) \simeq \mathrm{Eq}_\mathbb{Z}(s^{-1}(0), x)}
ΓctxΓ,x:β Eq ,0,s:Eq (s(x),0)Eq (x,s 1(0))\frac{\Gamma \; \mathrm{ctx}}{\Gamma, x:\mathbb{Z} \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, 0, s}:\mathrm{Eq}_\mathbb{Z}(s(x), 0) \simeq \mathrm{Eq}_\mathbb{Z}(x, s^{-1}(0))}
ΓctxΓ,x:,y:β Eq ,s,s:Eq (s(x),s(y))Eq (x,y)\frac{\Gamma \; \mathrm{ctx}}{\Gamma, x:\mathbb{Z}, y:\mathbb{Z} \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, s, s}:\mathrm{Eq}_\mathbb{Z}(s(x), s(y)) \simeq \mathrm{Eq}_\mathbb{Z}(x, y)}

The following rules only hold if the universe has a univalent universe:

ΓctxΓ,N:β Eq ,s,0:Eq (0,i(n)+1)𝟘\frac{\Gamma \; \mathrm{ctx}}{\Gamma, N:\mathbb{N} \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, s, 0}:\mathrm{Eq}_\mathbb{Z}(0, i(n) + 1) \simeq \mathbb{0}}
ΓctxΓ,N:β Eq ,0,s:Eq (i(n)+1,0)𝟘\frac{\Gamma \; \mathrm{ctx}}{\Gamma, N:\mathbb{N} \vdash \beta_\mathbb{Z}^{\mathrm{Eq}_\mathbb{Z}, 0, s}:\mathrm{Eq}_\mathbb{Z}(i(n) + 1, 0) \simeq \mathbb{0}}

Order structure on the integers

Given a type family x:AB(x)x:A \vdash B(x), we define the existential quantifier x:A.B(x)\exists x:A.B(x) as the propositional truncation of the dependent sum type [ x:AB(x)]\left[\sum_{x:A} B(x)\right]. Given two types AA and BB, we define the disjunction ABA \vee B as the propositional truncation of the sum type [A+B]\left[A + B\right].

Definition

The predicate is less than, denoted as x<yx \lt y, is defined as

x<yn:.x+i(n)+1= yx \lt y \coloneqq \exists n:\mathbb{N}.x + i(n) + 1 =_\mathbb{N} y

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The predicate is greater than, denoted as x>yx \gt y, is defined as

x>yn:.x= y+i(n)+1x \gt y \coloneqq \exists n:\mathbb{N}.x =_\mathbb{N} y + i(n) + 1

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The predicate is apart from, denoted as x#yx # y, is defined as

x#y(x<y)(x>y)x # y \coloneqq (x \lt y) \vee (x \gt y)

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The predicate is less than or equal to, denoted as xyx \leq y, is defined as

xyn:.x+i(n)= yx \leq y \coloneqq \exists n:\mathbb{N}.x + i(n) =_\mathbb{N} y

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The predicate is greater than or equal to, denoted as xyx \geq y, is defined as

xyn:.x= y+i(n)x \geq y \coloneqq \exists n:\mathbb{N}.x =_\mathbb{N} y + i(n)

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The predicate is positive, denoted as isPositive(x)\mathrm{isPositive}(x), is defined as

isPositive(x)n:.i(n)+1= x\mathrm{isPositive}(x) \coloneqq \exists n:\mathbb{N}.i(n) + 1 =_\mathbb{N} x

for x:x:\mathbb{Z}.

Definition

The predicate is negative, denoted as isNegative(x)\mathrm{isNegative}(x), is defined as

isNegative(x)n:.x+i(n)+1= 0\mathrm{isNegative}(x) \coloneqq \exists n:\mathbb{N}.x + i(n) + 1 =_\mathbb{N} 0

for x:x:\mathbb{Z}.

Definition

The predicate is zero, denoted as isZero(x)\mathrm{isZero}(x), is defined as

isZero(x)x= 0\mathrm{isZero}(x) \coloneqq x =_\mathbb{Z} 0

for x:x:\mathbb{Z}.

Definition

The predicate is non-positive, denoted as isNonPositive(x)\mathrm{isNonPositive}(x), is defined as

isNonPositive(x)n:.0= x+i(n)\mathrm{isNonPositive}(x) \coloneqq \exists n:\mathbb{N}.0 =_\mathbb{N} x + i(n)

for x:x:\mathbb{Z}.

Definition

The predicate is non-negative, denoted as isNonNegative(x)\mathrm{isNonNegative}(x), is defined as

isNonNegative(x)n:.x= i(n)\mathrm{isNonNegative}(x) \coloneqq \exists n:\mathbb{N}.x =_\mathbb{N} i(n)

for x:x:\mathbb{Z}.

Definition

The predicate is non-zero, denoted as isNonZero(x)\mathrm{isNonZero}(x), is defined as

isNonZero(x)isPositive(x)isNegative(x)\mathrm{isNonZero}(x) \coloneqq \mathrm{isPositive}(x) \vee \mathrm{isNegative}(x)

for x:x:\mathbb{Z}.

Pseudolattice and metric structure on the integers

Definition

The ramp function ramp:\mathrm{ramp}:\mathbb{Z} \to \mathbb{Z} is defined as

ramp(i(n))i(n)\mathrm{ramp}(i(n)) \coloneqq i(n)
ramp((i(n)+1))0\mathrm{ramp}(-(i(n) + 1)) \coloneqq 0

for n:n:\mathbb{N}.

Definition

The minimum min:×\min:\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z} is defined as

min(x,y)xramp(xy)\min(x,y) \coloneqq x - \mathrm{ramp}(x - y)

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The maximum max:×\max:\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z} is defined as

max(x,y)x+ramp(yx)\max(x,y) \coloneqq x + \mathrm{ramp}(y - x)

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The metric ρ:×\rho:\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z} is defined as

ρ(x,y)max(x,y)min(x,y)\rho(x,y) \coloneqq \max(x,y) - \min(x,y)

for x:x:\mathbb{Z}, y:y:\mathbb{Z}.

Definition

The absolute value |()|:\vert(-)\vert:\mathbb{Z} \to \mathbb{Z} is defined as

|x|max(x,x)\vert x \vert \coloneqq \max(x, -x)

for x:x:\mathbb{Z}.

Division and remainder

Definition

Integer division ()÷():× 0(-)\div(-):\mathbb{Z} \times \mathbb{Z}_{\neq 0} \to \mathbb{Z} is defined as

i(n)÷i(m)i(n÷m)i(n) \div i(m) \coloneqq i(n \div m)
i(n)÷i(m)i(n÷m)i(n) \div -i(m) \coloneqq -i(n \div m)
i(n)÷i(m)i(n÷m)-i(n) \div i(m) \coloneqq -i(n \div m)
i(n)÷i(m)i(n÷m)-i(n) \div -i(m) \coloneqq i(n \div m)

for n:n:\mathbb{N}, m: 0m:\mathbb{N}_{\neq 0}.

Categorical semantics

The categorical semantics of the integers type is the integers object.

See also

References

For definitions as a higher inductive type in homotopy type theory, see:

A few more definitions of the integers, as well as the statement of the dependent universal property of the integers, could be found in:

Some terms about specific kinds of H-spaces used to prove properties of the integers are defined in:

A formalization in terms of homotopy type theory, using a unary notation, is in

(A different common formalization of integers in type theory is in a binary notation, as in the Coq standard library. Binary notation is exponentially more efficient for performing computations, but the unary notation was convenient for calculating π 1(S 1)\pi_1(S^1).)

That one can construct the natural numbers type from the integers type can be found in:

Last revised on February 1, 2024 at 19:09:28. See the history of this page for a list of all contributions to it.