Analysis I, Section 2.2 #
This file is a translation of Section 2.2 of Analysis I to Lean 4. All numbering refers to the original text.
I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.
Main constructions and results of this section:
- Definition of addition and order for the "Chapter 2" natural numbers,
Chapter2.Nat - Establishment of basic properties of addition and order
Note: at the end of this chapter, the Chapter2.Nat class will be deprecated in favor of the standard Mathlib class _root_.Nat, or ℕ. However, we will develop the properties of Chapter2.Nat "by hand" for pedagogical purposes.
Definition 2.2.1. (Addition of natural numbers).
Equations
- n.add m = Chapter2.Nat.recurse (fun (x sum : Chapter2.Nat) => sum++) m n
Instances For
Equations
- Chapter2.Nat.add_inst = { add := Chapter2.Nat.add }
(Not from textbook) Nat can be given the structure of a commutative additive monoid.
Equations
- One or more equations did not get rendered due to their size.
Definition 2.2.11 (Ordering of the natural numbers)
Equations
- Chapter2.Nat.LE_inst = { le := fun (n m : Chapter2.Nat) => ∃ (a : Chapter2.Nat), m = n + a }
Definition 2.2.11 (Ordering of the natural numbers)
Equations
- Chapter2.Nat.LT_inst = { lt := fun (n m : Chapter2.Nat) => (∃ (a : Chapter2.Nat), m = n + a) ∧ n ≠ m }
Proposition 2.2.12 (Basic properties of order for natural numbers) / Exercise 2.2.3
(a) (Order is reflexive).
(Not from textbook) The order is decidable. This exercise is only recommended for Lean experts.
Equations
- Chapter2.Nat.decidableRel = sorry
(Not from textbook) Nat has the structure of a linear ordering.
Equations
- One or more equations did not get rendered due to their size.
(Not from textbook) Nat has the structure of an ordered monoid.