Ordered Subtraction #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file proves lemmas relating (truncated) subtraction with an order. We provide a class
has_ordered_sub
stating that a - b ≤ c ↔ a ≤ c + b
.
The subtraction discussed here could both be normal subtraction in an additive group or truncated
subtraction on a canonically ordered monoid (ℕ
, multiset
, part_enat
, ennreal
, ...)
Implementation details #
has_ordered_sub
is a mixin type-class, so that we can use the results in this file even in cases
where we don't have a canonically_ordered_add_monoid
instance
(even though that is our main focus). Conversely, this means we can use
canonically_ordered_add_monoid
without necessarily having to define a subtraction.
The results in this file are ordered by the type-class assumption needed to prove it. This means that similar results might not be close to each other. Furthermore, we don't prove implications if a bi-implication can be proven under the same assumptions.
Lemmas using this class are named using tsub
instead of sub
(short for "truncated subtraction").
This is to avoid naming conflicts with similar lemmas about ordered groups.
We provide a second version of most results that require [contravariant_class α α (+) (≤)]
. In the
second version we replace this type-class assumption by explicit add_le_cancellable
assumptions.
TODO: maybe we should make a multiplicative version of this, so that we can replace some identical
lemmas about subtraction/division in ordered_[add_]comm_group
with these.
TODO: generalize nat.le_of_le_of_sub_le_sub_right
, nat.sub_le_sub_right_iff
,
nat.mul_self_sub_mul_self_eq
has_ordered_sub α
means that α
has a subtraction characterized by a - b ≤ c ↔ a ≤ c + b
.
In other words, a - b
is the least c
such that a ≤ b + c
.
This is satisfied both by the subtraction in additive ordered groups and by truncated subtraction in canonically ordered monoids on many specific types.
Instances of this typeclass
See add_tsub_cancel_right
for the equality if contravariant_class α α (+) (≤)
.
Preorder #
See add_tsub_cancel_left
for the equality if contravariant_class α α (+) (≤)
.
See tsub_tsub_cancel_of_le
for the equality.
See add_tsub_assoc_of_le
for the equality.
See tsub_add_eq_add_tsub
for the equality.
See tsub_add_tsub_comm
for the equality.
See add_tsub_add_eq_tsub_left
for the equality.
See add_tsub_add_eq_tsub_right
for the equality.
Lemmas that assume that an element is add_le_cancellable
#
Lemmas where addition is order-reflecting #
Alias of the reverse direction of tsub_nonpos
.
Partial order #
Lemmas that assume that an element is add_le_cancellable
. #
Lemmas where addition is order-reflecting. #
This lemma (and some of its corollaries) also holds for ennreal
, but this proof doesn't work
for it. Maybe we should add this lemma as field to has_ordered_sub
?
Lemmas in a linearly ordered monoid. #
See lt_of_tsub_lt_tsub_right_of_le
for a weaker statement in a partial order.
See lt_tsub_iff_right_of_le
for a weaker statement in a partial order.
See lt_tsub_iff_left_of_le
for a weaker statement in a partial order.
See lt_of_tsub_lt_tsub_left_of_le
for a weaker statement in a partial order.