mathlib3 documentation

data.real.ereal

The extended reals [-∞, ∞]. #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines ereal, the real numbers together with a top and bottom element, referred to as ⊤ and ⊥. It is implemented as with_bot (with_top ℝ)

Addition and multiplication are problematic in the presence of ±∞, but negation has a natural definition and satisfies the usual properties.

An ad hoc addition is defined, for which ereal is an add_comm_monoid, and even an ordered one (if a ≤ a' and b ≤ b' then a + b ≤ a' + b'). Note however that addition is badly behaved at (⊥, ⊤) and (⊤, ⊥) so this can not be upgraded to a group structure. Our choice is that ⊥ + ⊤ = ⊤ + ⊥ = ⊥, to make sure that the exponential and the logarithm between ereal and ℝ≥0∞ respect the operations (notice that the convention 0 * ∞ = 0 on ℝ≥0∞ is enforced by measure theory).

An ad hoc subtraction is then defined by x - y = x + (-y). It does not have nice properties, but it is sometimes convenient to have.

An ad hoc multiplication is defined, for which ereal is a comm_monoid_with_zero. We make the choice that 0 * x = x * 0 = 0 for any x (while the other cases are defined non-ambiguously). This does not distribute with addition, as ⊥ = ⊥ + ⊤ = 1*⊥ + (-1)*⊥ ≠ (1 - 1) * ⊥ = 0 * ⊥ = 0.

ereal is a complete_linear_order; this is deduced by type class inference from the fact that with_bot (with_top L) is a complete linear order if L is a conditionally complete linear order.

Coercions from and from ℝ≥0∞ are registered, and their basic properties are proved. The main one is the real coercion, and is usually referred to just as coe (lemmas such as ereal.coe_add deal with this coercion). The one from ennreal is usually called coe_ennreal in the ereal namespace.

We define an absolute value ereal.abs from ereal to ℝ≥0∞. Two elements of ereal coincide if and only if they have the same absolute value and the same sign.

Tags #

real, ereal, complete lattice

@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]
noncomputable def ereal.has_Sup  :
@[protected, instance]
@[protected, instance]
noncomputable def ereal.has_Inf  :
@[protected, instance]
@[protected, instance]
@[protected, instance]

The canonical inclusion froms reals to ereals. Do not use directly: as this is registered as a coercion, use the coercion instead.

Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, instance]
Equations
@[protected, simp, norm_cast]
theorem ereal.coe_le_coe_iff {x y : } :
x y x y
@[protected, simp, norm_cast]
theorem ereal.coe_lt_coe_iff {x y : } :
x < y x < y
@[protected, simp, norm_cast]
theorem ereal.coe_eq_coe_iff {x y : } :
x = y x = y
@[protected]
theorem ereal.coe_ne_coe_iff {x y : } :
x y x y

The canonical map from nonnegative extended reals to extended reals

Equations
@[protected, instance]
Equations
@[simp, norm_cast]
theorem ereal.coe_zero  :
0 = 0
@[simp, norm_cast]
theorem ereal.coe_one  :
1 = 1
@[protected]
def ereal.rec {C : ereal Sort u_1} (h_bot : C ) (h_real : Π (a : ), C a) (h_top : C ) (a : ereal) :
C a

A recursor for ereal in terms of the coercion.

A typical invocation looks like induction x using ereal.rec. Note that using induction directly will unfold ereal to option which is undesirable.

When working in term mode, note that pattern matching can be used directly.

Equations
@[protected]
noncomputable def ereal.mul  :

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

