@@ -20,34 +20,23 @@ The reason is that we did not want to change existing names in the library.
2020
2121## Remark
2222
23- No monoid is actually present in this file: all assumptions have been generalized to `has_mul` or
24- `mul_one_class`.
23+ Almost no monoid is actually present in this file: most assumptions have been generalized to
24+ `has_mul` or ` mul_one_class`.
2525
2626-/
2727
2828-- TODO: If possible, uniformize lemma names, taking special care of `'`,
2929-- after the `ordered`-refactor is done.
3030
31+ open function
32+
3133variables {α : Type *}
3234section has_mul
3335variables [has_mul α]
3436
3537section has_le
3638variables [has_le α]
3739
38- @[simp, to_additive]
39- lemma mul_le_mul_iff_left [covariant_class α α (*) (≤)] [contravariant_class α α (*) (≤)]
40- (a : α) {b c : α} :
41- a * b ≤ a * c ↔ b ≤ c :=
42- rel_iff_cov α α (*) (≤) a
43-
44- @[simp, to_additive]
45- lemma mul_le_mul_iff_right
46- [covariant_class α α (function.swap (*)) (≤)] [contravariant_class α α (function.swap (*)) (≤)]
47- (a : α) {b c : α} :
48- b * a ≤ c * a ↔ b ≤ c :=
49- rel_iff_cov α α (function.swap (*)) (≤) a
50-
5140/- The prime on this lemma is present only on the multiplicative version. The unprimed version
5241is taken by the analogous lemma for semiring, with an extra non-negativity assumption. -/
5342@[to_additive add_le_add_left]
@@ -75,6 +64,19 @@ lemma le_of_mul_le_mul_right' [contravariant_class α α (function.swap (*)) (
7564 b ≤ c :=
7665contravariant_class.elim a bc
7766
67+ @[simp, to_additive]
68+ lemma mul_le_mul_iff_left [covariant_class α α (*) (≤)] [contravariant_class α α (*) (≤)]
69+ (a : α) {b c : α} :
70+ a * b ≤ a * c ↔ b ≤ c :=
71+ rel_iff_cov α α (*) (≤) a
72+
73+ @[simp, to_additive]
74+ lemma mul_le_mul_iff_right
75+ [covariant_class α α (function.swap (*)) (≤)] [contravariant_class α α (function.swap (*)) (≤)]
76+ (a : α) {b c : α} :
77+ b * a ≤ c * a ↔ b ≤ c :=
78+ rel_iff_cov α α (function.swap (*)) (≤) a
79+
7880end has_le
7981
8082section has_lt
@@ -361,6 +363,17 @@ calc a * b ≤ a * 1 : mul_le_mul_left' h a
361363
362364end mul_one_class
363365
366+ @[to_additive]
367+ lemma mul_left_cancel'' [semigroup α] [partial_order α]
368+ [contravariant_class α α (*) (≤)] {a b c : α} (h : a * b = a * c) : b = c :=
369+ (le_of_mul_le_mul_left' h.le).antisymm (le_of_mul_le_mul_left' h.ge)
370+
371+ @[to_additive]
372+ lemma mul_right_cancel'' [semigroup α] [partial_order α]
373+ [contravariant_class α α (function.swap (*)) (≤)] {a b c : α} (h : a * b = c * b) :
374+ a = c :=
375+ le_antisymm (le_of_mul_le_mul_right' h.le) (le_of_mul_le_mul_right' h.ge)
376+
364377/- This is not instance, since we want to have an instance from `left_cancel_semigroup`s
365378to the appropriate `covariant_class`. -/
366379/-- A semigroup with a partial order and satisfying `left_cancel_semigroup`
@@ -369,10 +382,9 @@ to the appropriate `covariant_class`. -/
369382" An additive semigroup with a partial order and satisfying `left_cancel_add_semigroup`
370383(i.e. `c + a < c + b → a < b`) is a `left_cancel add_semigroup`." ]
371384def contravariant.to_left_cancel_semigroup [semigroup α] [partial_order α]
372- [contravariant_class α α ((*) : α → α → α ) (≤)] :
385+ [contravariant_class α α (* ) (≤)] :
373386 left_cancel_semigroup α :=
374- { mul_left_cancel := λ a b c bc,
375- (le_of_mul_le_mul_left' bc.le).antisymm (le_of_mul_le_mul_left' bc.ge),
387+ { mul_left_cancel := λ a b c, mul_left_cancel''
376388 ..‹semigroup α› }
377389
378390/- This is not instance, since we want to have an instance from `right_cancel_semigroup`s
@@ -383,10 +395,9 @@ to the appropriate `covariant_class`. -/
383395" An additive semigroup with a partial order and satisfying `right_cancel_add_semigroup`
384396(`a + c < b + c → a < b`) is a `right_cancel add_semigroup`." ]
385397def contravariant.to_right_cancel_semigroup [semigroup α] [partial_order α]
386- [contravariant_class α α (function.swap (*) : α → α → α ) (≤)] :
398+ [contravariant_class α α (function.swap (*)) (≤)] :
387399 right_cancel_semigroup α :=
388- { mul_right_cancel := λ a b c bc,
389- le_antisymm (le_of_mul_le_mul_right' bc.le) (le_of_mul_le_mul_right' bc.ge)
400+ { mul_right_cancel := λ a b c, mul_right_cancel''
390401 ..‹semigroup α› }
391402
392403variables {a b c d : α}
@@ -740,3 +751,78 @@ lemma strict_mono.mul_monotone' (hf : strict_mono f) (hg : monotone g) :
740751λ x y h, mul_lt_mul_of_lt_of_le (hf h) (hg h.le)
741752
742753end strict_mono
754+
755+ /--
756+ An element `a : α` is `mul_le_cancellable` if `x ↦ a * x` is order-reflecting.
757+ We will make a separate version of many lemmas that require `[contravariant_class α α (*) (≤)]` with
758+ `mul_le_cancellable` assumptions instead. These lemmas can then be instantiated to specific types,
759+ like `ennreal`, where we can replace the assumption `add_le_cancellable x` by `x ≠ ∞`.
760+ -/
761+ @[to_additive /-" An element `a : α` is `add_le_cancellable` if `x ↦ a + x` is order-reflecting.
762+ We will make a separate version of many lemmas that require `[contravariant_class α α (+) (≤)]` with
763+ `mul_le_cancellable` assumptions instead. These lemmas can then be instantiated to specific types,
764+ like `ennreal`, where we can replace the assumption `add_le_cancellable x` by `x ≠ ∞`. "-/
765+ ]
766+ def mul_le_cancellable [has_mul α] [has_le α] (a : α) : Prop :=
767+ ∀ ⦃b c⦄, a * b ≤ a * c → b ≤ c
768+
769+ @[to_additive]
770+ lemma contravariant.mul_le_cancellable [has_mul α] [has_le α] [contravariant_class α α (*) (≤)]
771+ {a : α} : mul_le_cancellable a :=
772+ λ b c, le_of_mul_le_mul_left'
773+
774+ namespace mul_le_cancellable
775+
776+ @[to_additive]
777+ protected lemma injective [has_mul α] [partial_order α] {a : α} (ha : mul_le_cancellable a) :
778+ injective ((*) a) :=
779+ λ b c h, le_antisymm (ha h.le) (ha h.ge)
780+
781+ @[to_additive]
782+ protected lemma inj [has_mul α] [partial_order α] {a b c : α} (ha : mul_le_cancellable a) :
783+ a * b = a * c ↔ b = c :=
784+ ha.injective.eq_iff
785+
786+ @[to_additive]
787+ protected lemma injective_left [comm_semigroup α] [partial_order α] {a : α}
788+ (ha : mul_le_cancellable a) : injective (* a) :=
789+ λ b c h, ha.injective $ by rwa [mul_comm a, mul_comm a]
790+
791+ @[to_additive]
792+ protected lemma inj_left [comm_semigroup α] [partial_order α] {a b c : α}
793+ (hc : mul_le_cancellable c) : a * c = b * c ↔ a = b :=
794+ hc.injective_left.eq_iff
795+
796+ variable [has_le α]
797+
798+ @[to_additive]
799+ protected lemma mul_le_mul_iff_left [has_mul α] [covariant_class α α (*) (≤)]
800+ {a b c : α} (ha : mul_le_cancellable a) : a * b ≤ a * c ↔ b ≤ c :=
801+ ⟨λ h, ha h, λ h, mul_le_mul_left' h a⟩
802+
803+ @[to_additive]
804+ protected lemma mul_le_mul_iff_right [comm_semigroup α] [covariant_class α α (*) (≤)]
805+ {a b c : α} (ha : mul_le_cancellable a) : b * a ≤ c * a ↔ b ≤ c :=
806+ by rw [mul_comm b, mul_comm c, ha.mul_le_mul_iff_left]
807+
808+ @[to_additive]
809+ protected lemma le_mul_iff_one_le_right [mul_one_class α] [covariant_class α α (*) (≤)]
810+ {a b : α} (ha : mul_le_cancellable a) : a ≤ a * b ↔ 1 ≤ b :=
811+ iff.trans (by rw [mul_one]) ha.mul_le_mul_iff_left
812+
813+ @[to_additive]
814+ protected lemma mul_le_iff_le_one_right [mul_one_class α] [covariant_class α α (*) (≤)]
815+ {a b : α} (ha : mul_le_cancellable a) : a * b ≤ a ↔ b ≤ 1 :=
816+ iff.trans (by rw [mul_one]) ha.mul_le_mul_iff_left
817+
818+ @[to_additive]
819+ protected lemma le_mul_iff_one_le_left [comm_monoid α] [covariant_class α α (*) (≤)]
820+ {a b : α} (ha : mul_le_cancellable a) : a ≤ b * a ↔ 1 ≤ b :=
821+ by rw [mul_comm, ha.le_mul_iff_one_le_right]
822+
823+ @[to_additive]
824+ protected lemma mul_le_iff_le_one_left [comm_monoid α] [covariant_class α α (*) (≤)]
825+ {a b : α} (ha : mul_le_cancellable a) : b * a ≤ a ↔ b ≤ 1 :=
826+ by rw [mul_comm, ha.mul_le_iff_le_one_right]
827+
828+ end mul_le_cancellable
0 commit comments