Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit bf83c30

Browse files
committed
chore(algebra/{ordered_monoid_lemmas, ordered_monoid}): move two sections close together (#7921)
This PR aims at shortening the diff between `master` and PR #7645 of the order refactor. I moved the `mono` section of `algebra/ordered_monoid_lemmas` to the end of the file and appended the `strict_mono` section of `algebra/ordered_monoid` after that. Note: the hypotheses are not optimal, but, with the current `instances` in this version, I did not know how to improve this. It will get better by the time PR #7645 is merged. In fact, the next PR in the sequence, #7876, already removes the unnecessary assumptions.
1 parent d74a898 commit bf83c30

File tree

2 files changed

+63
-43
lines changed

2 files changed

+63
-43
lines changed

src/algebra/ordered_monoid.lean

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -709,32 +709,6 @@ def function.injective.ordered_cancel_comm_monoid {β : Type*}
709709
..hf.left_cancel_semigroup f mul,
710710
..hf.ordered_comm_monoid f one mul }
711711

712-
section mono
713-
714-
variables {β : Type*} [preorder β] {f g : β → α}
715-
716-
@[to_additive monotone.add_strict_mono]
717-
lemma monotone.mul_strict_mono' (hf : monotone f) (hg : strict_mono g) :
718-
strict_mono (λ x, f x * g x) :=
719-
λ x y h, mul_lt_mul_of_le_of_lt (hf $ le_of_lt h) (hg h)
720-
721-
@[to_additive strict_mono.add_monotone]
722-
lemma strict_mono.mul_monotone' (hf : strict_mono f) (hg : monotone g) :
723-
strict_mono (λ x, f x * g x) :=
724-
λ x y h, mul_lt_mul_of_lt_of_le (hf h) (hg $ le_of_lt h)
725-
726-
@[to_additive strict_mono.add_const]
727-
lemma strict_mono.mul_const' (hf : strict_mono f) (c : α) :
728-
strict_mono (λ x, f x * c) :=
729-
hf.mul_monotone' monotone_const
730-
731-
@[to_additive strict_mono.const_add]
732-
lemma strict_mono.const_mul' (hf : strict_mono f) (c : α) :
733-
strict_mono (λ x, c * f x) :=
734-
monotone_const.mul_strict_mono' hf
735-
736-
end mono
737-
738712
end ordered_cancel_comm_monoid
739713

740714
section ordered_cancel_add_comm_monoid

src/algebra/ordered_monoid_lemmas.lean

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -309,23 +309,6 @@ iff.intro
309309
and.intro ‹a = 1› ‹b = 1›)
310310
(assume ⟨ha', hb'⟩, by rw [ha', hb', mul_one])
311311

312-
section mono
313-
variables {β : Type*} [preorder β] {f g : β → α}
314-
315-
@[to_additive monotone.add]
316-
lemma monotone.mul' (hf : monotone f) (hg : monotone g) : monotone (λ x, f x * g x) :=
317-
λ x y h, mul_le_mul' (hf h) (hg h)
318-
319-
@[to_additive monotone.add_const]
320-
lemma monotone.mul_const' (hf : monotone f) (a : α) : monotone (λ x, f x * a) :=
321-
hf.mul' monotone_const
322-
323-
@[to_additive monotone.const_add]
324-
lemma monotone.const_mul' (hf : monotone f) (a : α) : monotone (λ x, a * f x) :=
325-
monotone_const.mul' hf
326-
327-
end mono
328-
329312
end partial_order
330313

331314
@[to_additive le_of_add_le_add_left]
@@ -350,6 +333,7 @@ begin
350333
{ exact (lt_of_mul_lt_mul_right' h).le }
351334
end
352335

336+
section partial_order
353337
variable [partial_order α]
354338

355339
section left_co_co
@@ -546,3 +530,65 @@ one_mul c ▸ mul_lt_mul''' ha hbc
546530
@[to_additive]
547531
lemma mul_lt_of_lt_of_lt_one (hbc : b < c) (ha : a < 1) : b * a < c :=
548532
mul_one c ▸ mul_lt_mul''' hbc ha
533+
534+
end partial_order
535+
536+
-- the two sections `mono` and `strict_mono` moved here to shorten the diff of a later
537+
-- PR. The layout will be better in the next PR!
538+
section mono
539+
variables {β : Type*} [preorder β] {f g : β → α}
540+
variables [mul_one_class α] [partial_order α] [covariant_class α α has_mul.mul has_le.le]
541+
[covariant_class α α (function.swap has_mul.mul) has_le.le]
542+
@[to_additive monotone.add]
543+
lemma monotone.mul' (hf : monotone f) (hg : monotone g) : monotone (λ x, f x * g x) :=
544+
λ x y h, mul_le_mul' (hf h) (hg h)
545+
546+
@[to_additive monotone.add_const]
547+
lemma monotone.mul_const' (hf : monotone f) (a : α) : monotone (λ x, f x * a) :=
548+
hf.mul' monotone_const
549+
550+
@[to_additive monotone.const_add]
551+
lemma monotone.const_mul' (hf : monotone f) (a : α) : monotone (λ x, a * f x) :=
552+
monotone_const.mul' hf
553+
554+
end mono
555+
556+
section strict_mono
557+
variables [cancel_monoid α] {β : Type*} {f g : β → α} [partial_order α]
558+
559+
section left
560+
variables [covariant_class α α (*) (≤)] [contravariant_class α α (*) (<)] [partial_order β]
561+
562+
@[to_additive strict_mono.const_add]
563+
lemma strict_mono.const_mul' (hf : strict_mono f) (c : α) :
564+
strict_mono (λ x, c * f x) :=
565+
λ a b ab, mul_lt_mul_left' (hf ab) c
566+
567+
end left
568+
569+
section right
570+
variables [covariant_class α α (function.swap (*)) (≤)]
571+
[contravariant_class α α (function.swap (*)) (<)] [partial_order β]
572+
573+
@[to_additive strict_mono.add_const]
574+
lemma strict_mono.mul_const' (hf : strict_mono f) (c : α) :
575+
strict_mono (λ x, f x * c) :=
576+
λ a b ab, mul_lt_mul_right' (hf ab) c
577+
578+
end right
579+
580+
@[to_additive monotone.add_strict_mono]
581+
lemma monotone.mul_strict_mono'
582+
[covariant_class α α (function.swap (*)) (≤)] {β : Type*} [preorder β]
583+
[covariant_class α α (*) (≤)] [contravariant_class α α (*) (<)]
584+
{f g : β → α} (hf : monotone f) (hg : strict_mono g) :
585+
strict_mono (λ x, f x * g x) :=
586+
λ x y h, mul_lt_mul_of_le_of_lt (hf h.le) (hg h)
587+
variables [covariant_class α α (*) (≤)] [covariant_class α α (function.swap (*)) (≤)] [preorder β]
588+
589+
@[to_additive strict_mono.add_monotone]
590+
lemma strict_mono.mul_monotone' (hf : strict_mono f) (hg : monotone g) :
591+
strict_mono (λ x, f x * g x) :=
592+
λ x y h, mul_lt_mul_of_lt_of_le (hf h) (hg h.le)
593+
594+
end strict_mono

0 commit comments

Comments
 (0)