Equations
@[protected, instance]
noncomputable def ereal.has_mul  :
Equations
theorem ereal.induction₂ {P : ereal ereal Prop} (top_top : P ) (top_pos : (x : ), 0 < x P x) (top_zero : P 0) (top_neg : (x : ), x < 0 P x) (top_bot : P ) (pos_top : (x : ), 0 < x P x ) (pos_bot : (x : ), 0 < x P x ) (zero_top : P 0 ) (coe_coe : (x y : ), P x y) (zero_bot : P 0 ) (neg_top : (x : ), x < 0 P x ) (neg_bot : (x : ), x < 0 P x ) (bot_top : P ) (bot_pos : (x : ), 0 < x P x) (bot_zero : P 0) (bot_neg : (x : ), 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.

ereal with its multiplication is a comm_monoid_with_zero. However, the proof of associativity by hand is extremely painful (with 125 cases...). Instead, we will deduce it later on from the facts that the absolute value and the sign are multiplicative functions taking value in associative objects, and that they characterize an extended real number. For now, we only record more basic properties of multiplication.

@[protected, instance]
Equations

Real coercion #

@[protected, instance]
def ereal.can_lift  :
Equations

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

Equations
@[simp]
theorem ereal.to_real_top  :
@[simp]
theorem ereal.to_real_bot  :
@[simp]
theorem ereal.to_real_zero  :
@[simp]
theorem ereal.to_real_one  :
@[simp]
theorem ereal.to_real_coe (x : ) :
@[simp]
theorem ereal.bot_lt_coe (x : ) :
@[simp]
theorem ereal.coe_ne_bot (x : ) :
@[simp]
theorem ereal.bot_ne_coe (x : ) :
@[simp]
theorem ereal.coe_lt_top (x : ) :
@[simp]
theorem ereal.coe_ne_top (x : ) :
@[simp]
theorem ereal.top_ne_coe (x : ) :
@[simp]
theorem ereal.bot_lt_zero  :
< 0
@[simp]
theorem ereal.bot_ne_zero  :
@[simp]
theorem ereal.zero_ne_bot  :
@[simp]
theorem ereal.zero_lt_top  :
0 <
@[simp]
theorem ereal.zero_ne_top  :
@[simp]
theorem ereal.top_ne_zero  :
@[simp, norm_cast]
theorem ereal.coe_add (x y : ) :
(x + y) = x + y
@[simp, norm_cast]
theorem ereal.coe_mul (x y : ) :
(x * y) = x * y
@[norm_cast]
theorem ereal.coe_nsmul (n : ) (x : ) :
(n x) = n x
@[simp, norm_cast]
theorem ereal.coe_bit0 (x : ) :
@[simp, norm_cast]
theorem ereal.coe_bit1 (x : ) :
@[simp, norm_cast]
theorem ereal.coe_eq_zero {x : } :
x = 0 x = 0
@[simp, norm_cast]
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
@[protected, simp, norm_cast]
theorem ereal.coe_nonneg {x : } :
0 x 0 x
@[protected, simp, norm_cast]
theorem ereal.coe_nonpos {x : } :
x 0 x 0
@[protected, simp, norm_cast]
theorem ereal.coe_pos {x : } :
0 < x 0 < x
@[protected, simp, norm_cast]
theorem ereal.coe_neg' {x : } :
x < 0 x < 0
theorem ereal.to_real_le_to_real {x y : ereal} (h : x y) (hx : x ) (hy : y ) :
theorem ereal.coe_to_real {x : ereal} (hx : x ) (h'x : x ) :
theorem ereal.le_coe_to_real {x : ereal} (h : x ) :
theorem ereal.coe_to_real_le {x : ereal} (h : 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

ennreal coercion #

@[simp, norm_cast]
theorem ereal.coe_ennreal_zero  :
0 = 0
@[simp, norm_cast]
theorem ereal.coe_ennreal_one  :
1 = 1
@[simp, norm_cast]
@[simp]
@[simp]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
theorem ereal.coe_ennreal_eq_zero {x : ennreal} :
x = 0 x = 0
@[simp, norm_cast]
theorem ereal.coe_ennreal_eq_one {x : ennreal} :
x = 1 x = 1
@[norm_cast]
theorem ereal.coe_ennreal_ne_zero {x : ennreal} :
x 0 x 0
@[norm_cast]
theorem ereal.coe_ennreal_ne_one {x : ennreal} :
x 1 x 1
@[simp, norm_cast]
theorem ereal.coe_ennreal_pos {x : ennreal} :
0 < x 0 < x
@[simp]
@[simp]
@[simp, norm_cast]
theorem ereal.coe_ennreal_add (x y : ennreal) :
(x + y) = x + y
@[simp, norm_cast]
theorem ereal.coe_ennreal_mul (x y : ennreal) :
(x * y) = x * y
@[norm_cast]
theorem ereal.coe_ennreal_nsmul (n : ) (x : ennreal) :
(n x) = n x
@[simp, norm_cast]
@[simp, norm_cast]

Order #

theorem ereal.exists_rat_btwn_of_lt {a b : ereal} (hab : 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 .

Equations

Addition #

@[simp]
theorem ereal.add_bot (x : ereal) :
@[simp]
theorem ereal.bot_add (x : ereal) :
@[simp]
theorem ereal.top_add_top  :
@[simp]
theorem ereal.top_add_coe (x : ) :
@[simp]
theorem ereal.coe_add_top (x : ) :
theorem ereal.to_real_add {x y : ereal} (hx : x ) (h'x : x ) (hy : y ) (h'y : y ) :
theorem ereal.add_lt_add_right_coe {x y : ereal} (h : x < y) (z : ) :
x + z < y + z
theorem ereal.add_lt_add_of_lt_of_le {x y z t : ereal} (h : x < y) (h' : z t) (hz : z ) (ht : t ) :
x + z < y + t
theorem ereal.add_lt_add_left_coe {x y : ereal} (h : x < y) (z : ) :
z + x < z + y
theorem ereal.add_lt_add {x y z t : ereal} (h1 : x < y) (h2 : z < t) :
x + z < y + t
@[simp]
theorem ereal.add_eq_bot_iff {x y : ereal} :
x + y = x = y =
@[simp]
theorem ereal.bot_lt_add_iff {x y : ereal} :
< x + y < x < y
theorem ereal.add_lt_top {x y : ereal} (hx : x ) (hy : y ) :
x + y <

Negation #

@[protected]

negation on ereal

Equations
@[protected, instance]
Equations
@[protected, norm_cast]
theorem ereal.neg_def (x : ) :
@[simp]
theorem ereal.neg_top  :
@[simp]
theorem ereal.neg_bot  :
@[simp, norm_cast]
theorem ereal.coe_neg (x : ) :
@[simp, norm_cast]
theorem ereal.coe_sub (x y : ) :
(x - y) = x - y
@[norm_cast]
theorem ereal.coe_zsmul (n : ) (x : ) :
(n x) = n x
@[protected, instance]
Equations
@[simp]
theorem ereal.to_real_neg {a : ereal} :
@[simp]
theorem ereal.neg_eq_top_iff {x : ereal} :
-x = x =
@[simp]
theorem ereal.neg_eq_bot_iff {x : ereal} :
-x = x =
@[simp]
theorem ereal.neg_eq_zero_iff {x : ereal} :
-x = 0 x = 0
@[protected]
theorem ereal.neg_le_of_neg_le {a b : ereal} (h : -a b) :
-b a

if -a ≤ b then -b ≤ a on ereal.

@[protected]
theorem ereal.neg_le {a b : ereal} :
-a b -b a

-a ≤ b ↔ -b ≤ a on ereal.

theorem ereal.le_neg_of_le_neg {a b : ereal} (h : a -b) :
b -a

a ≤ -b → b ≤ -a on ereal

@[simp]
theorem ereal.neg_le_neg_iff {a b : ereal} :
-a -b b a

Negation as an order reversing isomorphism on ereal.

Equations
theorem ereal.neg_lt_of_neg_lt {a b : ereal} (h : -a < b) :
-b < a
theorem ereal.neg_lt_iff_neg_lt {a b : ereal} :
-a < b -b < a

Subtraction #

Subtraction on ereal is defined by x - y = x + (-y). Since addition is badly behaved at some points, so is subtraction. There is no standard algebraic typeclass involving subtraction that is registered on ereal, beyond sub_neg_zero_monoid, because of this bad behavior.

@[simp]
theorem ereal.bot_sub (x : ereal) :
@[simp]
theorem ereal.sub_top (x : ereal) :
@[simp]
theorem ereal.top_sub_bot  :
@[simp]
theorem ereal.top_sub_coe (x : ) :
@[simp]
theorem ereal.coe_sub_bot (x : ) :
theorem ereal.sub_le_sub {x y z t : ereal} (h : x y) (h' : t z) :
x - z y - t
theorem ereal.sub_lt_sub_of_lt_of_le {x y z t : ereal} (h : x < y) (h' : z t) (hz : z ) (ht : t ) :
x - t < y - z
theorem ereal.to_real_sub {x y : ereal} (hx : x ) (h'x : x ) (hy : y ) (h'y : y ) :

Multiplication #

@[protected]
theorem ereal.mul_comm (x y : ereal) :
x * y = y * x
@[simp]
theorem ereal.top_mul_top  :
@[simp]
theorem ereal.top_mul_bot  :
@[simp]
theorem ereal.bot_mul_top  :
@[simp]
theorem ereal.bot_mul_bot  :
theorem ereal.mul_top_of_pos {x : ereal} (h : 0 < x) :
theorem ereal.mul_top_of_neg {x : ereal} (h : x < 0) :
theorem ereal.top_mul_of_pos {x : ereal} (h : 0 < x) :
theorem ereal.top_mul_of_neg {x : ereal} (h : x < 0) :
theorem ereal.coe_mul_top_of_pos {x : } (h : 0 < x) :
theorem ereal.coe_mul_top_of_neg {x : } (h : x < 0) :
theorem ereal.top_mul_coe_of_pos {x : } (h : 0 < x) :
theorem ereal.top_mul_coe_of_neg {x : } (h : x < 0) :
theorem ereal.mul_bot_of_pos {x : ereal} (h : 0 < x) :
theorem ereal.mul_bot_of_neg {x : ereal} (h : x < 0) :
theorem ereal.bot_mul_of_pos {x : ereal} (h : 0 < x) :
theorem ereal.bot_mul_of_neg {x : ereal} (h : x < 0) :
theorem ereal.coe_mul_bot_of_pos {x : } (h : 0 < x) :
theorem ereal.coe_mul_bot_of_neg {x : } (h : x < 0) :
theorem ereal.bot_mul_coe_of_pos {x : } (h : 0 < x) :
theorem ereal.bot_mul_coe_of_neg {x : } (h : x < 0) :
theorem ereal.to_real_mul {x y : ereal} :
@[protected]
theorem ereal.neg_mul (x y : ereal) :
-x * y = -(x * y)
@[protected, instance]
Equations

Absolute value #

@[protected]
noncomputable def ereal.abs  :

The absolute value from ereal to ℝ≥0∞, mapping and to and a real x to |x|.

Equations
@[simp]
theorem ereal.abs_top  :
@[simp]
theorem ereal.abs_bot  :
theorem ereal.abs_coe_lt_top (x : ) :
@[simp]
theorem ereal.abs_eq_zero_iff {x : ereal} :
x.abs = 0 x = 0
@[simp]
theorem ereal.abs_zero  :
0.abs = 0
@[simp]
theorem ereal.coe_abs (x : ) :
@[simp]
theorem ereal.abs_mul (x y : ereal) :
(x * y).abs = x.abs * y.abs

Sign #

@[simp]
theorem ereal.sign_top  :
@[simp]
theorem ereal.sign_bot  :
@[simp]
theorem ereal.sign_coe (x : ) :
@[simp]
theorem ereal.sign_mul (x y : ereal) :
theorem ereal.sign_mul_abs (x : ereal) :
(sign x) * (x.abs) = x
@[protected, instance]
Equations
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[protected, instance]
@[simp, norm_cast]
theorem ereal.coe_pow (x : ) (n : ) :
(x ^ n) = x ^ n
@[simp, norm_cast]
theorem ereal.coe_ennreal_pow (x : ennreal) (n : ) :
(x ^ n) = x ^ n

Extension for the positivity tactic: cast from to ereal.

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