Documentation

Books.IntroductiontoRealAnalysisVolumeI_JiriLebl_2025.Chapters.Chap01.section01

structure OrderedSet (α : Type u) :

Definition 1.1.1: An ordered set is a set S with a relation < such that (i) (trichotomy) for all x y ∈ S, exactly one of x < y, x = y, or y < x holds, and (ii) (transitivity) if x < y and y < z then x < z. We write x ≤ y if x < y or x = y, and define >, analogously.

  • lt : ααProp
  • trichotomous (x y : α) : self.lt x y x = y self.lt y x
  • irrefl (x : α) : ¬self.lt x x
  • trans {x y z : α} : self.lt x yself.lt y zself.lt x z
Instances For
    def OrderedSet.le {α : Type u} (S : OrderedSet α) (x y : α) :

    The weak order associated to an ordered set.

    Equations
    Instances For

      The axioms of an ordered set give a strict total order in mathlib's sense.

      def OrderedSet.ofStrictTotalOrder {α : Type u} {lt : ααProp} (h : IsStrictTotalOrder α lt) :

      A strict total order in mathlib yields the ordered-set structure described in Definition 1.1.1.

      Equations
      Instances For

        Definition 1.1.2: For a subset E of an ordered set S, (i) E is bounded above if there is b with x ≤ b for all x ∈ E, and such a b is an upper bound; (ii) E is bounded below if there is b with x ≥ b for all x ∈ E, and such a b is a lower bound; (iii) an upper bound b₀ is a least upper bound (supremum) if b₀ ≤ b for all upper bounds b, written sup E = b₀; (iv) a lower bound b₀ is a greatest lower bound (infimum) if b ≤ b₀ for all lower bounds b, written inf E = b₀. A set bounded above and below is called bounded.

        def OrderedSet.IsUpperBound {α : Type u} (S : OrderedSet α) (E : Set α) (b : α) :

        An element bounding every member of E above.

        Equations
        Instances For
          def OrderedSet.IsLowerBound {α : Type u} (S : OrderedSet α) (E : Set α) (b : α) :

          An element bounding every member of E below.

          Equations
          Instances For
            def OrderedSet.BoundedAbove {α : Type u} (S : OrderedSet α) (E : Set α) :

            Existence of an upper bound for E.

            Equations
            Instances For
              def OrderedSet.BoundedBelow {α : Type u} (S : OrderedSet α) (E : Set α) :

              Existence of a lower bound for E.

              Equations
              Instances For
                def OrderedSet.IsLeastUpperBound {α : Type u} (S : OrderedSet α) (E : Set α) (b₀ : α) :

                An upper bound that is minimal among all upper bounds.

                Equations
                Instances For
                  def OrderedSet.IsGreatestLowerBound {α : Type u} (S : OrderedSet α) (E : Set α) (b₀ : α) :

                  A lower bound that is maximal among all lower bounds.

                  Equations
                  Instances For
                    def OrderedSet.Bounded {α : Type u} (S : OrderedSet α) (E : Set α) :

                    A set that is both bounded above and bounded below.

                    Equations
                    Instances For
                      noncomputable def OrderedSet.supremum {α : Type u} (S : OrderedSet α) (E : Set α) (h : ∃ (b₀ : α), S.IsLeastUpperBound E b₀) :
                      α
                      Equations
                      Instances For
                        noncomputable def OrderedSet.infimum {α : Type u} (S : OrderedSet α) (E : Set α) (h : ∃ (b₀ : α), S.IsGreatestLowerBound E b₀) :
                        α
                        Equations
                        Instances For
                          theorem OrderedSet.supremum_spec {α : Type u} (S : OrderedSet α) (E : Set α) (h : ∃ (b₀ : α), S.IsLeastUpperBound E b₀) :
                          theorem OrderedSet.infimum_spec {α : Type u} (S : OrderedSet α) (E : Set α) (h : ∃ (b₀ : α), S.IsGreatestLowerBound E b₀) :

                          Definition 1.1.3: An ordered set has the least-upper-bound property if every nonempty subset that is bounded above has a least upper bound (supremum) in the set.

                          Equations
                          Instances For
                            theorem OrderedSet.boundedAbove_iff_bddAbove {α : Type u} (S : OrderedSet α) (E : Set α) [Preorder α] (hle : ∀ (x y : α), S.le x y x y) :
                            theorem OrderedSet.boundedBelow_iff_bddBelow {α : Type u} (S : OrderedSet α) (E : Set α) [Preorder α] (hle : ∀ (x y : α), S.le x y x y) :
                            theorem OrderedSet.leastUpperBound_iff_isLUB {α : Type u} (S : OrderedSet α) (E : Set α) [Preorder α] {b₀ : α} (hle : ∀ (x y : α), S.le x y x y) :
                            S.IsLeastUpperBound E b₀ IsLUB E b₀
                            theorem OrderedSet.greatestLowerBound_iff_isGLB {α : Type u} (S : OrderedSet α) (E : Set α) [Preorder α] {b₀ : α} (hle : ∀ (x y : α), S.le x y x y) :
                            theorem OrderedSet.leastUpperBoundProperty_iff {α : Type u} (S : OrderedSet α) [Preorder α] (hle : ∀ (x y : α), S.le x y x y) :
                            S.LeastUpperBoundProperty ∀ {E : Set α}, E.NonemptyBddAbove E∃ (b₀ : α), IsLUB E b₀
                            theorem rat_sq_lt_two_has_no_sup :
                            ¬∃ (q : ), IsLUB {x : | x * x < 2} q

                            Example 1.1.4: The subset {x : ℚ | x^2 < 2} has no supremum in , so does not have the least-upper-bound property. Equivalently, there is no rational square root of 2.

                            theorem rational_sq_eq_two_absurd :
                            ¬∃ (x : ), x * x = 2

                            No rational number has square equal to 2.

                            structure FieldAxioms (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] :

                            Definition 1.1.5: A field is a set F with addition and multiplication such that (A1) if x,y ∈ F then x + y ∈ F; (A2) addition is commutative; (A3) addition is associative; (A4) there is 0 ∈ F with 0 + x = x; (A5) every x has an additive inverse -x with x + (-x) = 0; (M1) if x,y ∈ F then x * y ∈ F; (M2) multiplication is commutative; (M3) multiplication is associative; (M4) there is 1 ∈ F with 1 * x = x and 1 ≠ 0; (M5) every x ≠ 0 has a multiplicative inverse x⁻¹ with x * x⁻¹ = 1; and (D) distributivity x * (y + z) = x * y + x * z holds.

                            • add_comm (x y : F) : x + y = y + x
                            • add_assoc (x y z : F) : x + y + z = x + (y + z)
                            • zero_add (x : F) : 0 + x = x
                            • add_left_neg (x : F) : x + -x = 0
                            • mul_comm (x y : F) : x * y = y * x
                            • mul_assoc (x y z : F) : x * y * z = x * (y * z)
                            • one_mul (x : F) : 1 * x = x
                            • mul_inv_cancel {x : F} : x 0x * x⁻¹ = 1
                            • distrib (x y z : F) : x * (y + z) = x * y + x * z
                            • one_ne_zero : 1 0
                            Instances For

                              Mathlib's Field structure satisfies the axioms in Definition 1.1.5.

                              theorem FieldAxioms.add_zero (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) (x : F) :
                              x + 0 = x

                              From the field axioms we can derive the right identity for addition.

                              theorem FieldAxioms.mul_one (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) (x : F) :
                              x * 1 = x

                              From the field axioms we can derive right multiplication by 1.

                              theorem FieldAxioms.right_distrib (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) (x y z : F) :
                              (x + y) * z = x * z + y * z

                              From the field axioms we obtain right distributivity.

                              theorem FieldAxioms.mul_zero (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) (x : F) :
                              x * 0 = 0

                              From the field axioms we can show that x * 0 = 0.

                              theorem FieldAxioms.zero_mul (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) (x : F) :
                              0 * x = 0

                              From the field axioms we can show that 0 * x = 0.

                              noncomputable def field_structure_from_axioms (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) :

                              Construct a mathlib Field structure from the axioms in Definition 1.1.5.

                              Equations
                              Instances For
                                theorem field_of_field_axioms (F : Type u) [Add F] [Mul F] [Zero F] [One F] [Neg F] [Inv F] (h : FieldAxioms F) :

                                The axioms in Definition 1.1.5 recover the existence of a mathlib Field structure.

                                theorem field_iff_field_axioms (F : Type u) :
                                (∃ (inst : Field F), have x := inst; FieldAxioms F) Nonempty (Field F)

                                The book's axioms for a field are equivalent to the existence of a mathlib Field structure using the same operations.

                                Example 1.1.6: The rationals form a field, while the integers fail axiom (M5) because 2 has no multiplicative inverse; this is the only field axiom that does not hold for .

                                theorem two_mul_eq_one_int_absurd :
                                ¬∃ (x : ), 2 * x = 1

                                The multiplicative inverse required by (M5) for 2 : ℤ does not exist.

                                The usual ring structure on the integers does not extend to a field structure.

                                structure OrderedFieldAxioms (F : Type u) [Field F] [LT F] :

                                Definition 1.1.7: An ordered field is a field equipped with a strict total order such that (i) x < y implies x + z < y + z for all x y z, and (ii) 0 < x and 0 < y imply 0 < x * y. Elements with 0 < x are positive, those with x < 0 are negative, 0 < x ∨ x = 0 are nonnegative, and x < 0 ∨ x = 0 are nonpositive.

                                • order : IsStrictTotalOrder F fun (x1 x2 : F) => x1 < x2
                                • add_lt_add {x y z : F} : x < yx + z < y + z
                                • mul_pos {x y : F} : 0 < x0 < y0 < x * y
                                Instances For
                                  def isPositive (F : Type u) [Field F] [LT F] (x : F) :

                                  An element is positive if it is greater than zero.

                                  Equations
                                  Instances For
                                    def isNegative (F : Type u) [Field F] [LT F] (x : F) :

                                    An element is negative if it is less than zero.

                                    Equations
                                    Instances For
                                      def isNonnegative (F : Type u) [Field F] [LT F] (x : F) :

                                      An element is nonnegative if it is positive or zero.

                                      Equations
                                      Instances For
                                        def isNonpositive (F : Type u) [Field F] [LT F] (x : F) :

                                        An element is nonpositive if it is negative or zero.

                                        Equations
                                        Instances For

                                          Mathlib's ordered ring structure (Field together with a linear order and compatibility axioms) satisfies the ordered-field axioms in Definition 1.1.7.

                                          The book's ordered-field axioms are equivalent to the existence of a mathlib structure using the same operations.

                                          theorem orderedField_neg_of_pos_iff {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x : F} :
                                          x > 0 -x < 0

                                          Proposition 1.1.8: Let F be an ordered field and x y z w ∈ F. (i) If x > 0, then -x < 0 (and conversely). (ii) If x > 0 and y < z, then x * y < x * z. (iii) If x < 0 and y < z, then x * y > x * z. (iv) If x ≠ 0, then x^2 > 0. (v) If 0 < x < y, then 0 < 1 / y < 1 / x. (vi) If 0 < x < y, then x^2 < y^2. (vii) If x ≤ y and z ≤ w, then x + z ≤ y + w.

                                          theorem orderedField_mul_lt_mul_left_of_pos {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y z : F} (hx : 0 < x) (hyz : y < z) :
                                          x * y < x * z
                                          theorem orderedField_mul_gt_mul_left_of_neg {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y z : F} (hx : x < 0) (hyz : y < z) :
                                          x * y > x * z
                                          theorem orderedField_sq_pos_of_ne_zero {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x : F} (hx : x 0) :
                                          x ^ 2 > 0
                                          theorem orderedField_inv_bounds_of_lt {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y : F} (hx : 0 < x) (hxy : x < y) :
                                          0 < 1 / y 1 / y < 1 / x
                                          theorem orderedField_sq_lt_sq_of_pos_of_lt {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y : F} (hx : 0 < x) (hxy : x < y) :
                                          x ^ 2 < y ^ 2
                                          theorem orderedField_add_le_add {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y z w : F} (hxy : x y) (hzw : z w) :
                                          x + z y + w
                                          theorem pos_mul_same_sign {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] {x y : F} (h : x * y > 0) :
                                          0 < x 0 < y x < 0 y < 0

                                          Proposition 1.1.9: In an ordered field, if x * y > 0 then either both x and y are positive or both are negative.

                                          Example 1.1.10: The complex numbers ℂ = {x + iy | x y ∈ ℝ} satisfy I^2 = -1 and form a field. No ordering of can make it an ordered field: in every ordered field, -1 < 0 and squares of nonzero elements are positive, but (I : ℂ)^2 = -1.

                                          There is no way to equip with a linear order making it an ordered field.

                                          theorem infimum_exists_of_bddBelow {F : Type u} [Field F] [LinearOrder F] [IsStrictOrderedRing F] (lub : ∀ {E : Set F}, E.NonemptyBddAbove E∃ (b₀ : F), IsLUB E b₀) {A : Set F} (hA : A.Nonempty) (hB : BddBelow A) :
                                          ∃ (infA : F), IsGLB A infA

                                          Proposition 1.1.11: In an ordered field with the least-upper-bound property, every nonempty subset that is bounded below has an infimum.