Documentation

Mathlib.Data.Real.Basic

Real numbers from Cauchy sequences #

This file defines as the type of equivalence classes of Cauchy sequences of rational numbers. This choice is motivated by how easy it is to prove that is a commutative ring, by simply lifting everything to .

structure Real :

The type of real numbers constructed as equivalence classes of Cauchy sequences of rational numbers.

Instances For

    The type of real numbers constructed as equivalence classes of Cauchy sequences of rational numbers.

    Equations
    Instances For
      @[simp]
      theorem Real.ext_cauchy_iff {x : } {y : } :
      x = y x.cauchy = y.cauchy
      theorem Real.ext_cauchy {x : } {y : } :
      x.cauchy = y.cauchyx = y

      The real numbers are isomorphic to the quotient of Cauchy sequences on the rationals.

      Equations
      Instances For
        Equations
        noncomputable instance Real.instInvReal :
        Equations
        theorem Real.ofCauchy_zero :
        { cauchy := 0 } = 0
        theorem Real.ofCauchy_one :
        { cauchy := 1 } = 1
        theorem Real.ofCauchy_add (a : CauSeq.Completion.Cauchy abs) (b : CauSeq.Completion.Cauchy abs) :
        { cauchy := a + b } = { cauchy := a } + { cauchy := b }
        theorem Real.ofCauchy_neg (a : CauSeq.Completion.Cauchy abs) :
        { cauchy := -a } = -{ cauchy := a }
        theorem Real.ofCauchy_sub (a : CauSeq.Completion.Cauchy abs) (b : CauSeq.Completion.Cauchy abs) :
        { cauchy := a - b } = { cauchy := a } - { cauchy := b }
        theorem Real.ofCauchy_mul (a : CauSeq.Completion.Cauchy abs) (b : CauSeq.Completion.Cauchy abs) :
        { cauchy := a * b } = { cauchy := a } * { cauchy := b }
        theorem Real.ofCauchy_inv {f : CauSeq.Completion.Cauchy abs} :
        { cauchy := f⁻¹ } = { cauchy := f }⁻¹
        theorem Real.cauchy_zero :
        0.cauchy = 0
        theorem Real.cauchy_one :
        1.cauchy = 1
        theorem Real.cauchy_add (a : ) (b : ) :
        (a + b).cauchy = a.cauchy + b.cauchy
        theorem Real.cauchy_neg (a : ) :
        (-a).cauchy = -a.cauchy
        theorem Real.cauchy_mul (a : ) (b : ) :
        (a * b).cauchy = a.cauchy * b.cauchy
        theorem Real.cauchy_sub (a : ) (b : ) :
        (a - b).cauchy = a.cauchy - b.cauchy
        theorem Real.cauchy_inv (f : ) :
        f⁻¹.cauchy = f.cauchy⁻¹
        Equations
        Equations
        Equations
        theorem Real.ofCauchy_natCast (n : ) :
        { cauchy := n } = n
        theorem Real.ofCauchy_intCast (z : ) :
        { cauchy := z } = z
        theorem Real.ofCauchy_ratCast (q : ) :
        { cauchy := q } = q
        theorem Real.cauchy_natCast (n : ) :
        (n).cauchy = n
        theorem Real.cauchy_intCast (z : ) :
        (z).cauchy = z
        theorem Real.cauchy_ratCast (q : ) :
        (q).cauchy = q
        @[simp]
        theorem Real.ringEquivCauchy_apply (self : ) :
        Real.ringEquivCauchy self = self.cauchy

        Real.equivCauchy as a ring equivalence.

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

          Extra instances to short-circuit type class resolution.

          These short-circuits have an additional property of ensuring that a computable path is found; if Field is found first, then decaying it to these typeclasses would result in a noncomputable version of them.

          Equations
          Equations
          Equations
          def Real.mk (x : CauSeq abs) :

          Make a real number from a Cauchy sequence of rationals (by taking the equivalence class).

          Equations
          Instances For
            theorem Real.mk_eq {f : CauSeq abs} {g : CauSeq abs} :
            Equations
            theorem Real.lt_cauchy {f : CauSeq abs} {g : CauSeq abs} :
            { cauchy := Quotient.mk CauSeq.equiv f } < { cauchy := Quotient.mk CauSeq.equiv g } f < g
            @[simp]
            theorem Real.mk_lt {f : CauSeq abs} {g : CauSeq abs} :
            theorem Real.mk_add {f : CauSeq abs} {g : CauSeq abs} :
            theorem Real.mk_mul {f : CauSeq abs} {g : CauSeq abs} :
            theorem Real.mk_neg {f : CauSeq abs} :
            @[simp]
            theorem Real.mk_pos {f : CauSeq abs} :
            Equations
            @[simp]
            theorem Real.mk_le {f : CauSeq abs} {g : CauSeq abs} :
            theorem Real.ind_mk {C : Prop} (x : ) (h : (y : CauSeq abs) → C (Real.mk y)) :
            C x
            theorem Real.add_lt_add_iff_left {a : } {b : } (c : ) :
            c + a < c + b a < b
            theorem Real.ratCast_lt {x : } {y : } :
            x < y x < y
            theorem Real.mul_pos {a : } {b : } :
            0 < a0 < b0 < a * b
            Equations
            theorem Real.ofCauchy_sup (a : CauSeq abs) (b : CauSeq abs) :
            { cauchy := Quotient.mk CauSeq.equiv (a b) } = { cauchy := Quotient.mk CauSeq.equiv a } { cauchy := Quotient.mk CauSeq.equiv b }
            @[simp]
            theorem Real.mk_sup (a : CauSeq abs) (b : CauSeq abs) :
            theorem Real.ofCauchy_inf (a : CauSeq abs) (b : CauSeq abs) :
            { cauchy := Quotient.mk CauSeq.equiv (a b) } = { cauchy := Quotient.mk CauSeq.equiv a } { cauchy := Quotient.mk CauSeq.equiv b }
            @[simp]
            theorem Real.mk_inf (a : CauSeq abs) (b : CauSeq abs) :
            Equations
            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.
            noncomputable instance Real.field :
            Equations
            Equations
            noncomputable instance Real.decidableLT (a : ) (b : ) :
            Decidable (a < b)
            Equations
            noncomputable instance Real.decidableLE (a : ) (b : ) :
            Equations
            noncomputable instance Real.decidableEq (a : ) (b : ) :
            Decidable (a = b)
            Equations
            unsafe instance Real.instReprReal :

            Show an underlying cauchy sequence for real numbers.

            The representative chosen is the one passed in the VM to Quot.mk, so two cauchy sequences converging to the same number may be printed differently.

            Equations
            theorem Real.le_mk_of_forall_le {x : } {f : CauSeq abs} :
            (i, ∀ (j : ), j ix ↑(f j)) → x Real.mk f
            theorem Real.mk_le_of_forall_le {f : CauSeq abs} {x : } (h : i, ∀ (j : ), j i↑(f j) x) :
            theorem Real.mk_near_of_forall_near {f : CauSeq abs} {x : } {ε : } (H : i, ∀ (j : ), j i|↑(f j) - x| ε) :
            |Real.mk f - x| ε
            theorem Real.isCauSeq_iff_lift {f : } :
            IsCauSeq abs f IsCauSeq abs fun i => ↑(f i)
            theorem Real.of_near (f : ) (x : ) (h : ∀ (ε : ), ε > 0i, ∀ (j : ), j i|↑(f j) - x| < ε) :
            h', Real.mk { val := f, property := h' } = x
            theorem Real.exists_floor (x : ) :
            ub, ub x ∀ (z : ), z xz ub
            theorem Real.exists_isLUB (S : Set ) (hne : Set.Nonempty S) (hbdd : BddAbove S) :
            x, IsLUB S x
            noncomputable instance Real.instSupSetReal :
            Equations
            theorem Real.sSup_def (S : Set ) :
            sSup S = if h : Set.Nonempty S BddAbove S then Classical.choose (_ : x, IsLUB S x) else 0
            theorem Real.isLUB_sSup (S : Set ) (h₁ : Set.Nonempty S) (h₂ : BddAbove S) :
            IsLUB S (sSup S)
            noncomputable instance Real.instInfSetReal :
            Equations
            theorem Real.sInf_def (S : Set ) :
            sInf S = -sSup (-S)
            theorem Real.is_glb_sInf (S : Set ) (h₁ : Set.Nonempty S) (h₂ : BddBelow S) :
            IsGLB S (sInf S)
            Equations
            • One or more equations did not get rendered due to their size.
            theorem Real.lt_sInf_add_pos {s : Set } (h : Set.Nonempty s) {ε : } (hε : 0 < ε) :
            a, a s a < sInf s + ε
            theorem Real.add_neg_lt_sSup {s : Set } (h : Set.Nonempty s) {ε : } (hε : ε < 0) :
            a, a s sSup s + ε < a
            theorem Real.sInf_le_iff {s : Set } (h : BddBelow s) (h' : Set.Nonempty s) {a : } :
            sInf s a ∀ (ε : ), 0 < εx, x s x < a + ε
            theorem Real.le_sSup_iff {s : Set } (h : BddAbove s) (h' : Set.Nonempty s) {a : } :
            a sSup s ∀ (ε : ), ε < 0x, x s a + ε < x
            @[simp]
            theorem Real.ciSup_empty {α : Sort u_1} [IsEmpty α] (f : α) :
            ⨆ (i : α), f i = 0
            @[simp]
            theorem Real.ciSup_const_zero {α : Sort u_1} :
            ⨆ (x : α), 0 = 0
            theorem Real.iSup_of_not_bddAbove {α : Sort u_1} {f : α} (hf : ¬BddAbove (Set.range f)) :
            ⨆ (i : α), f i = 0
            theorem Real.sSup_univ :
            sSup Set.univ = 0
            @[simp]
            theorem Real.ciInf_empty {α : Sort u_1} [IsEmpty α] (f : α) :
            ⨅ (i : α), f i = 0
            @[simp]
            theorem Real.ciInf_const_zero {α : Sort u_1} :
            ⨅ (x : α), 0 = 0
            theorem Real.iInf_of_not_bddBelow {α : Sort u_1} {f : α} (hf : ¬BddBelow (Set.range f)) :
            ⨅ (i : α), f i = 0
            theorem Real.sSup_nonneg (S : Set ) (hS : ∀ (x : ), x S0 x) :
            0 sSup S

            As 0 is the default value for Real.sSup of the empty set or sets which are not bounded above, it suffices to show that S is bounded below by 0 to show that 0 ≤ sSup S.

            theorem Real.iSup_nonneg {ι : Sort u_1} {f : ι} (hf : ∀ (i : ι), 0 f i) :
            0 ⨆ (i : ι), f i

            As 0 is the default value for Real.sSup of the empty set or sets which are not bounded above, it suffices to show that f i is nonnegative to show that 0 ≤ ⨆ i, f i.

            theorem Real.sSup_le {S : Set } {a : } (hS : ∀ (x : ), x Sx a) (ha : 0 a) :
            sSup S a

            As 0 is the default value for Real.sSup of the empty set or sets which are not bounded above, it suffices to show that all elements of S are bounded by a nonnegative number to show that sSup S is bounded by this number.

            theorem Real.iSup_le {ι : Sort u_1} {f : ι} {a : } (hS : ∀ (i : ι), f i a) (ha : 0 a) :
            ⨆ (i : ι), f i a
            theorem Real.sSup_nonpos (S : Set ) (hS : ∀ (x : ), x Sx 0) :
            sSup S 0

            As 0 is the default value for Real.sSup of the empty set, it suffices to show that S is bounded above by 0 to show that sSup S ≤ 0.

            theorem Real.sInf_nonneg (S : Set ) (hS : ∀ (x : ), x S0 x) :
            0 sInf S

            As 0 is the default value for Real.sInf of the empty set, it suffices to show that S is bounded below by 0 to show that 0 ≤ sInf S.

            theorem Real.iInf_nonneg {ι : Sort u_1} {f : ι} (hf : ∀ (i : ι), 0 f i) :
            0 iInf f

            As 0 is the default value for Real.sInf of the empty set, it suffices to show that f i is bounded below by 0 to show that 0 ≤ iInf f.

            theorem Real.sInf_nonpos (S : Set ) (hS : ∀ (x : ), x Sx 0) :
            sInf S 0

            As 0 is the default value for Real.sInf of the empty set or sets which are not bounded below, it suffices to show that S is bounded above by 0 to show that sInf S ≤ 0.

            theorem Real.sInf_le_sSup (s : Set ) (h₁ : BddBelow s) (h₂ : BddAbove s) :
            theorem Real.cauSeq_converges (f : CauSeq abs) :
            x, f CauSeq.const abs x
            theorem Real.iInf_Ioi_eq_iInf_rat_gt {f : } (x : ) (hf : BddBelow (f '' Set.Ioi x)) (hf_mono : Monotone f) :
            ⨅ (r : ↑(Set.Ioi x)), f r = ⨅ (q : { q' // x < q' }), f q