Analysis I, Chapter 2 epilogue: Isomorphism with the Mathlib natural numbers #
In this (technical) epilogue, we show that the "Chapter 2" natural numbers Chapter2.Nat are
isomorphic in various senses to the standard natural numbers ℕ.
After this epilogue, Chapter2.Nat will be deprecated, and we will instead use the standard
natural numbers ℕ throughout. In particular, one should use the full Mathlib API for ℕ for
all subsequent chapters, in lieu of the Chapter2.Nat API.
Filling the sorries here requires both the Chapter2.Nat API and the Mathlib API for the standard
natural numbers ℕ. As such, they are excellent exercises to prepare you for the aforementioned
transition.
In second half of this section we also give a fully axiomatic treatment of the natural numbers
via the Peano axioms. The treatment in the preceding three sections was only partially axiomatic,
because we used a specific construction Chapter2.Nat of the natural numbers that was an inductive
type, and used that inductive type to construct a recursor. Here, we give some exercises to show
how one can accomplish the same tasks directly from the Peano axioms, without knowing the specific
implementation of the natural numbers.
Tips from past users #
Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.
- (Add tip here)
The conversion is a bijection. Here we use the existing capability (from Section 2.1) to map the Mathlib natural numbers to the Chapter 2 natural numbers.
Equations
- Chapter2.Nat.equivNat = { toFun := Chapter2.Nat.toNat, invFun := fun (n : ℕ) => ↑n, left_inv := Chapter2.Nat.equivNat._proof_1, right_inv := Chapter2.Nat.equivNat._proof_2 }
Instances For
Equations
- Chapter2.Nat.equivNat_ordered_ring = { toEquiv := Chapter2.Nat.equivNat, map_mul' := Chapter2.Nat.map_mul, map_add' := Chapter2.Nat.map_add, map_le_map_iff' := ⋯ }
Instances For
The Peano axioms for an abstract type Nat
Instances For
The Chapter 2 natural numbers obey the Peano axioms.
Equations
- PeanoAxioms.Chapter2_Nat = { Nat := Chapter2.Nat, zero := Chapter2.Nat.zero, succ := Chapter2.Nat.succ, succ_ne := Chapter2.Nat.succ_ne, succ_cancel := ⋯, induction := Chapter2.Nat.induction }
Instances For
The Mathlib natural numbers obey the Peano axioms.
Equations
- PeanoAxioms.Mathlib_Nat = { Nat := ℕ, zero := 0, succ := Nat.succ, succ_ne := Nat.succ_ne_zero, succ_cancel := @PeanoAxioms.Mathlib_Nat._proof_1, induction := ⋯ }
Instances For
One can start the proof here with unfold Function.Injective, although it is not strictly necessary.
One can start the proof here with unfold Function.Surjective, although it is not strictly necessary.
This exercise will require application of Mathlib's API for the Equiv class.
Some of this API can be invoked automatically via the simp tactic.
Instances For
This exercise will require application of Mathlib's API for the Equiv class.
Some of this API can be invoked automatically via the simp tactic.
Equations
- equiv1.trans equiv2 = { equiv := PeanoAxioms.Equiv.equiv.trans PeanoAxioms.Equiv.equiv, equiv_zero := ⋯, equiv_succ := ⋯ }
Instances For
Useful Mathlib tools for inverting bijections include Function.surjInv and Function.invFun.
Equations
Instances For
The task here is to establish that any two structures obeying the Peano axioms are equivalent.
Equations
- PeanoAxioms.Equiv.mk' P Q = sorry
Instances For
There is only one equivalence between any two structures obeying the Peano axioms.