Documentation

Mathlib.Data.EReal.Basic

The extended real numbers #

This file defines EReal, with a top element and a bottom element , implemented as WithBot (WithTop ℝ).

EReal is a CompleteLinearOrder, deduced by typeclass inference from the fact that WithBot (WithTop L) completes a conditionally complete linear order L.

Coercions from (called coe in lemmas) and from ℝ≥0∞ (coe_ennreal) are registered and their basic properties proved. The latter takes up most of the rest of this file.

Tags #

real, ereal, complete lattice

def EReal :

The type of extended real numbers [-∞, ∞], constructed as WithBot (WithTop ℝ).

Instances For
    @[implicit_reducible]
    noncomputable instance instNontrivialEReal :
    @[implicit_reducible]
    noncomputable instance instZeroEReal :
    Zero EReal
    @[implicit_reducible]
    noncomputable instance instOneEReal :
    One EReal
    @[implicit_reducible]
    noncomputable instance instAddMonoidEReal :
    @[implicit_reducible]
    @[implicit_reducible]
    @[implicit_reducible]
    noncomputable instance instCharZeroEReal :
    @[implicit_reducible]
    noncomputable instance instTopEReal :
    @[implicit_reducible]
    noncomputable instance instBotEReal :
    @[implicit_reducible]
    noncomputable instance instSupSetEReal :
    @[implicit_reducible]
    noncomputable instance instInfSetEReal :
    @[implicit_reducible]
    noncomputable instance instPartialOrderEReal :
    @[implicit_reducible]
    noncomputable instance instLinearOrderEReal :
    @[implicit_reducible]
    @[implicit_reducible]
    @[implicit_reducible]
    @[implicit_reducible]

    The canonical inclusion from reals to ereals. Registered as a coercion.

    Instances For
      @[implicit_reducible]
      @[simp]
      theorem EReal.coe_le_coe_iff {x y : } :
      x y x y
      theorem EReal.coe_le_coe {x y : } :
      x yx y

      Alias of the reverse direction of EReal.coe_le_coe_iff.

      @[simp]
      theorem EReal.coe_lt_coe_iff {x y : } :
      x < y x < y
      theorem EReal.coe_lt_coe {x y : } :
      x < yx < y

      Alias of the reverse direction of EReal.coe_lt_coe_iff.

      @[simp]
      theorem EReal.coe_eq_coe_iff {x y : } :
      x = y x = y
      theorem EReal.coe_ne_coe_iff {x y : } :
      x y x y
      @[simp]
      theorem EReal.coe_natCast {n : } :
      n = n
      noncomputable def ENNReal.toEReal :

      The canonical map from nonnegative extended reals to extended reals.

      Instances For
        @[implicit_reducible]
        noncomputable instance EReal.hasCoeENNReal :
        @[implicit_reducible]
        noncomputable instance EReal.instInhabited :
        Inhabited EReal
        @[simp]
        theorem EReal.coe_zero :
        0 = 0
        @[simp]
        theorem EReal.coe_one :
        1 = 1
        def EReal.rec {motive : ERealSort u_1} (bot : motive ) (coe : (a : ) → motive a) (top : motive ) (a : EReal) :
        motive a

        A recursor for EReal in terms of the coercion.

        When working in term mode, note that pattern matching can be used directly, although this is prone to leaking the implementation details in terms of Option.

        Instances For
          @[simp]
          theorem EReal.rec_bot {motive : ERealSort u_1} (bot : motive ) (coe : (a : ) → motive a) (top : motive ) :
          EReal.rec bot coe top = bot
          @[simp]
          theorem EReal.rec_top {motive : ERealSort u_1} (bot : motive ) (coe : (a : ) → motive a) (top : motive ) :
          EReal.rec bot coe top = top
          @[simp]
          theorem EReal.rec_coe {motive : ERealSort u_1} (bot : motive ) (coe : (a : ) → motive a) (top : motive ) (a : ) :
          EReal.rec bot coe top a = coe a
          theorem EReal.forall {p : ERealProp} :
          (∀ (r : EReal), p r) p p ∀ (r : ), p r
          theorem EReal.exists {p : ERealProp} :
          (∃ (r : EReal), p r) p p ∃ (r : ), p r
          noncomputable def EReal.mul :
          ERealERealEReal

          The multiplication on EReal. Our definition satisfies 0 * x = x * 0 = 0 for any x, and picks the only sensible value elsewhere.

          Instances For
            @[implicit_reducible]
            noncomputable instance EReal.instMul :
            Mul EReal
            @[simp]
            theorem EReal.coe_mul (x y : ) :
            (x * y) = x * y
            theorem EReal.induction₂ {P : ERealERealProp} (top_top : P ) (top_pos : ∀ (x : ), 0 < xP x) (top_zero : P 0) (top_neg : x < 0, P x) (top_bot : P ) (pos_top : ∀ (x : ), 0 < xP x ) (pos_bot : ∀ (x : ), 0 < xP x ) (zero_top : P 0 ) (coe_coe : ∀ (x y : ), P x y) (zero_bot : P 0 ) (neg_top : x < 0, P x ) (neg_bot : x < 0, P x ) (bot_top : P ) (bot_pos : ∀ (x : ), 0 < xP x) (bot_zero : P 0) (bot_neg : x < 0, P x) (bot_bot : P ) (x y : EReal) :
            P x y

            Induct on two EReals by performing case splits on the sign of one whenever the other is infinite.

            theorem EReal.induction₂_symm {P : ERealERealProp} (symm : ∀ {x y : EReal}, P x yP y x) (top_top : P ) (top_pos : ∀ (x : ), 0 < xP x) (top_zero : P 0) (top_neg : x < 0, P x) (top_bot : P ) (pos_bot : ∀ (x : ), 0 < xP x ) (coe_coe : ∀ (x y : ), P x y) (zero_bot : P 0 ) (neg_bot : x < 0, P x ) (bot_bot : P ) (x y : EReal) :
            P x y

            Induct on two EReals by performing case splits on the sign of one whenever the other is infinite. This version eliminates some cases by assuming that the relation is symmetric.

            theorem EReal.mul_comm (x y : EReal) :
            x * y = y * x
            theorem EReal.one_mul (x : EReal) :
            1 * x = x
            theorem EReal.zero_mul (x : EReal) :
            0 * x = 0
            @[implicit_reducible]

            Real coercion #

            instance EReal.canLift :
            CanLift EReal Real.toEReal fun (r : EReal) => r r

            The map from extended reals to reals sending infinities to zero.

            Instances For
              @[simp]
              theorem EReal.toReal_coe (x : ) :
              (↑x).toReal = x
              @[simp]
              theorem EReal.bot_lt_coe (x : ) :
              < x
              @[simp]
              theorem EReal.coe_ne_bot (x : ) :
              x
              @[simp]
              theorem EReal.bot_ne_coe (x : ) :
              x
              @[simp]
              theorem EReal.coe_lt_top (x : ) :
              x <
              @[simp]
              theorem EReal.coe_ne_top (x : ) :
              x
              @[simp]
              theorem EReal.top_ne_coe (x : ) :
              x
              @[simp]
              theorem EReal.bot_ne_zero :
              0
              @[simp]
              theorem EReal.zero_ne_bot :
              0
              @[simp]
              theorem EReal.zero_ne_top :
              0
              @[simp]
              theorem EReal.top_ne_zero :
              0
              @[simp]
              theorem EReal.coe_add (x y : ) :
              (x + y) = x + y
              theorem EReal.coe_nsmul (n : ) (x : ) :
              (n x) = n x
              @[simp]
              theorem EReal.coe_eq_zero {x : } :
              x = 0 x = 0
              @[simp]
              theorem EReal.coe_eq_one {x : } :
              x = 1 x = 1
              theorem EReal.coe_ne_zero {x : } :
              x 0 x 0
              theorem EReal.coe_ne_one {x : } :
              x 1 x 1
              @[simp]
              theorem EReal.coe_nonneg {x : } :
              0 x 0 x
              @[simp]
              theorem EReal.coe_nonpos {x : } :
              x 0 x 0
              @[simp]
              theorem EReal.coe_pos {x : } :
              0 < x 0 < x
              @[simp]
              theorem EReal.coe_neg' {x : } :
              x < 0 x < 0
              theorem EReal.toReal_eq_zero_iff {x : EReal} :
              x.toReal = 0 x = 0 x = x =
              theorem EReal.toReal_ne_zero_iff {x : EReal} :
              x.toReal 0 x 0 x x
              theorem EReal.toReal_eq_toReal {x y : EReal} (hx_top : x ) (hx_bot : x ) (hy_top : y ) (hy_bot : y ) :
              x.toReal = y.toReal x = y
              theorem EReal.toReal_pos {x : EReal} (hx : 0 < x) (h'x : x ) :
              0 < x.toReal
              theorem EReal.toReal_neg {x : EReal} (hx : x < 0) (h'x : x ) :
              x.toReal < 0
              theorem EReal.toReal_le_toReal {x y : EReal} (h : x y) (hx : x ) (hy : y ) :
              theorem EReal.coe_toReal {x : EReal} (hx : x ) (h'x : x ) :
              x.toReal = x
              theorem EReal.le_coe_toReal {x : EReal} (h : x ) :
              x x.toReal
              theorem EReal.coe_toReal_le {x : EReal} (h : x ) :
              x.toReal x
              theorem EReal.eq_top_iff_forall_lt (x : EReal) :
              x = ∀ (y : ), y < x
              theorem EReal.eq_bot_iff_forall_lt (x : EReal) :
              x = ∀ (y : ), x < y

              Intervals and coercion from reals #

              theorem EReal.exists_between_coe_real {x z : EReal} (h : x < z) :
              ∃ (y : ), x < y y < z
              @[simp]
              theorem EReal.image_coe_Icc (x y : ) :
              Real.toEReal '' Set.Icc x y = Set.Icc x y
              @[simp]
              theorem EReal.image_coe_Ico (x y : ) :
              Real.toEReal '' Set.Ico x y = Set.Ico x y
              @[simp]
              theorem EReal.image_coe_Ioc (x y : ) :
              Real.toEReal '' Set.Ioc x y = Set.Ioc x y
              @[simp]
              theorem EReal.image_coe_Ioo (x y : ) :
              Real.toEReal '' Set.Ioo x y = Set.Ioo x y

              ennreal coercion #

              @[simp]
              theorem EReal.coe_ennreal_ofReal {x : } :
              (ENNReal.ofReal x) = (max x 0)
              theorem EReal.coe_ennreal_toReal {x : ENNReal} (hx : x ) :
              x.toReal = x
              theorem EReal.coe_nnreal_eq_coe_real (x : NNReal) :
              x = x
              @[simp]
              theorem EReal.coe_ennreal_zero :
              0 = 0
              @[simp]
              theorem EReal.coe_ennreal_one :
              1 = 1
              @[simp]
              theorem EReal.coe_ennreal_eq_top_iff {x : ENNReal} :
              x = x =
              theorem EReal.coe_nnreal_ne_top (x : NNReal) :
              x
              @[simp]
              theorem EReal.coe_nnreal_lt_top (x : NNReal) :
              x <
              @[simp]
              theorem EReal.coe_ennreal_le_coe_ennreal_iff {x y : ENNReal} :
              x y x y
              @[simp]
              theorem EReal.coe_ennreal_lt_coe_ennreal_iff {x y : ENNReal} :
              x < y x < y
              @[simp]
              theorem EReal.coe_ennreal_eq_coe_ennreal_iff {x y : ENNReal} :
              x = y x = y
              theorem EReal.coe_ennreal_ne_coe_ennreal_iff {x y : ENNReal} :
              x y x y
              @[simp]
              theorem EReal.coe_ennreal_eq_zero {x : ENNReal} :
              x = 0 x = 0
              @[simp]
              theorem EReal.coe_ennreal_eq_one {x : ENNReal} :
              x = 1 x = 1
              theorem EReal.coe_ennreal_ne_zero {x : ENNReal} :
              x 0 x 0
              theorem EReal.coe_ennreal_ne_one {x : ENNReal} :
              x 1 x 1
              @[simp]
              theorem EReal.coe_ennreal_pos {x : ENNReal} :
              0 < x 0 < x
              @[simp]
              theorem EReal.coe_ennreal_ne_bot (x : ENNReal) :
              x
              @[simp]
              theorem EReal.coe_ennreal_add (x y : ENNReal) :
              (x + y) = x + y
              @[simp]
              theorem EReal.coe_ennreal_mul (x y : ENNReal) :
              (x * y) = x * y
              theorem EReal.coe_ennreal_nsmul (n : ) (x : ENNReal) :
              (n x) = n x

              toENNReal #

              noncomputable def EReal.toENNReal (x : EReal) :

              x.toENNReal returns x if it is nonnegative, 0 otherwise.

              Instances For
                theorem EReal.toENNReal_ne_top_iff {x : EReal} :
                x.toENNReal x
                @[simp]
                theorem EReal.toENNReal_of_nonpos {x : EReal} (hx : x 0) :
                x.toENNReal = 0
                @[simp]
                theorem EReal.toENNReal_pos_iff {x : EReal} :
                0 < x.toENNReal 0 < x
                @[simp]
                theorem EReal.coe_toENNReal {x : EReal} (hx : 0 x) :
                x.toENNReal = x
                @[simp]
                theorem EReal.toENNReal_coe {x : ENNReal} :
                (↑x).toENNReal = x
                @[simp]
                theorem EReal.toReal_toENNReal {x : EReal} (hx : 0 x) :
                theorem EReal.toENNReal_eq_toENNReal {x y : EReal} (hx : 0 x) (hy : 0 y) :
                x.toENNReal = y.toENNReal x = y
                theorem EReal.toENNReal_lt_toENNReal {x y : EReal} (hx : 0 x) (hxy : x < y) :

                nat coercion #

                theorem EReal.coe_coe_eq_natCast (n : ) :
                n = n
                theorem EReal.natCast_ne_bot (n : ) :
                n
                theorem EReal.natCast_ne_top (n : ) :
                n
                theorem EReal.natCast_eq_iff {m n : } :
                m = n m = n
                theorem EReal.natCast_ne_iff {m n : } :
                m n m n
                theorem EReal.natCast_le_iff {m n : } :
                m n m n
                theorem EReal.natCast_lt_iff {m n : } :
                m < n m < n
                @[simp]
                theorem EReal.natCast_mul (m n : ) :
                (m * n) = m * n

                Miscellaneous lemmas #

                theorem EReal.exists_rat_btwn_of_lt {a b : EReal} :
                a < b∃ (x : ), a < x x < b
                theorem EReal.lt_iff_exists_rat_btwn {a b : EReal} :
                a < b ∃ (x : ), a < x x < b
                theorem EReal.lt_iff_exists_real_btwn {a b : EReal} :
                a < b ∃ (x : ), a < x x < b

                The set of numbers in EReal that are not equal to ±∞ is equivalent to .

                Instances For

                  Extension for the positivity tactic: cast from to EReal.

                  Instances For

                    Extension for the positivity tactic: cast from ℝ≥0∞ to EReal.

                    Instances For

                      Extension for the positivity tactic: projection from EReal to .

                      We prove that EReal.toReal x is nonnegative whenever x is nonnegative. Since EReal.toReal ⊤ = 0, we cannot prove a stronger statement, at least without relying on a tactic like finiteness.

                      Instances For

                        Extension for the positivity tactic: projection from EReal to ℝ≥0∞.

                        We show that EReal.toENNReal x is positive whenever x is positive, and it is nonnegative otherwise. We cannot deduce any corollaries from x ≠ 0, since EReal.toENNReal x = 0 for x < 0.

                        Instances For