@@ -216,7 +216,7 @@ section preorder
216
216
variables [preorder α]
217
217
218
218
section preorder
219
- variables [preorder β] {f : α → β} {a b : α}
219
+ variables [preorder β] {f : α → β} {s : set α} { a b : α}
220
220
221
221
/-!
222
222
These four lemmas are there to strip off the semi-implicit arguments `⦃a b : α⦄`. This is useful
@@ -235,10 +235,10 @@ protected lemma monotone.monotone_on (hf : monotone f) (s : set α) : monotone_o
235
235
protected lemma antitone.antitone_on (hf : antitone f) (s : set α) : antitone_on f s :=
236
236
λ a _ b _, hf.imp
237
237
238
- lemma monotone_on_univ : monotone_on f set.univ ↔ monotone f :=
238
+ @[simp] lemma monotone_on_univ : monotone_on f set.univ ↔ monotone f :=
239
239
⟨λ h a b, h trivial trivial, λ h, h.monotone_on _⟩
240
240
241
- lemma antitone_on_univ : antitone_on f set.univ ↔ antitone f :=
241
+ @[simp] lemma antitone_on_univ : antitone_on f set.univ ↔ antitone f :=
242
242
⟨λ h a b, h trivial trivial, λ h, h.antitone_on _⟩
243
243
244
244
protected lemma strict_mono.strict_mono_on (hf : strict_mono f) (s : set α) : strict_mono_on f s :=
@@ -247,10 +247,10 @@ protected lemma strict_mono.strict_mono_on (hf : strict_mono f) (s : set α) : s
247
247
protected lemma strict_anti.strict_anti_on (hf : strict_anti f) (s : set α) : strict_anti_on f s :=
248
248
λ a _ b _, hf.imp
249
249
250
- lemma strict_mono_on_univ : strict_mono_on f set.univ ↔ strict_mono f :=
250
+ @[simp] lemma strict_mono_on_univ : strict_mono_on f set.univ ↔ strict_mono f :=
251
251
⟨λ h a b, h trivial trivial, λ h, h.strict_mono_on _⟩
252
252
253
- lemma strict_anti_on_univ : strict_anti_on f set.univ ↔ strict_anti f :=
253
+ @[simp] lemma strict_anti_on_univ : strict_anti_on f set.univ ↔ strict_anti f :=
254
254
⟨λ h a b, h trivial trivial, λ h, h.strict_anti_on _⟩
255
255
256
256
end preorder
@@ -644,12 +644,55 @@ lemma antitone.strict_anti_iff_injective (hf : antitone f) :
644
644
645
645
end partial_order
646
646
647
+ variables [linear_order β] {f : α → β} {s : set α} {x y : α}
648
+
649
+ /-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
650
+ downright. -/
651
+ lemma not_monotone_not_antitone_iff_exists_le_le :
652
+ ¬ monotone f ∧ ¬ antitone f ↔ ∃ a b c, a ≤ b ∧ b ≤ c ∧
653
+ (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) :=
654
+ begin
655
+ simp_rw [monotone, antitone, not_forall, not_le],
656
+ refine iff.symm ⟨_, _⟩,
657
+ { rintro ⟨a, b, c, hab, hbc, ⟨hfab, hfcb⟩ | ⟨hfba, hfbc⟩⟩,
658
+ exacts [⟨⟨_, _, hbc, hfcb⟩, _, _, hab, hfab⟩, ⟨⟨_, _, hab, hfba⟩, _, _, hbc, hfbc⟩] },
659
+ rintro ⟨⟨a, b, hab, hfba⟩, c, d, hcd, hfcd⟩,
660
+ obtain hda | had := le_total d a,
661
+ { obtain hfad | hfda := le_total (f a) (f d),
662
+ { exact ⟨c, d, b, hcd, hda.trans hab, or.inl ⟨hfcd, hfba.trans_le hfad⟩⟩ },
663
+ { exact ⟨c, a, b, hcd.trans hda, hab, or.inl ⟨hfcd.trans_le hfda, hfba⟩⟩ } },
664
+ obtain hac | hca := le_total a c,
665
+ { obtain hfdb | hfbd := le_or_lt (f d) (f b),
666
+ { exact ⟨a, c, d, hac, hcd, or.inr ⟨hfcd.trans $ hfdb.trans_lt hfba, hfcd⟩⟩ },
667
+ obtain hfca | hfac := lt_or_le (f c) (f a),
668
+ { exact ⟨a, c, d, hac, hcd, or.inr ⟨hfca, hfcd⟩⟩ },
669
+ obtain hbd | hdb := le_total b d,
670
+ { exact ⟨a, b, d, hab, hbd, or.inr ⟨hfba, hfbd⟩⟩ },
671
+ { exact ⟨a, d, b, had, hdb, or.inl ⟨hfac.trans_lt hfcd, hfbd⟩⟩ } },
672
+ { obtain hfdb | hfbd := le_or_lt (f d) (f b),
673
+ { exact ⟨c, a, b, hca, hab, or.inl ⟨hfcd.trans $ hfdb.trans_lt hfba, hfba⟩⟩ },
674
+ obtain hfca | hfac := lt_or_le (f c) (f a),
675
+ { exact ⟨c, a, b, hca, hab, or.inl ⟨hfca, hfba⟩⟩ },
676
+ obtain hbd | hdb := le_total b d,
677
+ { exact ⟨a, b, d, hab, hbd, or.inr ⟨hfba, hfbd⟩⟩ },
678
+ { exact ⟨a, d, b, had, hdb, or.inl ⟨hfac.trans_lt hfcd, hfbd⟩⟩ } }
679
+ end
680
+
681
+ /-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
682
+ downright. -/
683
+ lemma not_monotone_not_antitone_iff_exists_lt_lt :
684
+ ¬ monotone f ∧ ¬ antitone f ↔ ∃ a b c, a < b ∧ b < c ∧
685
+ (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) :=
686
+ begin
687
+ simp_rw [not_monotone_not_antitone_iff_exists_le_le, ←and_assoc],
688
+ refine exists₃_congr (λ a b c, and_congr_left $ λ h, (ne.le_iff_lt _).and $ ne.le_iff_lt _);
689
+ rintro rfl; simpa using h,
690
+ end
691
+
647
692
/-!
648
693
### Strictly monotone functions and `cmp`
649
694
-/
650
695
651
- variables [linear_order β] {f : α → β} {s : set α} {x y : α}
652
-
653
696
lemma strict_mono_on.cmp_map_eq (hf : strict_mono_on f s) (hx : x ∈ s) (hy : y ∈ s) :
654
697
cmp (f x) (f y) = cmp x y :=
655
698
((hf.compares hx hy).2 (cmp_compares x y)).cmp_eq
0 commit comments