Extended non-negative reals #
We define ennreal = ℝ≥0∞ := with_top ℝ≥0
to be the type of extended nonnegative real numbers,
i.e., the interval [0, +∞]
. This type is used as the codomain of a measure_theory.measure
,
and of the extended distance edist
in a emetric_space
.
In this file we define some algebraic operations and a linear order on ℝ≥0∞
and prove basic properties of these operations, order, and conversions to/from ℝ
, ℝ≥0
, and ℕ
.
Main definitions #
-
ℝ≥0∞
: the extended nonnegative real numbers[0, ∞]
; defined aswith_top ℝ≥0
; it is equipped with the following structures:-
coercion from
ℝ≥0
defined in the natural way; -
the natural structure of a complete dense linear order:
↑p ≤ ↑q ↔ p ≤ q
and∀ a, a ≤ ∞
; -
a + b
is defined so that↑p + ↑q = ↑(p + q)
for(p q : ℝ≥0)
anda + ∞ = ∞ + a = ∞
; -
a * b
is defined so that↑p * ↑q = ↑(p * q)
for(p q : ℝ≥0)
,0 * ∞ = ∞ * 0 = 0
, anda * ∞ = ∞ * a = ∞
fora ≠ 0
; -
a - b
is defined as the minimald
such thata ≤ d + b
; this way we have↑p - ↑q = ↑(p - q)
,∞ - ↑p = ∞
,↑p - ∞ = ∞ - ∞ = 0
; note that there is no negation, only subtraction; -
a⁻¹
is defined asInf {b | 1 ≤ a * b}
. This way we have(↑p)⁻¹ = ↑(p⁻¹)
forp : ℝ≥0
,p ≠ 0
,0⁻¹ = ∞
, and∞⁻¹ = 0
. -
a / b
is defined asa * b⁻¹
.
The addition and multiplication defined this way together with
0 = ↑0
and1 = ↑1
turnℝ≥0∞
into a canonically ordered commutative semiring of characteristic zero. -
-
Coercions to/from other types:
-
coercion
ℝ≥0 → ℝ≥0∞
is defined ashas_coe
, so one can use(p : ℝ≥0)
in a context that expectsa : ℝ≥0∞
, and Lean will applycoe
automatically; -
ennreal.to_nnreal
sends↑p
top
and∞
to0
; -
ennreal.to_real := coe ∘ ennreal.to_nnreal
sends↑p
,p : ℝ≥0
to(↑p : ℝ)
and∞
to0
; -
ennreal.of_real := coe ∘ real.to_nnreal
sendsx : ℝ
to↑⟨max x 0, _⟩
-
ennreal.ne_top_equiv_nnreal
is an equivalence between{a : ℝ≥0∞ // a ≠ 0}
andℝ≥0
.
-
Implementation notes #
We define a can_lift ℝ≥0∞ ℝ≥0
instance, so one of the ways to prove theorems about an ℝ≥0∞
number a
is to consider the cases a = ∞
and a ≠ ∞
, and use the tactic lift a to ℝ≥0 using ha
in the second case. This instance is even more useful if one already has ha : a ≠ ∞
in the
context, or if we have (f : α → ℝ≥0∞) (hf : ∀ x, f x ≠ ∞)
.
Notations #
ℝ≥0∞
: the type of the extended nonnegative real numbers;ℝ≥0
: the type of nonnegative real numbers[0, ∞)
; defined indata.real.nnreal
;∞
: a localized notation inℝ≥0∞
for⊤ : ℝ≥0∞
.
Equations
- ennreal.linear_ordered_add_comm_monoid = {le := canonically_ordered_comm_semiring.le ennreal.canonically_ordered_comm_semiring, lt := canonically_ordered_comm_semiring.lt ennreal.canonically_ordered_comm_semiring, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := complete_linear_order.decidable_le ennreal.complete_linear_order, decidable_eq := complete_linear_order.decidable_eq ennreal.complete_linear_order, decidable_lt := complete_linear_order.decidable_lt ennreal.complete_linear_order, max := complete_linear_order.max ennreal.complete_linear_order, max_def := _, min := complete_linear_order.min ennreal.complete_linear_order, min_def := _, add := canonically_ordered_comm_semiring.add ennreal.canonically_ordered_comm_semiring, add_assoc := _, zero := canonically_ordered_comm_semiring.zero ennreal.canonically_ordered_comm_semiring, zero_add := _, add_zero := _, nsmul := canonically_ordered_comm_semiring.nsmul ennreal.canonically_ordered_comm_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, add_le_add_left := _}
Equations
- ennreal.inhabited = {default := 0}
to_nnreal x
returns x
if it is real, otherwise 0.
Equations
- ennreal.to_nnreal (some r) = r
- ennreal.to_nnreal none = 0
of_real x
returns x
if it is nonnegative, 0
otherwise.
Equations
- ennreal.of_real r = ↑(r.to_nnreal)
The set of numbers in ℝ≥0∞
that are not equal to ∞
is equivalent to ℝ≥0
.
Coercion ℝ≥0 → ℝ≥0∞
as a ring_hom
.
Equations
- ennreal.of_nnreal_hom = {to_fun := coe coe_to_lift, map_one' := ennreal.coe_one, map_mul' := ennreal.of_nnreal_hom._proof_1, map_zero' := ennreal.coe_zero, map_add' := ennreal.of_nnreal_hom._proof_2}
A mul_action
over ℝ≥0∞
restricts to a mul_action
over ℝ≥0
.
A distrib_mul_action
over ℝ≥0∞
restricts to a distrib_mul_action
over ℝ≥0
.
An algebra
over ℝ≥0∞
restricts to an algebra
over ℝ≥0
.
Equations
- ennreal.algebra = {to_has_scalar := {smul := has_scalar.smul smul_with_zero.to_has_scalar}, to_ring_hom := (algebra_map ℝ≥0∞ A).comp ennreal.of_nnreal_hom, commutes' := _, smul_def' := _}
le_of_add_le_add_left
is normally applicable to ordered_cancel_add_comm_monoid
,
but it holds in ℝ≥0∞
with the additional assumption that a ≠ ∞
.
le_of_add_le_add_right
is normally applicable to ordered_cancel_add_comm_monoid
,
but it holds in ℝ≥0∞
with the additional assumption that a ≠ ∞
.
An element a
is add_le_cancellable
if a + b ≤ a + c
implies b ≤ c
for all b
and c
.
This is true in ℝ≥0∞
for all elements except ∞
.
This lemma has an abbreviated name because it is used frequently.
This lemma has an abbreviated name because it is used frequently.
This lemma has an abbreviated name because it is used frequently.
This lemma has an abbreviated name because it is used frequently.
This is a special case of with_top.top_sub_coe
in the ennreal
namespace
This is a special case of with_top.sub_top
in the ennreal
namespace
Equations
- ennreal.div_inv_monoid = {mul := monoid.mul infer_instance, mul_assoc := ennreal.div_inv_monoid._proof_1, one := monoid.one infer_instance, one_mul := ennreal.div_inv_monoid._proof_2, mul_one := ennreal.div_inv_monoid._proof_3, npow := monoid.npow infer_instance, npow_zero' := ennreal.div_inv_monoid._proof_4, npow_succ' := ennreal.div_inv_monoid._proof_5, inv := has_inv.inv ennreal.has_inv, div := λ (a b : ℝ≥0∞), monoid.mul a b⁻¹, div_eq_mul_inv := ennreal.div_inv_monoid._proof_6, zpow := zpow_rec {inv := has_inv.inv ennreal.has_inv}, zpow_zero' := ennreal.div_inv_monoid._proof_12, zpow_succ' := ennreal.div_inv_monoid._proof_13, zpow_neg' := ennreal.div_inv_monoid._proof_14}
ennreal.to_nnreal
as a monoid_hom
.
Equations
- ennreal.to_nnreal_hom = {to_fun := ennreal.to_nnreal, map_one' := ennreal.to_nnreal_hom._proof_1, map_mul' := ennreal.to_nnreal_hom._proof_2}
ennreal.to_real
as a monoid_hom
.
If x ≠ ∞
, then right multiplication by x
maps infimum over a nonempty type to infimum. See
also ennreal.infi_mul_of_ne
that assumes x ≠ 0
but does not require [nonempty ι]
.
If x ≠ ∞
, then left multiplication by x
maps infimum over a nonempty type to infimum. See
also ennreal.mul_infi_of_ne
that assumes x ≠ 0
but does not require [nonempty ι]
.
supr_mul
, mul_supr
and variants are in topology.instances.ennreal
.