Convex and concave functions #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines convex and concave functions in vector spaces and proves the finite Jensen
inequality. The integral version can be found in analysis.convex.integral
.
A function f : E → β
is convex_on
a set s
if s
is itself a convex set, and for any two
points x y ∈ s
, the segment joining (x, f x)
to (y, f y)
is above the graph of f
.
Equivalently, convex_on 𝕜 f s
means that the epigraph {p : E × β | p.1 ∈ s ∧ f p.1 ≤ p.2}
is
a convex set.
Main declarations #
convex_on 𝕜 s f
: The functionf
is convex ons
with scalars𝕜
.concave_on 𝕜 s f
: The functionf
is concave ons
with scalars𝕜
.strict_convex_on 𝕜 s f
: The functionf
is strictly convex ons
with scalars𝕜
.strict_concave_on 𝕜 s f
: The functionf
is strictly concave ons
with scalars𝕜
.
Convexity of functions
Concavity of functions
Strict convexity of functions
Strict concavity of functions
Right translation preserves convexity.
Right translation preserves concavity.
Left translation preserves convexity.
Left translation preserves concavity.
A linear map is convex.
A linear map is concave.
For a function on a convex set in a linearly ordered space (where the order and the algebraic
structures aren't necessarily compatible), in order to prove that it is convex, it suffices to
verify the inequality f (a • x + b • y) ≤ a • f x + b • f y
only for x < y
and positive a
,
b
. The main use case is E = 𝕜
however one can apply it, e.g., to 𝕜^n
with lexicographic order.
For a function on a convex set in a linearly ordered space (where the order and the algebraic
structures aren't necessarily compatible), in order to prove that it is concave it suffices to
verify the inequality a • f x + b • f y ≤ f (a • x + b • y)
for x < y
and positive a
, b
. The
main use case is E = ℝ
however one can apply it, e.g., to ℝ^n
with lexicographic order.
For a function on a convex set in a linearly ordered space (where the order and the algebraic
structures aren't necessarily compatible), in order to prove that it is strictly convex, it suffices
to verify the inequality f (a • x + b • y) < a • f x + b • f y
for x < y
and positive a
, b
.
The main use case is E = 𝕜
however one can apply it, e.g., to 𝕜^n
with lexicographic order.
For a function on a convex set in a linearly ordered space (where the order and the algebraic
structures aren't necessarily compatible), in order to prove that it is strictly concave it suffices
to verify the inequality a • f x + b • f y < f (a • x + b • y)
for x < y
and positive a
, b
.
The main use case is E = 𝕜
however one can apply it, e.g., to 𝕜^n
with lexicographic order.
If g
is convex on s
, so is (f ∘ g)
on f ⁻¹' s
for a linear f
.
If g
is concave on s
, so is (g ∘ f)
on f ⁻¹' s
for a linear f
.
The pointwise maximum of convex functions is convex.
The pointwise minimum of concave functions is concave.
The pointwise maximum of strictly convex functions is strictly convex.
The pointwise minimum of strictly concave functions is strictly concave.
A convex function on a segment is upper-bounded by the max of its endpoints.
A concave function on a segment is lower-bounded by the min of its endpoints.
A convex function on a segment is upper-bounded by the max of its endpoints.
A concave function on a segment is lower-bounded by the min of its endpoints.
A strictly convex function on an open segment is strictly upper-bounded by the max of its endpoints.
A strictly concave function on an open segment is strictly lower-bounded by the min of its endpoints.
A strictly convex function on an open segment is strictly upper-bounded by the max of its endpoints.
A strictly concave function on an open segment is strictly lower-bounded by the min of its endpoints.
A function -f
is convex iff f
is concave.
A function -f
is concave iff f
is convex.
A function -f
is strictly convex iff f
is strictly concave.
A function -f
is strictly concave iff f
is strictly convex.
Alias of the reverse direction of neg_convex_on_iff
.
Alias of the reverse direction of neg_concave_on_iff
.
Alias of the reverse direction of neg_strict_convex_on_iff
.
Alias of the reverse direction of neg_strict_concave_on_iff
.
Right translation preserves strict convexity.
Right translation preserves strict concavity.
Left translation preserves strict convexity.
Left translation preserves strict concavity.
If a function is convex on s
, it remains convex when precomposed by an affine map.
If a function is concave on s
, it remains concave when precomposed by an affine map.