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.
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
.
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
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.instCoeRealEReal = { coe := Real.toEReal }
Equations
- EReal.hasCoeENNReal = { coe := ENNReal.toEReal }
Equations
- EReal.instInhabitedEReal = { 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.
Equations
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 #
Equations
The map from extended reals to reals sending infinities to zero.
Equations
- EReal.toReal x = match x with | none => 0 | some none => 0 | some (some x) => x
Instances For
Intervals and coercion from reals #
ennreal 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.
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
.
Absolute value #
Sign #
Equations
- EReal.instCommMonoidWithZeroEReal = let __src := inferInstanceAs (MulZeroOneClass EReal); CommMonoidWithZero.mk ⋯ ⋯