Analysis I, Section 4.1: The integers #
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 the "Section 4.1" integers,
Section_4_1.Int, as formal differencesa —— bof natural numbersa b:ℕ, up to equivalence. (This is a quotient of a scaffolding typeSection_4_1.PreInt, which consists of formal differences without any equivalence imposed.)ring operations and order these integers, as well as an embedding of ℕ.
Equivalence with the Mathlib integers
_root_.Int(orℤ), which we will use going forward.
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)
Definition 4.1.1
Equations
- Section_4_1.PreInt.instSetoid = { r := fun (a b : Section_4_1.PreInt) => a.minuend + b.subtrahend = b.minuend + a.subtrahend, iseqv := Section_4_1.PreInt.instSetoid._proof_1 }
Instances For
Equations
- Section_4_1.«term_——_» = Lean.ParserDescr.trailingNode `Section_4_1.«term_——_» 100 101 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " —— ") (Lean.ParserDescr.cat `term 101))
Instances For
Decidability of equality
Equations
- One or more equations did not get rendered due to their size.
Lemma 4.1.3 (Addition well-defined)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Section_4_1.Int.instOfNat = { ofNat := n —— 0 }
Definition 4.1.4 (Negation of integers) / Exercise 4.1.2
Equations
- One or more equations did not get rendered due to their size.
Proposition 4.1.6 (laws of algebra) / Exercise 4.1.4
Proposition 4.1.6 (laws of algebra) / Exercise 4.1.4
Equations
- Section_4_1.Int.instAddCommGroup = { toAddGroup := Section_4_1.Int.instAddGroup, add_comm := Section_4_1.Int.instAddCommGroup._proof_1 }
Proposition 4.1.6 (laws of algebra) / Exercise 4.1.4
Equations
- One or more equations did not get rendered due to their size.
Proposition 4.1.6 (laws of algebra) / Exercise 4.1.4
Equations
- One or more equations did not get rendered due to their size.
Definition 4.1.10 (Ordering of the integers)
Equations
- Section_4_1.Int.instLE = { le := fun (n m : Section_4_1.Int) => ∃ (a : ℕ), m = n + ↑a }
Definition 4.1.10 (Ordering of the integers)
Equations
- Section_4_1.Int.instLT = { lt := fun (n m : Section_4_1.Int) => n ≤ m ∧ n ≠ m }
(Not from textbook) Establish the decidability of this order.
Equations
- One or more equations did not get rendered due to their size.
(Not from textbook) Int has the structure of a linear ordering.
Equations
- One or more equations did not get rendered due to their size.
Exercise 4.1.9. The square of any integer is nonnegative.
Not in textbook: create an equivalence between Int and ℤ. This requires some familiarity with the API for Mathlib's version of the integers.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Not in textbook: equivalence preserves order and ring operations
Equations
- One or more equations did not get rendered due to their size.