Documentation

Numbers.reals

The reals #

We construct the real numbers as the quotient of the type of Cauchy sequences of rationals by the equivalence relation identifying two sequences whose difference tends to 0.

Cauchy sequences #

@[reducible, inline]
abbrev IsCauchy (x : MyNatMyRat) :
Equations
Instances For
    theorem IsCauchy.bounded {x : MyNatMyRat} (hx : IsCauchy x) :
    ∃ (B : MyRat), 0 < B ∀ (n : MyNat), |x n| B
    @[reducible, inline]
    abbrev MyPrereal :
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      theorem MyPrereal.prop (x : MyPrereal) (ε : MyRat) :
      0 < ε∃ (N : MyNat), ∀ (p q : MyNat), N pN q|x p - x q| ε
      @[simp]
      theorem MyPrereal.coe_apply {x : MyNatMyRat} (hx : IsCauchy x) (n : MyNat) :
      x, hx n = x n
      theorem MyPrereal.bounded (x : MyPrereal) :
      ∃ (B : MyRat), 0 < B ∀ (n : MyNat), |x n| B

      The equivalence relation on the pre-reals #

      Equations
      Instances For
        theorem MyPrereal.R_def (x y : MyPrereal) :
        x.R y ∀ (ε : MyRat), 0 < ε∃ (N : MyNat), ∀ (n : MyNat), N n|x n - y n| ε
        theorem MyPrereal.R_symm {x y : MyPrereal} :
        x.R yy.R x
        theorem MyPrereal.R_trans {x y z : MyPrereal} :
        x.R yy.R zx.R z
        @[simp]
        theorem MyPrereal.equiv_def (x y : MyPrereal) :
        x y ∀ (ε : MyRat), 0 < ε∃ (N : MyNat), ∀ (n : MyNat), N n|x n - y n| ε
        @[simp]
        theorem MyPrereal.equiv_def' (x y : MyPrereal) :
        R_equiv x y ∀ (ε : MyRat), 0 < ε∃ (N : MyNat), ∀ (n : MyNat), N n|x n - y n| ε

        The algebraic structure on the pre-reals #

        theorem MyPrereal.IsCauchy.const (x : MyRat) :
        IsCauchy fun (x_1 : MyNat) => x
        @[implicit_reducible]
        Equations
        @[simp]
        theorem MyPrereal.zero_def (n : MyNat) :
        0 n = 0
        @[implicit_reducible]
        Equations
        @[simp]
        theorem MyPrereal.one_def (n : MyNat) :
        1 n = 1
        @[implicit_reducible]
        Equations
        @[simp]
        theorem MyPrereal.neg_def (x : MyPrereal) (n : MyNat) :
        (-x) n = -x n
        theorem MyPrereal.neg_quotient x x' : MyPrereal (h : x x') :
        -x -x'
        theorem MyPrereal.IsCauchy.add {x y : MyNatMyRat} (hx : IsCauchy x) (hy : IsCauchy y) :
        IsCauchy (x + y)
        @[implicit_reducible]
        Equations
        @[implicit_reducible]
        Equations
        @[simp]
        theorem MyPrereal.add_def (x y : MyPrereal) (n : MyNat) :
        (x + y) n = x n + y n
        @[simp]
        theorem MyPrereal.sub_def (x y : MyPrereal) (n : MyNat) :
        (x - y) n = x n - y n
        theorem MyPrereal.add_quotient x x' : MyPrereal (h : x x') y y' : MyPrereal (h' : y y') :
        x + y x' + y'
        theorem MyPrereal.IsCauchy.mul {x y : MyNatMyRat} (hx : IsCauchy x) (hy : IsCauchy y) :
        IsCauchy (x * y)
        @[implicit_reducible]
        Equations
        @[simp]
        theorem MyPrereal.mul_def (x y : MyPrereal) (n : MyNat) :
        (x * y) n = x n * y n
        theorem MyPrereal.mul_quotient x x' : MyPrereal (h : x x') y y' : MyPrereal (h' : y y') :
        x * y x' * y'
        theorem MyPrereal.pos_of_not_equiv_zero {x : MyPrereal} (H : ¬x 0) :
        ∃ (δ : MyRat), 0 < δ ∃ (N : MyNat), ∀ (n : MyNat), N nδ < |x n|
        noncomputable def MyPrereal.inv (x : MyPrereal) :
        Equations
        Instances For
          @[simp]
          theorem MyPrereal.inv_def {x : MyPrereal} (H : ¬x 0) (n : MyNat) :
          x.inv n = (x n)⁻¹
          @[simp]
          theorem MyPrereal.inv_def' {x : MyPrereal} (H : ¬x 0) (n : MyNat) :
          (⇑x)⁻¹, n = (x n)⁻¹
          theorem MyPrereal.inv_quotient x x' : MyPrereal (h : x x') :
          x.inv x'.inv

          The reals: definition and algebraic structure #

          @[reducible, inline]
          abbrev MyReal :
          Equations
          Instances For
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            noncomputable instance MyReal.instInv :
            Equations
            @[implicit_reducible]
            Equations
            • One or more equations did not get rendered due to their size.
            theorem MyReal.mul_inv_cancel (x : MyReal) (hx : x 0) :
            x * x⁻¹ = 1
            @[implicit_reducible]
            noncomputable instance MyReal.field :
            Equations
            • One or more equations did not get rendered due to their size.

            The map from the rationals to the reals #

            def MyReal.k (x : MyRat) :

            The natural map from the rationals to the reals.

            Equations
            Instances For
              @[simp]
              theorem MyReal.k_zero :
              k 0 = 0
              @[simp]
              theorem MyReal.k_one :
              k 1 = 1
              @[simp]
              theorem MyReal.k_neg (x : MyRat) :
              k (-x) = -k x
              theorem MyReal.k_add (x y : MyRat) :
              k (x + y) = k x + k y
              theorem MyReal.k_sub (x y : MyRat) :
              k (x - y) = k x - k y
              theorem MyReal.k_mul (x y : MyRat) :
              k (x * y) = k x * k y
              theorem MyReal.k_inv (x : MyRat) :
              @[simp]
              theorem MyReal.k_inj {x y : MyRat} :
              k x = k y x = y

              Positivity and order #

              Equations
              Instances For
                theorem MyPrereal.pos_of_isPos {x : MyPrereal} (hx : x.IsPos) :
                ∃ (N : MyNat), ∀ (n : MyNat), N n0 < x n
                @[simp]
                theorem MyPrereal.isPos_quotient x x' : MyPrereal (h : x x') (hx : x.IsPos) :
                theorem MyPrereal.IsPos.add {x y : MyPrereal} (hx : x.IsPos) (hy : y.IsPos) :
                (x + y).IsPos
                theorem MyPrereal.IsPos.mul {x y : MyPrereal} (hx : x.IsPos) (hy : y.IsPos) :
                (x * y).IsPos
                Equations
                Instances For
                  theorem MyPrereal.IsNonneg_of_nonneg {x : MyPrereal} (N : MyNat) (hx : ∀ (n : MyNat), N n0 x n) :
                  theorem MyPrereal.isNonneg_quotient x x' : MyPrereal (h : x x') (hx : x.IsNonneg) :
                  theorem MyReal.IsNonneg.add {x y : MyReal} (hx : x.IsNonneg) (hy : y.IsNonneg) :
                  (x + y).IsNonneg
                  theorem MyReal.IsNonneg.mul {x y : MyReal} (hx : x.IsNonneg) (hy : y.IsNonneg) :
                  (x * y).IsNonneg
                  def MyReal.le (x y : MyReal) :
                  Equations
                  Instances For
                    @[implicit_reducible]
                    Equations
                    theorem MyReal.le_def (x y : MyReal) :
                    x y (y - x).IsNonneg
                    theorem MyReal.le_of_eventually_le {x y : MyPrereal} (N : MyNat) (h : ∀ (n : MyNat), N nx n y n) :
                    theorem MyReal.le_refl (x : MyReal) :
                    x x
                    theorem MyReal.le_trans (x y z : MyReal) (h1 : x y) (h2 : y z) :
                    x z
                    theorem MyReal.le_antisymm (x y : MyReal) (hxy : x y) (hyx : y x) :
                    x = y
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    theorem MyReal.add_le_add_left (x y : MyReal) (h : x y) (t : MyReal) :
                    x + t y + t
                    theorem MyReal.mul_nonneg (x y : MyReal) (hx : 0 x) (hy : 0 y) :
                    0 x * y
                    theorem MyReal.k_le_iff (x y : MyRat) :
                    k x k y x y
                    theorem MyReal.k_lt_iff (x y : MyRat) :
                    k x < k y x < y
                    theorem MyReal.le_total (x y : MyReal) :
                    x y y x
                    @[implicit_reducible]
                    noncomputable instance MyReal.linearOrder :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    theorem MyReal.mul_pos (a b : MyReal) (ha : 0 < a) (hb : 0 < b) :
                    0 < a * b
                    theorem MyReal.myRat_dense_rat' (x : MyReal) {ε : MyRat} ( : 0 < ε) :
                    ∃ (r : MyRat), |x - k r| k ε
                    theorem MyReal.myRat_dense_of_pos {x : MyReal} (hx : 0 < x) :
                    ∃ (r : MyRat), 0 < r k r < x
                    theorem MyReal.myRat_dense_rat (x : MyReal) {ε : MyReal} ( : 0 < ε) :
                    ∃ (r : MyRat), |x - k r| < ε
                    @[reducible, inline]
                    abbrev MyReal.TendsTo (f : MyNatMyReal) (x : MyReal) :
                    Equations
                    Instances For
                      theorem MyReal.tendsTo_of_myRat_tendsTo {f : MyNatMyReal} {x : MyReal} (h : ∀ (ε : MyRat), 0 < ε∃ (N : MyNat), ∀ (n : MyNat), N n|f n - x| k ε) :
                      @[reducible, inline]
                      Equations
                      Instances For
                        @[reducible, inline]
                        abbrev MyReal.IsCauchy (f : MyNatMyReal) :
                        Equations
                        Instances For
                          theorem MyReal.tendsTo_myRat (x : MyPrereal) :
                          TendsTo (fun (n : MyNat) => k (x n)) x

                          Completeness #

                          theorem MyReal.ex_approx_punctual (x : MyReal) (n : MyNat) :
                          ∃ (r : MyRat), |x - k r| < k (MyRat.i (n + 1))⁻¹
                          theorem MyReal.ex_approx (f : MyNatMyReal) :
                          ∃ (g : MyNatMyRat), ∀ (n : MyNat), |f n - k (g n)| < k (MyRat.i (n + 1))⁻¹
                          noncomputable def MyReal.approx (f : MyNatMyReal) :
                          Equations
                          Instances For
                            theorem MyReal.approx_spec (f : MyNatMyReal) (n : MyNat) :
                            |f n - k (approx f n)| < k (MyRat.i (n + 1))⁻¹
                            theorem MyReal.archimedean (x : MyReal) :
                            ∃ (n : MyNat), x k (MyRat.i (n + 1))
                            theorem MyReal.archimedean0 {x : MyReal} (hx : 0 < x) :
                            ∃ (n : MyNat), k (MyRat.i (n + 1))⁻¹ x
                            noncomputable def MyReal.IsCauchy.approx {f : MyNatMyReal} (hf : IsCauchy f) :
                            Equations
                            Instances For
                              theorem MyReal.IsCauchy.approx_spec {f : MyNatMyReal} (hf : IsCauchy f) (n : MyNat) :
                              |f n - k (hf.approx n)| < k (MyRat.i (n + 1))⁻¹