Nonnegative real numbers #
In this file we define nnreal
(notation: ℝ≥0
) to be the type of non-negative real numbers,
a.k.a. the interval [0, ∞)
. We also define the following operations and structures on ℝ≥0
:
-
the order on
ℝ≥0
is the restriction of the order onℝ
; these relations define a conditionally complete linear order with a bottom element,conditionally_complete_linear_order_bot
; -
a + b
anda * b
are the restrictions of addition and multiplication of real numbers toℝ≥0
; these operations together with0 = ⟨0, _⟩
and1 = ⟨1, _⟩
turnℝ≥0
into a conditionally complete linear ordered archimedean commutative semifield; we have no typeclass for this inmathlib
yet, so we define the following instances instead:linear_ordered_semiring ℝ≥0
;ordered_comm_semiring ℝ≥0
;canonically_ordered_comm_semiring ℝ≥0
;linear_ordered_comm_group_with_zero ℝ≥0
;canonically_linear_ordered_add_monoid ℝ≥0
;archimedean ℝ≥0
;conditionally_complete_linear_order_bot ℝ≥0
.
These instances are derived from corresponding instances about the type
{x : α // 0 ≤ x}
in an appropriate ordered field/ring/group/monoidα
. Seealgebra/order/nonneg
. -
real.to_nnreal x
is defined as⟨max x 0, _⟩
, i.e.↑(real.to_nnreal x) = x
when0 ≤ x
and↑(real.to_nnreal x) = 0
otherwise.
We also define an instance can_lift ℝ ℝ≥0
. This instance can be used by the lift
tactic to
replace x : ℝ
and hx : 0 ≤ x
in the proof context with x : ℝ≥0
while replacing all occurences
of x
with ↑x
. This tactic also works for a function f : α → ℝ
with a hypothesis
hf : ∀ x, 0 ≤ f x
.
Notations #
This file defines ℝ≥0
as a localized notation for nnreal
.
Equations
- nnreal.real.has_coe = {coe := subtype.val (λ (r : ℝ), 0 ≤ r)}
Equations
- nnreal.can_lift = {coe := coe coe_to_lift, cond := λ (r : ℝ), 0 ≤ r, prf := nnreal.can_lift._proof_1}
Coercion ℝ≥0 → ℝ
as a ring_hom
.
Equations
A mul_action
over ℝ
restricts to a mul_action
over ℝ≥0
.
A distrib_mul_action
over ℝ
restricts to a distrib_mul_action
over ℝ≥0
.
An algebra
over ℝ
restricts to an algebra
over ℝ≥0
.
Equations
- nnreal.algebra = {to_has_scalar := {smul := has_scalar.smul smul_with_zero.to_has_scalar}, to_ring_hom := (algebra_map ℝ A).comp nnreal.to_real_hom, commutes' := _, smul_def' := _}
real.to_nnreal
and coe : ℝ≥0 → ℝ
form a Galois insertion.
Equations
- nnreal.gi = galois_insertion.monotone_intro nnreal.coe_mono real.to_nnreal_mono real.le_coe_to_nnreal nnreal.gi._proof_1
Equations
- nnreal.conditionally_complete_linear_order_bot = nonneg.conditionally_complete_linear_order_bot nnreal.conditionally_complete_linear_order_bot._proof_1
Lemmas about subtraction #
In this section we provide a few lemmas about subtraction that do not fit well into any other
typeclass. For lemmas about subtraction and addition see lemmas
about has_ordered_sub
in the file algebra.order.sub
. See also mul_tsub
and tsub_mul
.