Instances For
Exercise 4.2.1
Equations
- Section_4_2.PreRat.instSetoid = { r := fun (a b : Section_4_2.PreRat) => a.numerator * b.denominator = b.numerator * a.denominator, iseqv := ⋯ }
Instances For
We give division a "junk" value of 0//1 if the denominator is zero
Equations
Instances For
Equations
- Section_4_2.«term_//_» = Lean.ParserDescr.trailingNode `Section_4_2.«term_//_» 100 101 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " // ") (Lean.ParserDescr.cat `term 101))
Instances For
Decidability of equality. Hint: modify the proof of DecidableEq Int from the previous
section. However, because formal division handles the case of zero denominator separately, it
may be more convenient to avoid that operation and work directly with the Quotient API.
Equations
- Section_4_2.Rat.decidableEq = sorry
Lemma 4.2.3 (Addition well-defined)
Equations
- One or more equations did not get rendered due to their size.
Lemma 4.2.3 (Multiplication well-defined)
Equations
- One or more equations did not get rendered due to their size.
Lemma 4.2.3 (Negation well-defined)
Equations
- One or more equations did not get rendered due to their size.
Embedding the integers in the rationals
Equations
- Section_4_2.Rat.instOfNat = { ofNat := ↑n // 1 }
Whereas the book leaves the inverse of 0 undefined, it is more convenient in Lean to assign a "junk" value to this inverse; we arbitrarily choose this junk value to be 0.
Equations
- One or more equations did not get rendered due to their size.
Proposition 4.2.4 (laws of algebra) / Exercise 4.2.3
Proposition 4.2.4 (laws of algebra) / Exercise 4.2.3
Equations
- Section_4_2.Rat.instAddCommGroup = { toAddGroup := Section_4_2.Rat.addGroup_inst, add_comm := ⋯ }
Proposition 4.2.4 (laws of algebra) / Exercise 4.2.3
Equations
- One or more equations did not get rendered due to their size.
Proposition 4.2.4 (laws of algebra) / Exercise 4.2.3
Equations
- One or more equations did not get rendered due to their size.
Default definition of division
Equations
- One or more equations did not get rendered due to their size.
Proposition 4.2.4 (laws of algebra) / Exercise 4.2.3
Equations
- One or more equations did not get rendered due to their size.
Equations
- Section_4_2.Rat.coe_int_hom = { toFun := fun (n : ℤ) => ↑n, map_one' := Section_4_2.Rat.coe_int_hom._proof_1, map_mul' := ⋯, map_zero' := Section_4_2.Rat.coe_int_hom._proof_2, map_add' := ⋯ }
Instances For
Definition 4.2.8 (Ordering of the rationals)
Equations
- Section_4_2.Rat.instLT = { lt := fun (x y : Section_4_2.Rat) => (x - y).isNeg }
Definition 4.2.8 (Ordering of the rationals)
Equations
- Section_4_2.Rat.instLE = { le := fun (x y : Section_4_2.Rat) => x < y ∨ x = y }
(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) Rat has the structure of a linear ordering.
Equations
- One or more equations did not get rendered due to their size.
(Not from textbook) Rat has the structure of a strict ordered ring.
Not in textbook: create an equivalence between Rat and ℚ. This requires some familiarity with the API for Mathlib's version of the rationals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Not in textbook: equivalence preserves order
Equations
- Section_4_2.Rat.equivRat_order = { toEquiv := Section_4_2.Rat.equivRat, map_rel_iff' := ⋯ }
Instances For
Not in textbook: equivalence preserves ring operations
Equations
- Section_4_2.Rat.equivRat_ring = { toEquiv := Section_4_2.Rat.equivRat, map_mul' := ⋯, map_add' := ⋯ }
Instances For
(Not from textbook) The textbook rationals are isomorphic (as a field) to the Mathlib rationals.