Ordered Subtraction #
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
, 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.
See add_tsub_cancel_right
for the equality if contravariant_class α α (+) (≤)
.
An order isomorphism between types with ordered subtraction preserves subtraction provided that it preserves addition.
See add_tsub_cancel_left
for the equality if contravariant_class α α (+) (≤)
.
See tsub_tsub_cancel_of_le
for the equality.
Alias of tsub_nonpos
.
See add_tsub_assoc_of_le
for the equality.
Lemmas that assume that an element is add_le_cancellable
. #
Lemmas where addition is order-reflecting. #
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.
Lemmas in a canonically ordered monoid. #
See lt_of_tsub_lt_tsub_right
for a stronger statement in a linear order.
One direction of tsub_eq_zero_iff_le
, as a @[simp]
-lemma.
Lemmas that assume that an element is add_le_cancellable
. #
Lemmas where addition is order-reflecting. #
See add_tsub_le_assoc
for an inequality.
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
?
See lt_tsub_iff_right
for a stronger statement in a linear order.
See lt_tsub_iff_left
for a stronger statement in a linear order.
See lt_of_tsub_lt_tsub_left
for a stronger statement in a linear order.
See tsub_lt_tsub_iff_left_of_le
for a stronger statement in a linear order.
See tsub_tsub_le
for an inequality.
Lemmas in a linearly canonically ordered monoid. #
See lt_tsub_iff_left_of_le_of_le
for a weaker statement in a partial order.
This lemma also holds for ennreal
, but we need a different proof for that.
See lt_tsub_iff_left_of_le_of_le
for a weaker statement in a partial order.
Lemmas about max
and min
. #
Equations
- with_top.has_sub = {sub := with_top.sub _inst_2}