Documentation

Analysis.Section_4_2

Аналіз I, Глава 4.2 #

This file is a translation of Section 4.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:

Instances For
    @[simp]
    theorem Section_4_2.PreRat.eq (a b c d : ) (hb : b 0) (hd : d 0) :
    { numerator := a, denominator := b, nonzero := hb } { numerator := c, denominator := d, nonzero := hd } a * d = c * b
    @[reducible, inline]
    Equations
    Instances For
      @[reducible, inline]

      We give division a "junk" value of 0//1 if the denominator is zero

      Equations
      Instances For
        theorem Section_4_2.Rat.eq (a c : ) {b d : } (hb : b 0) (hd : d 0) :
        a // b = c // d a * d = c * b

        Визначення 4.2.1 (Rationals)

        theorem Section_4_2.Rat.eq_diff (n : Rat) :
        ∃ (a : ) (b : ), b 0 n = a // b

        Визначення 4.2.1 (Rationals)

        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

        Лема 4.2.3 (Addition well-defined)

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Section_4_2.Rat.add_eq (a c : ) {b d : } (hb : b 0) (hd : d 0) :
        a // b + c // d = (a * d + b * c) // (b * d)

        Визначення 4.2.2 (Addition of rationals)

        Лема 4.2.3 (Multiplication well-defined)

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Section_4_2.Rat.mul_eq (a c : ) {b d : } (hb : b 0) (hd : d 0) :
        a // b * c // d = (a * c) // (b * d)

        Визначення 4.2.2 (Multiplication of rationals)

        Лема 4.2.3 (Negation well-defined)

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Section_4_2.Rat.neg_eq {b : } (a : ) (hb : b 0) :
        -a // b = (-a) // b

        Визначення 4.2.2 (Negation of rationals)

        Embedding the integers in the rationals

        Equations
        Equations
        Equations
        theorem Section_4_2.Rat.coe_Int_eq (a : ) :
        a = a // 1
        theorem Section_4_2.Rat.coe_Nat_eq (n : ) :
        n = n // 1
        theorem Section_4_2.Rat.add_of_int (a b : ) :
        a + b = ↑(a + b)
        theorem Section_4_2.Rat.mul_of_int (a b : ) :
        a * b = ↑(a * b)
        theorem Section_4_2.Rat.neg_of_int (a : ) :
        -a = ↑(-a)

        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.
        theorem Section_4_2.Rat.inv_eq {b : } (a : ) (hb : b 0) :
        (a // b)⁻¹ = b // a

        Твердження 4.2.4 (laws of algebra) / Вправа 4.2.3

        Equations

        Твердження 4.2.4 (laws of algebra) / Вправа 4.2.3

        Equations
        • One or more equations did not get rendered due to their size.

        Твердження 4.2.4 (laws of algebra) / Вправа 4.2.3

        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        theorem Section_4_2.Rat.coe_Rat_eq (a : ) {b : } (hb : b 0) :
        ↑(a / b) = a // b

        Default definition of division

        Equations
        • One or more equations did not get rendered due to their size.
        theorem Section_4_2.Rat.div_eq (q r : Rat) :
        q / r = q * r⁻¹

        Твердження 4.2.4 (laws of algebra) / Вправа 4.2.3

        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.
        Instances For

          (Не із книги) The textbook rationals are isomorphic (as a field) to the Mathlib rationals.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Визначення 4.2.6 (positivity)

            Equations
            Instances For

              Визначення 4.2.6 (negativity)

              Equations
              Instances For

                Лема 4.2.7 (trichotomy of rationals) / Вправа 4.2.4

                Лема 4.2.7 (trichotomy of rationals) / Вправа 4.2.4

                Лема 4.2.7 (trichotomy of rationals) / Вправа 4.2.4

                Лема 4.2.7 (trichotomy of rationals) / Вправа 4.2.4

                Визначення 4.2.8 (Ordering of the rationals)

                Equations

                Визначення 4.2.8 (Ordering of the rationals)

                Equations
                theorem Section_4_2.Rat.lt_iff (x y : Rat) :
                x < y (x - y).isNeg
                theorem Section_4_2.Rat.le_iff (x y : Rat) :
                x y x < y x = y
                theorem Section_4_2.Rat.gt_iff (x y : Rat) :
                x > y (x - y).isPos
                theorem Section_4_2.Rat.ge_iff (x y : Rat) :
                x y x > y x = y
                theorem Section_4_2.Rat.trichotomous' (x y z : Rat) :
                x > y x < y x = y

                Твердження 4.2.9(a) (order trichotomy) / Вправа 4.2.5

                theorem Section_4_2.Rat.not_gt_and_lt (x y : Rat) :
                ¬(x > y x < y)

                Твердження 4.2.9(a) (order trichotomy) / Вправа 4.2.5

                theorem Section_4_2.Rat.not_gt_and_eq (x y : Rat) :
                ¬(x > y x = y)

                Твердження 4.2.9(a) (order trichotomy) / Вправа 4.2.5

                theorem Section_4_2.Rat.not_lt_and_eq (x y : Rat) :
                ¬(x < y x = y)

                Твердження 4.2.9(a) (order trichotomy) / Вправа 4.2.5

                theorem Section_4_2.Rat.antisymm (x y : Rat) :
                x < y (y - x).isPos

                Твердження 4.2.9(b) (order is anti-symmetric) / Вправа 4.2.5

                theorem Section_4_2.Rat.lt_trans {x y z : Rat} (hxy : x < y) (hyz : y < z) :
                x < z

                Твердження 4.2.9(c) (order is transitive) / Вправа 4.2.5

                theorem Section_4_2.Rat.add_lt_add_right {x y : Rat} (z : Rat) (hxy : x < y) :
                x + z < y + z

                Твердження 4.2.9(d) (addition preserves order) / Вправа 4.2.5

                theorem Section_4_2.Rat.mul_lt_mul_right {x y z : Rat} (hxy : x < y) (hz : z.isPos) :
                x * z < y * z

                Твердження 4.2.9(e) (positive multiplication preserves order) / Вправа 4.2.5

                instance Section_4_2.Rat.decidableRel :
                DecidableRel fun (x1 x2 : Rat) => x1 x2

                (Не із книги) Establish the decidability of this order.

                Equations
                • One or more equations did not get rendered due to their size.

                (Не із книги) Rat has the structure of a linear ordering.

                Equations
                • One or more equations did not get rendered due to their size.

                (Не із книги) Rat has the structure of a strict ordered ring.

                theorem Section_4_2.Rat.mul_lt_mul_right_of_neg (x y z : Rat) (hxy : x < y) (hz : z.isNeg) :
                x * z > y * z

                Вправа 4.2.6

                @[reducible, inline]

                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
                  @[reducible, inline]

                  Not in textbook: equivalence preserves order

                  Equations
                  Instances For
                    @[reducible, inline]

                    Not in textbook: equivalence preserves ring operations

                    Equations
                    Instances For