The extended reals [-∞, ∞]. #
This file defines EReal
, the real numbers together with a top and bottom element,
referred to as ⊤ and ⊥. It is implemented as WithBot (WithTop ℝ)
Addition and multiplication are problematic in the presence of ±∞, but negation has a natural definition and satisfies the usual properties, in particular it is an order reversing isomorphism
An ad hoc addition is defined, for which EReal
is an AddCommMonoid
, 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 CommMonoidWithZero
. 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
.
Distributivity x * (y + z) = x * y + x * z
is recovered in the case where either 0 ≤ x < ⊤
,
see Ereal.left_distrib_of_nonneg_of_ne_top
, or 0 ≤ y, z
, see Ereal.left_distrib_of_nonneg
(similarily for right distributivity).
EReal
is a CompleteLinearOrder
; this is deduced by type class inference from
the fact that WithBot (WithTop 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
Equations
- instERealPartialOrder = WithBot.partialOrder
Equations
Equations
The canonical inclusion from reals to ereals. Registered as a coercion.
Equations
- Real.toEReal = some ∘ some
Instances For
Equations
- EReal.decidableLT = WithBot.decidableLT
Equations
- EReal.hasCoeENNReal = { coe := ENNReal.toEReal }
The multiplication on EReal
. Our definition satisfies 0 * x = x * 0 = 0
for any x
, and
picks the only sensible value elsewhere.
Equations
- EReal.mul none none = ⊤
- EReal.mul none (some none) = ⊥
- EReal.mul none (some (some y)) = if 0 < y then ⊥ else if y = 0 then 0 else ⊤
- EReal.mul (some none) none = ⊥
- EReal.mul (some none) (some none) = ⊤
- EReal.mul (some none) (some (some y)) = if 0 < y then ⊤ else if y = 0 then 0 else ⊥
- EReal.mul (some (some x_2)) (some none) = if 0 < x_2 then ⊤ else if x_2 = 0 then 0 else ⊥
- EReal.mul (some (some x_2)) none = if 0 < x_2 then ⊥ else if x_2 = 0 then 0 else ⊤
- EReal.mul (some (some x_2)) (some (some y)) = ↑(x_2 * y)
Instances For
Induct on two EReal
s by performing case splits on the sign of one whenever the other is
infinite.
Induct on two EReal
s 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.
EReal
with its multiplication is a CommMonoidWithZero
. 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.
Real coercion #
The map from extended reals to reals sending infinities to zero.
Equations
- EReal.toReal none = 0
- EReal.toReal (some none) = 0
- EReal.toReal (some (some x_1)) = x_1
Instances For
Intervals and coercion from reals #
ennreal coercion #
nat coercion #
Order #
Addition #
We do not have a notion of LinearOrderedAddCommMonoidWithBot
but we can at least make
the order dual of the extended reals into a LinearOrderedAddCommMonoidWithTop
.
Negation #
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 SubNegZeroMonoid
, because of this bad behavior.
See also EReal.sub_le_of_le_add
.
See also EReal.sub_lt_of_lt_add
.
Addition and order #
Alias of EReal.add_le_of_forall_lt
.
Alias of EReal.add_le_of_forall_lt
.
Multiplication #
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 P x y
implies P (-x) y
for all
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 P
is symmetric and P x y
implies
P (-x) y
for all x
, y
.