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

Commit dad7ecf

Browse files
committed
feat(analysis/convex/quasiconvex): A quasilinear function is either monotone or antitone (#17801)
Fulfill a todo I left a year ago. The proof is a big case bash on the relative positions of the four variables. I minimised it as much as I could. The end result mentions convexity, but this is mostly order theory.
1 parent d4ebdc8 commit dad7ecf

File tree

5 files changed

+124
-18
lines changed

5 files changed

+124
-18
lines changed

src/analysis/convex/quasiconvex.lean

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ quasiconcavity, and monotonicity implies quasilinearity.
2121
* `quasilinear_on 𝕜 s f`: Quasilinearity of the function `f` on the set `s` with scalars `𝕜`. This
2222
means that `f` is both quasiconvex and quasiconcave.
2323
24-
## TODO
25-
26-
Prove that a quasilinear function between two linear orders is either monotone or antitone. This is
27-
not hard but quite a pain to go about as there are many cases to consider.
28-
2924
## References
3025
3126
* https://en.wikipedia.org/wiki/Quasiconvex_function
@@ -196,3 +191,21 @@ lemma antitone.quasilinear_on (hf : antitone f) : quasilinear_on 𝕜 univ f :=
196191

197192
end linear_ordered_add_comm_monoid
198193
end ordered_semiring
194+
195+
section linear_ordered_field
196+
variables [linear_ordered_field 𝕜] [linear_ordered_add_comm_monoid β] {s : set 𝕜} {f : 𝕜 → β}
197+
198+
lemma quasilinear_on.monotone_on_or_antitone_on (hf : quasilinear_on 𝕜 s f) :
199+
monotone_on f s ∨ antitone_on f s :=
200+
begin
201+
simp_rw [monotone_on_or_antitone_on_iff_interval, ←segment_eq_interval],
202+
rintro a ha b hb c hc h,
203+
refine ⟨((hf.2 _).segment_subset _ _ h).2, ((hf.1 _).segment_subset _ _ h).2⟩; simp [*],
204+
end
205+
206+
lemma quasilinear_on_iff_monotone_on_or_antitone_on (hs : convex 𝕜 s) :
207+
quasilinear_on 𝕜 s f ↔ monotone_on f s ∨ antitone_on f s :=
208+
⟨λ h, h.monotone_on_or_antitone_on,
209+
λ h, h.elim (λ h, h.quasilinear_on hs) (λ h, h.quasilinear_on hs)⟩
210+
211+
end linear_ordered_field

src/data/set/basic.lean

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2033,8 +2033,21 @@ theorem univ_eq_true_false : univ = ({true, false} : set Prop) :=
20332033
eq.symm $ eq_univ_of_forall $ classical.cases (by simp) (by simp)
20342034

20352035
section preorder
2036+
variables [preorder α] [preorder β] {f : α → β}
20362037

2037-
variables [preorder α] [preorder β] (f : α → β)
2038+
lemma monotone_on_iff_monotone : monotone_on f s ↔ monotone (λ a : s, f a) :=
2039+
by simp [monotone, monotone_on]
2040+
2041+
lemma antitone_on_iff_antitone : antitone_on f s ↔ antitone (λ a : s, f a) :=
2042+
by simp [antitone, antitone_on]
2043+
2044+
lemma strict_mono_on_iff_strict_mono : strict_mono_on f s ↔ strict_mono (λ a : s, f a) :=
2045+
by simp [strict_mono, strict_mono_on]
2046+
2047+
lemma strict_anti_on_iff_strict_anti : strict_anti_on f s ↔ strict_anti (λ a : s, f a) :=
2048+
by simp [strict_anti, strict_anti_on]
2049+
2050+
variables (f)
20382051

20392052
/-! ### Monotonicity on singletons -/
20402053

@@ -2068,6 +2081,27 @@ subsingleton_singleton.strict_anti_on f
20682081

20692082
end preorder
20702083

2084+
section linear_order
2085+
variables [linear_order α] [linear_order β] {f : α → β}
2086+
2087+
/-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
2088+
downright. -/
2089+
lemma not_monotone_on_not_antitone_on_iff_exists_le_le :
2090+
¬ monotone_on f s ∧ ¬ antitone_on f s ↔ ∃ a b c ∈ s, a ≤ b ∧ b ≤ c ∧
2091+
(f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) :=
2092+
by simp [monotone_on_iff_monotone, antitone_on_iff_antitone, and_assoc, exists_and_distrib_left,
2093+
not_monotone_not_antitone_iff_exists_le_le, @and.left_comm (_ ∈ s)]
2094+
2095+
/-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
2096+
downright. -/
2097+
lemma not_monotone_on_not_antitone_on_iff_exists_lt_lt :
2098+
¬ monotone_on f s ∧ ¬ antitone_on f s ↔ ∃ a b c ∈ s, a < b ∧ b < c ∧
2099+
(f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) :=
2100+
by simp [monotone_on_iff_monotone, antitone_on_iff_antitone, and_assoc, exists_and_distrib_left,
2101+
not_monotone_not_antitone_iff_exists_lt_lt, @and.left_comm (_ ∈ s)]
2102+
2103+
end linear_order
2104+
20712105
/-! ### Lemmas about range of a function. -/
20722106
section range
20732107
variables {f : ι → α}

src/data/set/intervals/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ end both
12191219
end lattice
12201220

12211221
section linear_order
1222-
variables [linear_order α] {a a₁ a₂ b b₁ b₂ c d : α}
1222+
variables [linear_order α] [linear_order β] {f : α → β} {a a₁ a₂ b b₁ b₂ c d : α}
12231223

12241224
@[simp] lemma Ioi_inter_Ioi : Ioi a ∩ Ioi b = Ioi (a ⊔ b) := ext $ λ _, sup_lt_iff.symm
12251225
@[simp] lemma Iio_inter_Iio : Iio a ∩ Iio b = Iio (a ⊓ b) := ext $ λ _, lt_inf_iff.symm

src/data/set/intervals/unordered_interval.lean

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ make the notation available.
2525
2626
-/
2727

28-
universe u
29-
3028
open function order_dual (to_dual of_dual)
3129

3230
namespace set
3331

3432
section linear_order
35-
36-
variables {α : Type u} [linear_order α] {a a₁ a₂ b b₁ b₂ c x : α}
33+
variables {α β : Type*} [linear_order α] [linear_order β] {f : α → β} {s : set α}
34+
{a a₁ a₂ b b₁ b₂ c x : α}
3735

3836
/-- `interval a b` is the set of elements lying between `a` and `b`, with `a` and `b` included. -/
3937
def interval (a b : α) := Icc (min a b) (max a b)
@@ -140,6 +138,24 @@ begin
140138
{ rintro ⟨a, b, h⟩, exact ⟨min a b, max a b, h⟩ }
141139
end
142140

141+
lemma monotone_or_antitone_iff_interval :
142+
monotone f ∨ antitone f ↔ ∀ a b c, c ∈ [a, b] → f c ∈ [f a, f b] :=
143+
begin
144+
split,
145+
{ rintro (hf | hf) a b c; simp_rw [interval, ←hf.map_min, ←hf.map_max],
146+
exacts [λ hc, ⟨hf hc.1, hf hc.2⟩, λ hc, ⟨hf hc.2, hf hc.1⟩] },
147+
contrapose!,
148+
rw not_monotone_not_antitone_iff_exists_le_le,
149+
rintro ⟨a, b, c, hab, hbc, ⟨hfab, hfcb⟩ | ⟨hfba, hfbc⟩⟩,
150+
{ exact ⟨a, c, b, Icc_subset_interval ⟨hab, hbc⟩, λ h, h.2.not_lt $ max_lt hfab hfcb⟩ },
151+
{ exact ⟨a, c, b, Icc_subset_interval ⟨hab, hbc⟩, λ h, h.1.not_lt $ lt_min hfba hfbc⟩ }
152+
end
153+
154+
lemma monotone_on_or_antitone_on_iff_interval :
155+
monotone_on f s ∨ antitone_on f s ↔ ∀ a b c ∈ s, c ∈ [a, b] → f c ∈ [f a, f b] :=
156+
by simp [monotone_on_iff_monotone, antitone_on_iff_antitone, monotone_or_antitone_iff_interval,
157+
mem_interval]
158+
143159
/-- The open-closed interval with unordered bounds. -/
144160
def interval_oc : α → α → set α := λ a b, Ioc (min a b) (max a b)
145161

src/order/monotone.lean

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ section preorder
216216
variables [preorder α]
217217

218218
section preorder
219-
variables [preorder β] {f : α → β} {a b : α}
219+
variables [preorder β] {f : α → β} {s : set α} {a b : α}
220220

221221
/-!
222222
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
235235
protected lemma antitone.antitone_on (hf : antitone f) (s : set α) : antitone_on f s :=
236236
λ a _ b _, hf.imp
237237

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 :=
239239
⟨λ h a b, h trivial trivial, λ h, h.monotone_on _⟩
240240

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 :=
242242
⟨λ h a b, h trivial trivial, λ h, h.antitone_on _⟩
243243

244244
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
247247
protected lemma strict_anti.strict_anti_on (hf : strict_anti f) (s : set α) : strict_anti_on f s :=
248248
λ a _ b _, hf.imp
249249

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 :=
251251
⟨λ h a b, h trivial trivial, λ h, h.strict_mono_on _⟩
252252

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 :=
254254
⟨λ h a b, h trivial trivial, λ h, h.strict_anti_on _⟩
255255

256256
end preorder
@@ -644,12 +644,55 @@ lemma antitone.strict_anti_iff_injective (hf : antitone f) :
644644

645645
end partial_order
646646

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+
647692
/-!
648693
### Strictly monotone functions and `cmp`
649694
-/
650695

651-
variables [linear_order β] {f : α → β} {s : set α} {x y : α}
652-
653696
lemma strict_mono_on.cmp_map_eq (hf : strict_mono_on f s) (hx : x ∈ s) (hy : y ∈ s) :
654697
cmp (f x) (f y) = cmp x y :=
655698
((hf.compares hx hy).2 (cmp_compares x y)).cmp_eq

0 commit comments

Comments
 (0)