Analysis I, Section 4.1 #
This file is a translation of Section 4.1 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 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.)addition, multiplication, and negation of these integers, as well as an embedding of ℕ
Equivalence with the Mathlib integers
_root_.Int(orℤ), which we will use going forward.
Exercise 4.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
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.ofnat_inst = { 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
- 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.LE_inst = { 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.LT_inst = { lt := fun (n m : Section_4_1.Int) => (∃ (a : ℕ), m = n + ↑a) ∧ n ≠ m }
(Not from textbook) The order is decidable. This exercise is only recommended for Lean experts.
Equations
(Not from textbook) Int has the structure of a linear ordering.
Equations
- One or more equations did not get rendered due to their size.
Not in textbook: create an equivalence between Int and ℤ. This requires some familiarity with the API for Mathlib's version of the integers.
Equations
- Section_4_1.Int.equivInt = { toFun := sorry, invFun := sorry, left_inv := Section_4_1.Int.equivInt._proof_39, right_inv := Section_4_1.Int.equivInt._proof_40 }
Instances For
Not in textbook: equivalence preserves order
Equations
- Section_4_1.Int.equivInt_order = { toEquiv := Section_4_1.Int.equivInt, map_rel_iff' := @Section_4_1.Int.equivInt_order._proof_41 }
Instances For
Not in textbook: equivalence preserves ring operations
Equations
- Section_4_1.Int.equivInt_ring = { toEquiv := Section_4_1.Int.equivInt, map_mul' := Section_4_1.Int.equivInt_ring._proof_42, map_add' := Section_4_1.Int.equivInt_ring._proof_43 }