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
ereal : The type [-∞, ∞]
Instances for ereal
- ereal.has_bot
- ereal.has_zero
- ereal.has_one
- ereal.nontrivial
- ereal.add_monoid
- ereal.has_Sup
- ereal.has_Inf
- ereal.complete_linear_order
- ereal.linear_ordered_add_comm_monoid
- ereal.zero_le_one_class
- ereal.has_top
- ereal.has_coe
- ereal.has_coe_ennreal
- ereal.inhabited
- ereal.has_mul
- ereal.mul_zero_one_class
- ereal.can_lift
- ereal.has_neg
- ereal.sub_neg_zero_monoid
- ereal.has_involutive_neg
- ereal.has_distrib_neg
- ereal.comm_monoid_with_zero
- ereal.pos_mul_mono
- ereal.mul_pos_mono
- ereal.pos_mul_reflect_lt
- ereal.mul_pos_reflect_lt
- ereal.topological_space
- ereal.order_topology
- ereal.t2_space
- ereal.topological_space.second_countable_topology
- ereal.measurable_space
- ereal.borel_space
The canonical inclusion froms reals to ereals. Do not use directly: as this is registered as a coercion, use the coercion instead.
Equations
Equations
Equations
- ereal.has_top = {top := option.some ⊤}
Equations
The canonical map from nonnegative extended reals to extended reals
Equations
- ennreal.to_ereal (option.some x) = ↑(x.val)
- ⊤.to_ereal = ⊤
Equations
Equations
- ereal.inhabited = {default := 0}
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.
The multiplication on ereal
. Our definition satisfies 0 * x = x * 0 = 0
for any x
, and
picks the only sensible value elsewhere.
Equations
- ereal.has_mul = {mul := ereal.mul}
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.
Equations
- ereal.mul_zero_one_class = {one := 1, mul := has_mul.mul ereal.has_mul, one_mul := ereal.mul_zero_one_class._proof_1, mul_one := ereal.mul_zero_one_class._proof_2, zero := 0, zero_mul := ereal.mul_zero_one_class._proof_3, mul_zero := ereal.mul_zero_one_class._proof_4}
Real coercion #
ennreal coercion #
Order #
The set of numbers in ereal
that are not equal to ±∞
is equivalent to ℝ
.
Addition #
Negation #
Equations
- ereal.has_neg = {neg := ereal.neg}
Equations
- ereal.sub_neg_zero_monoid = {add := add_monoid.add ereal.add_monoid, add_assoc := _, zero := add_monoid.zero ereal.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul ereal.add_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := has_neg.neg ereal.has_neg, sub := sub_neg_monoid.sub._default add_monoid.add add_monoid.add_assoc add_monoid.zero add_monoid.zero_add add_monoid.add_zero add_monoid.nsmul add_monoid.nsmul_zero' add_monoid.nsmul_succ' has_neg.neg, sub_eq_add_neg := ereal.sub_neg_zero_monoid._proof_1, zsmul := sub_neg_monoid.zsmul._default add_monoid.add add_monoid.add_assoc add_monoid.zero add_monoid.zero_add add_monoid.add_zero add_monoid.nsmul add_monoid.nsmul_zero' add_monoid.nsmul_succ' has_neg.neg, zsmul_zero' := ereal.sub_neg_zero_monoid._proof_2, zsmul_succ' := ereal.sub_neg_zero_monoid._proof_3, zsmul_neg' := ereal.sub_neg_zero_monoid._proof_4, neg_zero := ereal.sub_neg_zero_monoid._proof_5}
Equations
- ereal.has_involutive_neg = {neg := has_neg.neg ereal.has_neg, neg_neg := ereal.has_involutive_neg._proof_1}
Negation as an order reversing isomorphism on ereal
.
Equations
- ereal.neg_order_iso = {to_equiv := {to_fun := λ (x : ereal), ⇑order_dual.to_dual (-x), inv_fun := λ (x : erealᵒᵈ), -⇑order_dual.of_dual x, left_inv := ereal.neg_order_iso._proof_1, right_inv := ereal.neg_order_iso._proof_2}, map_rel_iff' := ereal.neg_order_iso._proof_3}
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.
Multiplication #
Equations
- ereal.has_distrib_neg = {neg := has_involutive_neg.neg ereal.has_involutive_neg, neg_neg := _, neg_mul := ereal.neg_mul, mul_neg := ereal.has_distrib_neg._proof_1}
Absolute value #
Sign #
Equations
- ereal.comm_monoid_with_zero = {mul := has_mul.mul ereal.has_mul, mul_assoc := ereal.comm_monoid_with_zero._proof_1, one := 1, one_mul := _, mul_one := _, npow := comm_monoid.npow._default 1 has_mul.mul mul_zero_one_class.one_mul mul_zero_one_class.mul_one, npow_zero' := ereal.comm_monoid_with_zero._proof_2, npow_succ' := ereal.comm_monoid_with_zero._proof_3, mul_comm := ereal.mul_comm, zero := 0, zero_mul := _, mul_zero := _}