Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2021 YaΓ«l Dillies. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: YaΓ«l Dillies | |
-/ | |
import analysis.convex.function | |
/-! | |
# Quasiconvex and quasiconcave functions | |
This file defines quasiconvexity, quasiconcavity and quasilinearity of functions, which are | |
generalizations of unimodality and monotonicity. Convexity implies quasiconvexity, concavity implies | |
quasiconcavity, and monotonicity implies quasilinearity. | |
## Main declarations | |
* `quasiconvex_on π s f`: Quasiconvexity of the function `f` on the set `s` with scalars `π`. This | |
means that, for all `r`, `{x β s | f x β€ r}` is `π`-convex. | |
* `quasiconcave_on π s f`: Quasiconcavity of the function `f` on the set `s` with scalars `π`. This | |
means that, for all `r`, `{x β s | r β€ f x}` is `π`-convex. | |
* `quasilinear_on π s f`: Quasilinearity of the function `f` on the set `s` with scalars `π`. This | |
means that `f` is both quasiconvex and quasiconcave. | |
## TODO | |
Prove that a quasilinear function between two linear orders is either monotone or antitone. This is | |
not hard but quite a pain to go about as there are many cases to consider. | |
## References | |
* https://en.wikipedia.org/wiki/Quasiconvex_function | |
-/ | |
open function order_dual set | |
variables {π E F Ξ² : Type*} | |
section ordered_semiring | |
variables [ordered_semiring π] | |
section add_comm_monoid | |
variables [add_comm_monoid E] [add_comm_monoid F] | |
section ordered_add_comm_monoid | |
variables (π) [ordered_add_comm_monoid Ξ²] [has_smul π E] (s : set E) (f : E β Ξ²) | |
/-- A function is quasiconvex if all its sublevels are convex. | |
This means that, for all `r`, `{x β s | f x β€ r}` is `π`-convex. -/ | |
def quasiconvex_on : Prop := | |
β r, convex π {x β s | f x β€ r} | |
/-- A function is quasiconcave if all its superlevels are convex. | |
This means that, for all `r`, `{x β s | r β€ f x}` is `π`-convex. -/ | |
def quasiconcave_on : Prop := | |
β r, convex π {x β s | r β€ f x} | |
/-- A function is quasilinear if it is both quasiconvex and quasiconcave. | |
This means that, for all `r`, | |
the sets `{x β s | f x β€ r}` and `{x β s | r β€ f x}` are `π`-convex. -/ | |
def quasilinear_on : Prop := | |
quasiconvex_on π s f β§ quasiconcave_on π s f | |
variables {π s f} | |
lemma quasiconvex_on.dual : quasiconvex_on π s f β quasiconcave_on π s (to_dual β f) := id | |
lemma quasiconcave_on.dual : quasiconcave_on π s f β quasiconvex_on π s (to_dual β f) := id | |
lemma quasilinear_on.dual : quasilinear_on π s f β quasilinear_on π s (to_dual β f) := and.swap | |
lemma convex.quasiconvex_on_of_convex_le (hs : convex π s) (h : β r, convex π {x | f x β€ r}) : | |
quasiconvex_on π s f := | |
Ξ» r, hs.inter (h r) | |
lemma convex.quasiconcave_on_of_convex_ge (hs : convex π s) (h : β r, convex π {x | r β€ f x}) : | |
quasiconcave_on π s f := | |
@convex.quasiconvex_on_of_convex_le π E Ξ²α΅α΅ _ _ _ _ _ _ hs h | |
lemma quasiconvex_on.convex [is_directed Ξ² (β€)] (hf : quasiconvex_on π s f) : convex π s := | |
Ξ» x y hx hy a b ha hb hab, | |
let β¨z, hxz, hyzβ© := exists_ge_ge (f x) (f y) in (hf _ β¨hx, hxzβ© β¨hy, hyzβ© ha hb hab).1 | |
lemma quasiconcave_on.convex [is_directed Ξ² (β₯)] (hf : quasiconcave_on π s f) : convex π s := | |
hf.dual.convex | |
end ordered_add_comm_monoid | |
section linear_ordered_add_comm_monoid | |
variables [linear_ordered_add_comm_monoid Ξ²] | |
section has_smul | |
variables [has_smul π E] {s : set E} {f g : E β Ξ²} | |
lemma quasiconvex_on.sup (hf : quasiconvex_on π s f) (hg : quasiconvex_on π s g) : | |
quasiconvex_on π s (f β g) := | |
begin | |
intro r, | |
simp_rw [pi.sup_def, sup_le_iff, βset.sep_inter_sep], | |
exact (hf r).inter (hg r), | |
end | |
lemma quasiconcave_on.inf (hf : quasiconcave_on π s f) (hg : quasiconcave_on π s g) : | |
quasiconcave_on π s (f β g) := | |
hf.dual.sup hg | |
lemma quasiconvex_on_iff_le_max : | |
quasiconvex_on π s f β convex π s β§ | |
β β¦x y : Eβ¦, x β s β y β s β β β¦a b : πβ¦, 0 β€ a β 0 β€ b β a + b = 1 β | |
f (a β’ x + b β’ y) β€ max (f x) (f y) := | |
β¨Ξ» hf, β¨hf.convex, Ξ» x y hx hy a b ha hb hab, | |
(hf _ β¨hx, le_max_left _ _β© β¨hy, le_max_right _ _β© ha hb hab).2β©, | |
Ξ» hf r x y hx hy a b ha hb hab, | |
β¨hf.1 hx.1 hy.1 ha hb hab, (hf.2 hx.1 hy.1 ha hb hab).trans $ max_le hx.2 hy.2β©β© | |
lemma quasiconcave_on_iff_min_le : | |
quasiconcave_on π s f β convex π s β§ | |
β β¦x y : Eβ¦, x β s β y β s β β β¦a b : πβ¦, 0 β€ a β 0 β€ b β a + b = 1 β | |
min (f x) (f y) β€ f (a β’ x + b β’ y) := | |
@quasiconvex_on_iff_le_max π E Ξ²α΅α΅ _ _ _ _ _ _ | |
lemma quasilinear_on_iff_mem_interval : | |
quasilinear_on π s f β convex π s β§ | |
β β¦x y : Eβ¦, x β s β y β s β β β¦a b : πβ¦, 0 β€ a β 0 β€ b β a + b = 1 β | |
f (a β’ x + b β’ y) β interval (f x) (f y) := | |
begin | |
rw [quasilinear_on, quasiconvex_on_iff_le_max, quasiconcave_on_iff_min_le, and_and_and_comm, | |
and_self], | |
apply and_congr_right', | |
simp_rw [βforall_and_distrib, interval, mem_Icc, and_comm], | |
end | |
lemma quasiconvex_on.convex_lt (hf : quasiconvex_on π s f) (r : Ξ²) : convex π {x β s | f x < r} := | |
begin | |
refine Ξ» x y hx hy a b ha hb hab, _, | |
have h := hf _ β¨hx.1, le_max_left _ _β© β¨hy.1, le_max_right _ _β© ha hb hab, | |
exact β¨h.1, h.2.trans_lt $ max_lt hx.2 hy.2β©, | |
end | |
lemma quasiconcave_on.convex_gt (hf : quasiconcave_on π s f) (r : Ξ²) : convex π {x β s | r < f x} := | |
hf.dual.convex_lt r | |
end has_smul | |
section ordered_smul | |
variables [has_smul π E] [module π Ξ²] [ordered_smul π Ξ²] {s : set E} {f : E β Ξ²} | |
lemma convex_on.quasiconvex_on (hf : convex_on π s f) : quasiconvex_on π s f := | |
hf.convex_le | |
lemma concave_on.quasiconcave_on (hf : concave_on π s f) : quasiconcave_on π s f := | |
hf.convex_ge | |
end ordered_smul | |
end linear_ordered_add_comm_monoid | |
end add_comm_monoid | |
section linear_ordered_add_comm_monoid | |
variables [linear_ordered_add_comm_monoid E] [ordered_add_comm_monoid Ξ²] [module π E] | |
[ordered_smul π E] {s : set E} {f : E β Ξ²} | |
lemma monotone_on.quasiconvex_on (hf : monotone_on f s) (hs : convex π s) : quasiconvex_on π s f := | |
hf.convex_le hs | |
lemma monotone_on.quasiconcave_on (hf : monotone_on f s) (hs : convex π s) : | |
quasiconcave_on π s f := | |
hf.convex_ge hs | |
lemma monotone_on.quasilinear_on (hf : monotone_on f s) (hs : convex π s) : quasilinear_on π s f := | |
β¨hf.quasiconvex_on hs, hf.quasiconcave_on hsβ© | |
lemma antitone_on.quasiconvex_on (hf : antitone_on f s) (hs : convex π s) : quasiconvex_on π s f := | |
hf.convex_le hs | |
lemma antitone_on.quasiconcave_on (hf : antitone_on f s) (hs : convex π s) : | |
quasiconcave_on π s f := | |
hf.convex_ge hs | |
lemma antitone_on.quasilinear_on (hf : antitone_on f s) (hs : convex π s) : quasilinear_on π s f := | |
β¨hf.quasiconvex_on hs, hf.quasiconcave_on hsβ© | |
lemma monotone.quasiconvex_on (hf : monotone f) : quasiconvex_on π univ f := | |
(hf.monotone_on _).quasiconvex_on convex_univ | |
lemma monotone.quasiconcave_on (hf : monotone f) : quasiconcave_on π univ f := | |
(hf.monotone_on _).quasiconcave_on convex_univ | |
lemma monotone.quasilinear_on (hf : monotone f) : quasilinear_on π univ f := | |
β¨hf.quasiconvex_on, hf.quasiconcave_onβ© | |
lemma antitone.quasiconvex_on (hf : antitone f) : quasiconvex_on π univ f := | |
(hf.antitone_on _).quasiconvex_on convex_univ | |
lemma antitone.quasiconcave_on (hf : antitone f) : quasiconcave_on π univ f := | |
(hf.antitone_on _).quasiconcave_on convex_univ | |
lemma antitone.quasilinear_on (hf : antitone f) : quasilinear_on π univ f := | |
β¨hf.quasiconvex_on, hf.quasiconcave_onβ© | |
end linear_ordered_add_comm_monoid | |
end ordered_semiring | |