Ordered Subtraction #
This file proves lemmas relating (truncated) subtraction with an order. We provide a class
OrderedSub
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
, PartENat
, ENNReal
, ...)
Implementation details #
OrderedSub
is a mixin type-class, so that we can use the results in this file even in cases
where we don't have a CanonicallyOrderedAddMonoid
instance
(even though that is our main focus). Conversely, this means we can use
CanonicallyOrderedAddMonoid
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 [ContravariantClass α α (+) (≤)]
. In the
second version we replace this type-class assumption by explicit AddLECancellable
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]CommGroup
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
a - b
provides a lower bound onc
such thata ≤ c + b
.
OrderedSub α
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
See add_tsub_cancel_right
for the equality if ContravariantClass α α (+) (≤)
.
Preorder #
See add_tsub_cancel_left
for the equality if ContravariantClass α α (+) (≤)
.
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 AddLECancellable
#
Lemmas where addition is order-reflecting #
Alias of the reverse direction of tsub_nonpos
.
Partial order #
Lemmas that assume that an element is AddLECancellable
. #
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 OrderedSub
?
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.