Part I — Basic Concepts
Proofs omitted. Hover over highlighted terms to see their Lean types.
Reading sections
§1 — Affine Sets — Part 1
Lean authors: Zichen Wang, Wanli Ma, Pengfei Hao, Zaiwen Wen.
Text 1.1: A subset M of Real^n is affine if for all x, y ∈ M and all r : Real, (1 - r) • x + r • y is in M.
def IsAffineSet (n : Nat) (M : Set (Fin n -> Real)) : Prop :=
∀ x y : Fin n -> Real, x ∈ M -> y ∈ M -> ∀ r : Real, (1 - r) • x + r • y ∈ M
Affine combinations of two points in an affine set are in the set, written as a line map.
lemma lineMap_mem_of_isAffineSet {n : Nat} {M : Set (Fin n → Real)}
(hM : IsAffineSet n M) {x y : Fin n → Real} (hx : x ∈ M) (hy : y ∈ M) (r : Real) :
AffineMap.lineMap x y r ∈ M
A three-point affine combination as a line map of two line maps.
lemma affine_combo_three_as_double_lineMap {n : Nat} (c : Real) (x y z : Fin n → Real) :
c • (x - y) + z =
AffineMap.lineMap (AffineMap.lineMap z x (2 * c))
(AffineMap.lineMap z y (-2 * c)) (1 / 2 : Real)
An affine set is closed under expressions of the form c • (x - y) + z.
lemma smul_sub_add_mem_of_isAffineSet {n : Nat} {M : Set (Fin n → Real)}
(hM : IsAffineSet n M) {x y z : Fin n → Real} (hx : x ∈ M) (hy : y ∈ M) (hz : z ∈ M)
(c : Real) : c • (x - y) + z ∈ M
Submodules are affine sets.
lemma isAffineSet_of_submodule (n : Nat) (S : Submodule Real (Fin n → Real)) :
IsAffineSet n (S : Set (Fin n → Real))
An affine set containing the origin is closed under scalar multiplication.
lemma affineSet_smul_closed_of_origin {n : Nat} {M : Set (Fin n → Real)}
(hM : IsAffineSet n M) (h0 : (0 : Fin n → Real) ∈ M) :
∀ x ∈ M, ∀ r : Real, r • x ∈ M
An affine set containing the origin is closed under addition.
lemma affineSet_add_closed_of_origin {n : Nat} {M : Set (Fin n → Real)}
(hM : IsAffineSet n M) (h0 : (0 : Fin n → Real) ∈ M) :
∀ x ∈ M, ∀ y ∈ M, x + y ∈ M
An affine set containing the origin is the carrier of a submodule.
lemma submodule_of_affineSet_origin (n : Nat) (M : Set (Fin n → Real))
(hM : IsAffineSet n M) (h0 : (0 : Fin n → Real) ∈ M) :
∃ S : Submodule Real (Fin n → Real), (S : Set (Fin n → Real)) = M
Theorem 1.1: The subspaces of Real^n are exactly the affine sets which contain the origin.
theorem subspace_iff_affineSet_and_origin (n : Nat) (M : Set (Fin n -> Real)) :
(∃ S : Submodule Real (Fin n -> Real), (S : Set (Fin n -> Real)) = M) ↔
IsAffineSet n M ∧ (0 : Fin n -> Real) ∈ M
Text 1.2: For M ⊆ Real^n and a ∈ Real^n, the translate of M by a is the set M + a = {x + a | x ∈ M}.
def SetTranslate (n : Nat) (M : Set (Fin n -> Real)) (a : Fin n -> Real) :
Set (Fin n -> Real) :=
(fun x => x + a) '' M
Translation commutes with affine combinations.
lemma translate_affine_combo {n : Nat} (x y a : Fin n → Real) (r : Real) :
(1 - r) • (x + a) + r • (y + a) = ((1 - r) • x + r • y) + a
Text 1.2.1: If M ⊆ Real^n is affine and a ∈ Real^n, then the translate a + M is an affine set.
theorem isAffineSet_translate (n : Nat) (M : Set (Fin n -> Real)) (a : Fin n -> Real) :
IsAffineSet n M → IsAffineSet n (SetTranslate n M a)
Text 1.3: An affine set M is parallel to an affine set L if M = L + a for some a.
def IsParallelAffineSet (n : Nat) (M L : Set (Fin n -> Real)) : Prop :=
∃ a : Fin n -> Real, M = SetTranslate n L a
Translating by -y gives the set of differences with y.
lemma setTranslate_eq_sub_single (n : Nat) (M : Set (Fin n → Real)) (y : Fin n → Real) :
SetTranslate n M (-y) = {x | ∃ a ∈ M, x = a - y}
Translating a submodule by one of its elements gives the same set.
lemma setTranslate_submodule_eq_self (n : Nat) (L : Submodule Real (Fin n → Real))
(v : Fin n → Real) (hv : v ∈ L) :
SetTranslate n (L : Set (Fin n → Real)) v = (L : Set (Fin n → Real))
Parallel submodules to the same affine set are equal.
lemma parallel_submodule_unique (n : Nat) (M : Set (Fin n → Real))
(L1 L2 : Submodule Real (Fin n → Real))
(h1 : IsParallelAffineSet n M (L1 : Set (Fin n → Real)))
(h2 : IsParallelAffineSet n M (L2 : Set (Fin n → Real))) :
L1 = L2
Theorem 1.2: Each non-empty affine set M is parallel to a unique subspace L; this L is given by L = M - M = {x - y | x ∈ M, y ∈ M}.
theorem parallel_submodule_unique_of_affine (n : Nat) (M : Set (Fin n -> Real)) :
IsAffineSet n M → Set.Nonempty M →
∃! L : Submodule Real (Fin n -> Real),
IsParallelAffineSet n M (L : Set (Fin n -> Real)) ∧
(L : Set (Fin n -> Real)) =
{x | ∃ a ∈ M, ∃ b ∈ M, x = a - b}
Text 1.4: The dimension of a non-empty affine set is defined as the dimension of the subspace parallel to it. (The dimension of ∅ is -1 by convention.)
noncomputable def affineSetDim (n : Nat) (M : Set (Fin n -> Real)) (hM : IsAffineSet n M) :
Int
Text 1.5: An affine set of dimension 0 is called a point.
def IsPoint (n : Nat) (M : Set (Fin n -> Real)) : Prop :=
∃ hM : IsAffineSet n M, affineSetDim n M hM = 0
Text 1.5: An affine set of dimension 1 is called a line.
def IsLine (n : Nat) (M : Set (Fin n -> Real)) : Prop :=
∃ hM : IsAffineSet n M, affineSetDim n M hM = 1
Text 1.5: An affine set of dimension 2 is called a plane.
def IsPlane (n : Nat) (M : Set (Fin n -> Real)) : Prop :=
∃ hM : IsAffineSet n M, affineSetDim n M hM = 2
Text 1.5: An (n - 1)-dimensional affine set in Real^n is called a hyperplane.
def IsHyperplane (n : Nat) (M : Set (Fin n -> Real)) : Prop :=
∃ hM : IsAffineSet n M, affineSetDim n M hM = Int.ofNat (n - 1)
Text 1.6: Given a subspace L of Real^n, the orthogonal complement L^⊥ is the set of vectors x such that x ⟂ y for every y ∈ L.
def orthogonalComplement (n : Nat) (L : Submodule Real (Fin n -> Real)) :
Submodule Real (Fin n -> Real)
The linear functional x ↦ x ⬝ᵥ b.
def dotProductLinear (n : Nat) (b : Fin n → Real) : Module.Dual Real (Fin n → Real)
The kernel of dotProductLinear is the zero dot-product set.
lemma dotProductLinear_ker_eq (n : Nat) (b : Fin n → Real) :
((LinearMap.ker (dotProductLinear n b)) : Set (Fin n → Real)) = {x | x ⬝ᵥ b = 0}
A nonzero vector gives a nonzero dot-product functional.
lemma dotProductLinear_ne_zero (n : Nat) {b : Fin n → Real} (hb : b ≠ 0) :
dotProductLinear n b ≠ 0
Any nonzero linear functional on Fin n → ℝ is a dot-product functional.
lemma dual_eq_dotProductLinear (n : Nat) (f : Module.Dual Real (Fin n → Real)) (hf : f ≠ 0) :
∃ b : Fin n → Real, b ≠ 0 ∧ f = dotProductLinear n b
A dot-product level set is affine.
lemma dotProduct_levelset_isAffine (n : Nat) (β : Real) (b : Fin n → Real) :
IsAffineSet n {x : Fin n → Real | x ⬝ᵥ b = β}
A nonzero normal gives a point on the level set and a translation by the kernel.
lemma exists_point_and_translate_kernel (n : Nat) (β : Real) (b : Fin n → Real) (hb : b ≠ 0) :
∃ x0 : Fin n → Real,
x0 ⬝ᵥ b = β ∧
{x : Fin n → Real | x ⬝ᵥ b = β} =
SetTranslate n {x : Fin n → Real | x ⬝ᵥ b = 0} x0
The kernel of a nonzero dot-product functional has dimension n - 1.
lemma finrank_kernel_dotProduct (n : Nat) (b : Fin n → Real) (hb : b ≠ 0) :
Module.finrank Real (LinearMap.ker (dotProductLinear n b)) = n - 1
Codimension-one submodules are dot-product kernels.
lemma codim_one_submodule_eq_dotProduct (n : Nat) (L : Submodule Real (Fin n → Real))
(hL : Module.finrank Real L = n - 1) (hn : 0 < n) :
∃ b : Fin n → Real, b ≠ (0 : Fin n → Real) ∧
(L : Set (Fin n → Real)) = {x : Fin n → Real | x ⬝ᵥ b = 0}
Equality of dot-product level sets gives equality of the zero-level kernels.
lemma hyperplane_kernels_eq (n : Nat) (b b' : Fin n → Real) (β β' : Real) (x0 : Fin n → Real)
(hx0 : x0 ⬝ᵥ b = β)
(hH : {x : Fin n → Real | x ⬝ᵥ b = β} = {x : Fin n → Real | x ⬝ᵥ b' = β'}) :
{x : Fin n → Real | x ⬝ᵥ b = 0} = {x : Fin n → Real | x ⬝ᵥ b' = 0}
Nonzero linear functionals with the same kernel are scalar multiples.
lemma linear_functional_eq_smul_of_ker_eq (n : Nat)
(f g : Module.Dual Real (Fin n → Real)) (hf : f ≠ 0) (hg : g ≠ 0)
(hker : LinearMap.ker f = LinearMap.ker g) :
∃ c : Real, c ≠ 0 ∧ g = c • f
If two nonzero normals define the same hyperplane, they are scalar multiples.
lemma hyperplane_normal_unique (n : Nat) (b b' : Fin n → Real) (β β' : Real)
(hb : b ≠ 0) (hb' : b' ≠ 0)
(hH : {x : Fin n → Real | x ⬝ᵥ b = β} = {x : Fin n → Real | x ⬝ᵥ b' = β'}) :
∃ c : Real, c ≠ 0 ∧ b' = c • b ∧ β' = c * β
Theorem 1.3: Given β : Real and non-zero b : Real^n, the set {x | ⟪x, b⟫ = β} is a hyperplane in Real^n. Moreover, every hyperplane admits such a representation, with b and β unique up to a common non-zero multiple.
theorem hyperplane_iff_eq_dotProduct (n : Nat) (hn : 0 < n) :
(∀ (β : Real) (b : Fin n → Real), b ≠ 0 →
IsHyperplane n {x : Fin n → Real | x ⬝ᵥ b = β}) ∧
(∀ H : Set (Fin n → Real), IsHyperplane n H →
∃ b : Fin n → Real, ∃ β : Real,
b ≠ 0 ∧ H = {x : Fin n → Real | x ⬝ᵥ b = β} ∧
∀ b' : Fin n → Real, ∀ β' : Real, b' ≠ 0 →
H = {x : Fin n → Real | x ⬝ᵥ b' = β'} →
∃ c : Real, c ≠ 0 ∧ b' = c • b ∧ β' = c * β)
Text 1.7: In Theorem 1.3, the vector b is called a normal to the hyperplane H.
def IsNormalToHyperplane (n : Nat) (H : Set (Fin n → Real)) (b : Fin n → Real) : Prop :=
∃ β : Real, b ≠ 0 ∧ H = {x : Fin n → Real | x ⬝ᵥ b = β}
Text 1.8: For any S ⊆ R^n there is a unique smallest affine set containing S, namely the intersection of all affine sets containing S. This set is called the affine hull of S and is denoted aff S.
def affineHull (n : Nat) (S : Set (Fin n → Real)) : Set (Fin n → Real) :=
(affineSpan Real S : Set (Fin n → Real))
The affine hull is contained in any affine set that contains S.
lemma affineHull_subset_of_affineSet {n : Nat} {S M : Set (Fin n → Real)}
(hM : IsAffineSet n M) (hS : S ⊆ M) : affineHull n S ⊆ M
The affine hull of a set is itself affine.
lemma isAffineSet_affineHull (n : Nat) (S : Set (Fin n → Real)) :
IsAffineSet n (affineHull n S)
The affine hull is an affine set containing S.
lemma affineHull_mem_affineSets (n : Nat) (S : Set (Fin n → Real)) :
affineHull n S ∈ {M : Set (Fin n → Real) | IsAffineSet n M ∧ S ⊆ M}
Text 1.8: The affine hull is the intersection of all affine sets containing S.
theorem affineHull_eq_sInter_affineSets (n : Nat) (S : Set (Fin n → Real)) :
affineHull n S =
⋂₀ {M : Set (Fin n → Real) | IsAffineSet n M ∧ S ⊆ M}
On Fin m, an affine combination with total weight 1 is just the sum of smuls.
lemma affineCombination_eq_linear_combination_univ {n m : Nat}
(xs : Fin m → Fin n → Real) (w : Fin m → Real)
(hw : Finset.sum Finset.univ (fun i => w i) = 1) :
(Finset.univ : Finset (Fin m)).affineCombination Real xs w =
Finset.sum Finset.univ (fun i => w i • xs i)
If all points of a family lie in S, then the affine span of its range is contained in the affine span of S.
lemma affineSpan_mono_range {n m : Nat} {S : Set (Fin n → Real)}
(xs : Fin m → Fin n → Real) (hxs : ∀ i, xs i ∈ S) :
affineSpan Real (Set.range xs) ≤ affineSpan Real S
Reindex a finset affine combination into a Fin m-indexed one.
lemma exists_fin_family_of_finset_affineCombination {n : Nat} {S : Set (Fin n → Real)}
{v : Fin n → Real} (fs : Finset {x // x ∈ S}) (w : {x // x ∈ S} → Real)
(hw : ∑ i ∈ fs, w i = 1)
(hv : v = fs.affineCombination Real (fun x : {x // x ∈ S} => (x : Fin n → Real)) w) :
∃ m : Nat, ∃ xs : Fin m → Fin n → Real, ∃ coeffs : Fin m → Real,
(∀ i, xs i ∈ S) ∧
Finset.sum Finset.univ (fun i => coeffs i) = 1 ∧
Finset.sum Finset.univ (fun i => coeffs i • xs i) = v
Text 1.8.1: aff S consists of all vectors of the form λ₁ x₁ + ⋯ + λₘ xₘ with xᵢ ∈ S and λ₁ + ⋯ + λₘ = 1.
theorem mem_affineHull_iff_finset_affineCombination (n : Nat) (S : Set (Fin n → Real))
(v : Fin n → Real) :
v ∈ affineHull n S ↔
∃ m : Nat, ∃ xs : Fin m → Fin n → Real, ∃ coeffs : Fin m → Real,
(∀ i, xs i ∈ S) ∧
Finset.sum Finset.univ (fun i => coeffs i) = 1 ∧
Finset.sum Finset.univ (fun i => coeffs i • xs i) = v
A fiber of a matrix mulVec map is an affine set.
lemma isAffineSet_mulVec_eq (m n : Nat) (b : Fin m → Real)
(B : Matrix (Fin m) (Fin n) Real) :
IsAffineSet n {x : Fin n → Real | B.mulVec x = b}
A translate of a submodule is a fiber of a linear map with that kernel.
lemma translate_eq_linear_fiber {n m : Nat}
(L : Submodule Real (Fin n → Real)) (a : Fin n → Real)
(f : (Fin n → Real) →ₗ[Real] (Fin m → Real)) (hker : LinearMap.ker f = L) :
SetTranslate n (L : Set (Fin n → Real)) a = {x : Fin n → Real | f x = f a}
Any submodule is the kernel of a linear map to Fin m → Real.
lemma exists_linearMap_with_ker (n : Nat) (L : Submodule Real (Fin n → Real)) :
∃ m : Nat, ∃ f : (Fin n → Real) →ₗ[Real] (Fin m → Real), LinearMap.ker f = L
The matrix of a linear map acts by mulVec in the standard basis.
lemma linearMap_toMatrix_mulVec {m n : Nat}
(f : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
∀ x,
(LinearMap.toMatrix (Pi.basisFun Real (Fin n)) (Pi.basisFun Real (Fin m)) f).mulVec x =
f x
Helper lemma: an affine set is the carrier of some affine subspace.
theorem isAffineSet_iff_affineSubspace (n : Nat) (M : Set (Fin n -> Real)) :
IsAffineSet n M ↔ ∃ s : AffineSubspace Real (Fin n -> Real), (s : Set (Fin n -> Real)) = M§1 — Affine Sets — Part 2
Lean authors: Zichen Wang, Wanli Ma, Pengfei Hao, Zaiwen Wen.
Theorem 1.4: Given b ∈ R^m and an m × n real matrix B, the set M = {x ∈ R^n | Bx = b} is an affine set in R^n. Moreover, every affine set in R^n can be represented in this way.
theorem affineSet_iff_eq_mulVec (m n : Nat) (b : Fin m → Real)
(B : Matrix (Fin m) (Fin n) Real) :
IsAffineSet n {x : Fin n → Real | B.mulVec x = b} ∧
(∀ M : Set (Fin n → Real), IsAffineSet n M →
∃ m' : Nat, ∃ b' : Fin m' → Real,
∃ B' : Matrix (Fin m') (Fin n) Real,
M = {x : Fin n → Real | B'.mulVec x = b'})
A matrix fiber is the intersection of its row equation sets.
lemma mulVec_eq_sInter_rowSets (m n : Nat) (B : Matrix (Fin m) (Fin n) Real)
(b : Fin m → Real) :
{x : Fin n → Real | B.mulVec x = b} =
⋂₀ ((Finset.univ.image
(fun i : Fin m => {x : Fin n → Real | (B i) ⬝ᵥ x = b i})) :
Set (Set (Fin n → Real)))
A nonzero normal vector gives a hyperplane as a row equation set.
lemma rowSet_isHyperplane_of_ne_zero (n : Nat) (b : Fin n → Real) (β : Real) (hb : b ≠ 0) :
IsHyperplane n {x : Fin n → Real | x ⬝ᵥ b = β}
The equation for a zero row is either univ or empty.
lemma rowSet_eq_univ_or_empty_of_zero (n : Nat) (β : Real) :
{x : Fin n → Real | (0 : Fin n → Real) ⬝ᵥ x = β} =
(if β = 0 then Set.univ else (∅ : Set (Fin n → Real)))
The empty set is a finite intersection of two parallel hyperplanes when n > 0.
lemma empty_eq_sInter_two_hyperplanes (n : Nat) (hn : 0 < n) :
∃ S : Finset (Set (Fin n → Real)),
(∀ H ∈ S, IsHyperplane n H) ∧
(⋂₀ (S : Set (Set (Fin n → Real))) = (∅ : Set (Fin n → Real)))
Corollary 1.4.1. Every affine subset of R^n is an intersection of a finite collection of hyperplanes.
theorem affineSet_eq_sInter_hyperplanes (n : Nat) (M : Set (Fin n → Real)) (hn : 0 < n) :
IsAffineSet n M →
∃ S : Finset (Set (Fin n → Real)),
(∀ H ∈ S, IsHyperplane n H) ∧ M = ⋂₀ (S : Set (Set (Fin n → Real)))
Text 1.9: A set of m + 1 points b0, b1, ..., bm is said to be affinely independent if aff {b0, b1, ..., bm} is m-dimensional.
def IsAffinelyIndependent (m n : Nat) (b : Fin (m + 1) → Fin n → Real) : Prop :=
let S : Set (Fin n → Real) := Set.range b
let hS : IsAffineSet n (affineHull n S) :=
(isAffineSet_iff_affineSubspace n (affineHull n S)).2 ⟨affineSpan Real S, rfl⟩
affineSetDim n (affineHull n S) hS = (m : Int)
Text 1.9 (mathlib): The book's notion agrees with AffineIndependent.
theorem isAffinelyIndependent_iff_affineIndependent (m n : Nat)
(b : Fin (m + 1) → Fin n → Real) :
IsAffinelyIndependent m n b ↔ AffineIndependent Real b
Translating a set equals pointwise vadd in this commutative setting.
open scoped Pointwise
lemma setTranslate_eq_vadd (n : Nat) (S : Set (Fin n → Real)) (a : Fin n → Real) :
SetTranslate n S a = a +ᵥ S
Translating the difference set by b0 recovers the original points.
open scoped Pointwise
lemma translate_range_sub_eq_union (m n : Nat) (b0 : Fin n → Real) (b : Fin m → Fin n → Real) :
SetTranslate n ({0} ∪ Set.range (fun i : Fin m => b i - b0)) b0 =
({b0} ∪ Set.range b)
Affine hull commutes with translation.
open scoped Pointwise
lemma affineHull_translate (n : Nat) (S : Set (Fin n → Real)) (a : Fin n → Real) :
affineHull n (SetTranslate n S a) = SetTranslate n (affineHull n S) a
Affine independence of b0, b1, ..., bm is equivalent to linear independence of the difference vectors.
open scoped Pointwise
lemma affineIndependent_iff_linearIndependent_b0 (m n : Nat)
(b0 : Fin n → Real) (b : Fin m → Fin n → Real) :
IsAffinelyIndependent m n (Fin.cases b0 (fun i => b i)) ↔
LinearIndependent Real (fun i : Fin m => b i - b0)
Text 1.9.1: Let b0, b1, ..., bm ∈ ℝ^n and set L = aff {0, b1 - b0, ..., bm - b0}. Then aff {b0, b1, ..., bm} = b0 + L. Moreover, the points b0, b1, ..., bm are affinely independent if and only if the vectors b1 - b0, ..., bm - b0 are linearly independent.
open scoped Pointwise
theorem affineHull_eq_translate_and_affineIndependent_iff_linearIndependent
(m n : Nat) (b0 : Fin n → Real) (b : Fin m → Fin n → Real) :
let S : Set (Fin n → Real) := {b0} ∪ Set.range b
let L : Set (Fin n → Real) :=
affineHull n ({0} ∪ Set.range (fun i : Fin m => b i - b0))
affineHull n S = SetTranslate n L b0 ∧
(IsAffinelyIndependent m n (Fin.cases b0 (fun i => b i)) ↔
LinearIndependent Real (fun i : Fin m => b i - b0))
Membership in an affine hull of a finite family yields full-index coefficients.
open scoped Pointwise
lemma exists_coeffs_univ_of_mem_affineHull_range {m n : Nat}
{b : Fin (m + 1) → Fin n → Real} {x : Fin n → Real}
(hx : x ∈ affineHull n (Set.range b)) :
∃ coeffs : Fin (m + 1) → Real,
Finset.sum Finset.univ (fun i => coeffs i) = 1 ∧
Finset.sum Finset.univ (fun i => coeffs i • b i) = x
Affine independence is equivalent to uniqueness of full-index coefficients.
open scoped Pointwise
lemma affineIndependent_iff_unique_coeffs_univ (m n : Nat) (b : Fin (m + 1) → Fin n → Real) :
AffineIndependent Real b ↔
∀ coeffs₁ coeffs₂ : Fin (m + 1) → Real,
Finset.sum Finset.univ (fun i => coeffs₁ i) = 1 →
Finset.sum Finset.univ (fun i => coeffs₂ i) = 1 →
Finset.sum Finset.univ (fun i => coeffs₁ i • b i) =
Finset.sum Finset.univ (fun i => coeffs₂ i • b i) →
coeffs₁ = coeffs₂
Text 1.9.2: Let b0, b1, ..., bm ∈ ℝ^n and set M = aff {b0, b1, ..., bm}. Every point x ∈ M admits a representation x = λ0 b0 + ··· + λm bm with λ0 + ··· + λm = 1. Moreover, the coefficients (λ0, ..., λm) are unique iff the points are affinely independent.
open scoped Pointwise
theorem affineHull_exists_affineCombination_and_unique_iff_affineIndependent
(m n : Nat) (b : Fin (m + 1) → Fin n → Real) :
let M : Set (Fin n → Real) := affineHull n (Set.range b)
(∀ x ∈ M, ∃ coeffs : Fin (m + 1) → Real,
Finset.sum Finset.univ (fun i => coeffs i) = 1 ∧
Finset.sum Finset.univ (fun i => coeffs i • b i) = x) ∧
(IsAffinelyIndependent m n b ↔
∀ x ∈ M, ∀ coeffs₁ coeffs₂ : Fin (m + 1) → Real,
Finset.sum Finset.univ (fun i => coeffs₁ i) = 1 →
Finset.sum Finset.univ (fun i => coeffs₂ i) = 1 →
Finset.sum Finset.univ (fun i => coeffs₁ i • b i) = x →
Finset.sum Finset.univ (fun i => coeffs₂ i • b i) = x →
coeffs₁ = coeffs₂)§1 — Affine Sets — Part 3
Lean authors: Zichen Wang, Wanli Ma, Pengfei Hao, Zaiwen Wen.
Text 1.10: A single-valued mapping T : Real^n → Real^m is an affine transformation if T ((1 - λ) • x + λ • y) = (1 - λ) • T x + λ • T y for all x, y : Real^n and λ : Real.
def IsAffineTransformation (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) : Prop :=
∀ x y : Fin n → Real, ∀ r : Real,
T ((1 - r) • x + r • y) = (1 - r) • T x + r • T y
Text 1.10 (mathlib): The book's notion is equivalent to an AffineMap after coercion.
theorem isAffineTransformation_iff_exists_affineMap (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T ↔
∃ f : AffineMap Real (Fin n → Real) (Fin m → Real),
(f : (Fin n → Real) → (Fin m → Real)) = T
Decomposition of an affine map as a linear part plus a constant (pointwise).
lemma affineMap_decomp_point {n m : Nat}
(f : (Fin n → Real) →ᵃ[Real] (Fin m → Real)) (x : Fin n → Real) :
f x = f.linear x + f 0
Any affine transformation has a linear part plus a constant vector.
lemma affineTransformation_exists_linearMap_add (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T →
∃ A : (Fin n → Real) →ₗ[Real] (Fin m → Real), ∃ a : Fin m → Real,
∀ x : Fin n → Real, T x = A x + a
Any map of the form x ↦ A x + a is an affine transformation.
lemma affineTransformation_of_linearMap_add (n m : Nat)
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) (a : Fin m → Real) :
IsAffineTransformation n m (fun x => A x + a)
Theorem 1.5: The affine transformations from Real^n to Real^m are the mappings T of the form T x = A x + a, where A is a linear transformation and a ∈ Real^m.
theorem affineTransformation_iff_eq_linearMap_add (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T ↔
∃ A : (Fin n → Real) →ₗ[Real] (Fin m → Real), ∃ a : Fin m → Real,
∀ x : Fin n → Real, T x = A x + a
sumExtend agrees with the original family on the left summand.
lemma sumExtend_apply_inl {ι : Type*} {K : Type*} {V : Type*}
[DivisionRing K] [AddCommGroup V] [Module K V]
{v : ι → V} (hs : LinearIndependent K v) (i : ι) :
(Module.Basis.sumExtend hs) (Sum.inl i) = v i
Extend linearly independent families to bases and map one to the other.
lemma linearEquiv_exists_of_linearIndependent (m n : Nat)
(v v' : Fin m → Fin n → Real) :
LinearIndependent Real v → LinearIndependent Real v' →
∃ A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real),
∀ i : Fin m, A (v i) = v' i
Construct a linear equivalence sending the difference vectors of two affinely independent families to each other.
lemma linearEquiv_exists_map_differences (m n : Nat)
(b b' : Fin (m + 1) → Fin n → Real) :
IsAffinelyIndependent m n b → IsAffinelyIndependent m n b' →
∃ A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real),
∀ i : Fin m, A (b (Fin.succ i) - b 0) = b' (Fin.succ i) - b' 0
The affine map defined by a linear equivalence and a translation is affine and bijective.
lemma affineTransformation_bijective_of_linearEquiv_shift (n : Nat)
(A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real)) (b0 b0' : Fin n → Real) :
IsAffineTransformation n n (fun x => A (x - b0) + b0') ∧
Function.Bijective (fun x => A (x - b0) + b0')
Affinely independent families of size n + 1 in Real^n span the whole space.
lemma affineSpan_range_eq_top_of_isAffinelyIndependent_eq (n : Nat)
(b : Fin (n + 1) → Fin n → Real) :
IsAffinelyIndependent n n b → affineSpan Real (Set.range b) = ⊤
Theorem 1.6: Let {b_0, b_1, ..., b_m} and {b'_0, b'_1, ..., b'_m} be affinely independent sets in Real^n. Then there exists a one-to-one affine transformation T of Real^n onto itself such that T b_i = b'_i for i = 0, ..., m. If m = n, then T is unique.
theorem affineTransformation_exists_of_affineIndependent (m n : Nat)
(b b' : Fin (m + 1) → Fin n → Real) :
IsAffinelyIndependent m n b → IsAffinelyIndependent m n b' →
∃ T : (Fin n → Real) → (Fin n → Real),
IsAffineTransformation n n T ∧ Function.Bijective T ∧
(∀ i : Fin (m + 1), T (b i) = b' i) ∧
(m = n → ∀ T' : (Fin n → Real) → (Fin n → Real),
IsAffineTransformation n n T' → Function.Bijective T' →
(∀ i : Fin (m + 1), T' (b i) = b' i) → T' = T)
An affine set has dimension -1 if and only if it is empty.
lemma affineSetDim_eq_neg_one_iff_empty (n : Nat) (M : Set (Fin n → Real))
(hM : IsAffineSet n M) :
affineSetDim n M hM = -1 ↔ M = ∅
For a nonempty affine set, the dimension equals the finrank of any parallel submodule.
lemma affineSetDim_eq_finrank_parallel (n : Nat) (M : Set (Fin n → Real))
(hM : IsAffineSet n M) (hne : Set.Nonempty M)
{L : Submodule Real (Fin n → Real)}
(hL : IsParallelAffineSet n M (L : Set (Fin n → Real))) :
affineSetDim n M hM = Int.ofNat (Module.finrank Real L)
The range of Fin.cases is the union of the head and tail ranges.
lemma range_fin_cases {m : Nat} {α : Type*} (a : α) (b : Fin m → α) :
Set.range (Fin.cases a b) = {a} ∪ Set.range b
The affine hull of {0} together with a basis of a submodule is that submodule.
lemma affineHull_zero_union_range_eq_submodule (n m : Nat)
(L : Submodule Real (Fin n → Real)) (v : Module.Basis (Fin m) Real L) :
affineHull n ({0} ∪ Set.range (fun i : Fin m => (v i : Fin n → Real))) =
(L : Set (Fin n → Real))
From a basis of a submodule and a base point, build affinely independent points spanning the translate.
lemma affinelyIndependent_family_of_basis (n m : Nat)
(L : Submodule Real (Fin n → Real)) (v : Module.Basis (Fin m) Real L) (b0 : Fin n → Real) :
∃ b : Fin (m + 1) → Fin n → Real,
IsAffinelyIndependent m n b ∧
affineHull n (Set.range b) = SetTranslate n (L : Set (Fin n → Real)) b0
Affine transformations preserve full-index affine combinations.
lemma affineTransformation_map_affineCombination_univ {m n : Nat}
(T : (Fin n → Real) → (Fin n → Real))
(b : Fin (m + 1) → Fin n → Real) (coeffs : Fin (m + 1) → Real)
(hT : IsAffineTransformation n n T)
(hsum : Finset.sum Finset.univ (fun i => coeffs i) = 1) :
T (Finset.sum Finset.univ (fun i => coeffs i • b i)) =
Finset.sum Finset.univ (fun i => coeffs i • T (b i))
Corollary 1.6.1: Let M_1 and M_2 be affine sets in Real^n of the same dimension. Then there exists a one-to-one affine transformation T of Real^n onto itself such that T '' M_1 = M_2.
theorem affineTransformation_exists_of_affineSet_same_dim (n : Nat)
(M1 M2 : Set (Fin n → Real)) (hM1 : IsAffineSet n M1) (hM2 : IsAffineSet n M2)
(hDim : affineSetDim n M1 hM1 = affineSetDim n M2 hM2) :
∃ T : (Fin n → Real) → (Fin n → Real),
IsAffineTransformation n n T ∧ Function.Bijective T ∧ T '' M1 = M2
Rewrite the inverse formula into linear-plus-constant form.
lemma affine_inverse_rewrite (n : Nat)
(A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real)) (a : Fin n → Real) :
(fun x => A.symm (x - a)) =
(fun x => (A.symm : (Fin n → Real) →ₗ[Real] (Fin n → Real)) x + (-A.symm a))
The inverse formula is affine as a linear map plus translation.
lemma affineTransformation_of_linearEquiv_symm_add (n : Nat)
(A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real)) (a : Fin n → Real) :
IsAffineTransformation n n
(fun x => (A.symm : (Fin n → Real) →ₗ[Real] (Fin n → Real)) x + (-A.symm a))
The inverse of an affine map with linear part A is affine.
theorem inverse_affineTransformation_of_linearEquiv (n : Nat)
(A : (Fin n → Real) ≃ₗ[Real] (Fin n → Real)) (a : Fin n → Real) :
IsAffineTransformation n n (fun x => A x + a) →
IsAffineTransformation n n (fun x => A.symm (x - a))
The image of an affine set under an affine transformation is affine.
lemma affineTransformation_image_affineSet (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T →
∀ M : Set (Fin n → Real), IsAffineSet n M → IsAffineSet m (T '' M)
The preimage of an affine set under an affine transformation is affine.
lemma affineTransformation_preimage_affineSet (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T →
∀ N : Set (Fin m → Real), IsAffineSet m N → IsAffineSet n (T ⁻¹' N)
Text 1.12: Let T : ℝ^n → ℝ^m be an affine transformation. Then for every affine set M ⊆ ℝ^n, the image T '' M is an affine set in ℝ^m. Consequently, for every set S ⊆ ℝ^n, affine transformations preserve affine hulls: affineHull m (T '' S) = T '' affineHull n S.
theorem affineTransformation_image_affineSet_and_affineHull (n m : Nat)
(T : (Fin n → Real) → (Fin m → Real)) :
IsAffineTransformation n m T →
(∀ M : Set (Fin n → Real), IsAffineSet n M → IsAffineSet m (T '' M)) ∧
(∀ S : Set (Fin n → Real),
affineHull m (T '' S) = T '' affineHull n S)
Text 1.13: Let M ⊆ ℝ^N be an n-dimensional affine set with 0 < n < N and set m := N - n. A Tucker representation is a coordinate permutation so that x ∈ M iff the last m coordinates are affine functions of the first n, equivalently M is the graph of an affine map ℝ^n → ℝ^m; for linear subspaces the constants vanish.
def IsTuckerRepresentation (n m : Nat) (M : Set (Fin (n + m) → Real)) : Prop :=
∃ (σ : Equiv.Perm (Fin (n + m)))
(f : AffineMap Real (Fin n → Real) (Fin m → Real)),
M =
{x | let p := (Fin.appendEquiv n m).symm (x ∘ σ); p.2 = f p.1}
A nonempty affine set is a translate of a submodule.
lemma affineSet_eq_translate_submodule (n : Nat) (C : Set (Fin n → Real))
(hC : IsAffineSet n C) (hne : Set.Nonempty C) :
∃ (L : Submodule Real (Fin n → Real)) (x0 : Fin n → Real),
C = SetTranslate n (L : Set (Fin n → Real)) x0
Any submodule admits a complementary submodule.
lemma exists_isCompl_submodule (n : Nat) (L : Submodule Real (Fin n → Real)) :
∃ W : Submodule Real (Fin n → Real), IsCompl L W
In product coordinates given by a complement, a translate of L has constant W-part.
lemma image_translate_under_prod_equiv (n : Nat)
(L W : Submodule Real (Fin n → Real)) (hLW : IsCompl L W) (x0 : Fin n → Real) :
(Submodule.prodEquivOfIsCompl L W hLW).symm '' SetTranslate n (L : Set (Fin n → Real)) x0 =
{p : L × W | p.2 = ((Submodule.prodEquivOfIsCompl L W hLW).symm x0).2}
Text 1.13.1: Theorem. Let X be a finite-dimensional real normed linear space and let C ⊂ X be a nontrivial affine set, i.e., C ≠ ∅ and C ≠ X. Then there exist finite-dimensional real normed linear spaces Y and Z, a linear subspace L ⊂ Y, a continuous affine map T : Y → Z, and a point y0 ∈ Y such that C = {x ∈ X : x = T(y), y ∈ L + y0}. Equivalently, there exist a finite-dimensional real normed linear space Y, a continuous linear map A : Y → X and a point x0 ∈ X such that C = x0 + A(Y), and, with respect to a suitable decomposition Y = Y1 × Y2, C can be written as the graph of an affine mapping f : Y1 → Y2, i.e., C = {(y1, f y1) : y1 ∈ Y1}. In particular, every nontrivial affine set in a finite-dimensional real normed linear space is (up to an isomorphism of the ambient space) the graph of an affine transformation between two finite-dimensional real normed linear spaces.
theorem affineSet_is_graph_of_affineMap (n : Nat) (C : Set (Fin n → Real))
(hC : IsAffineSet n C) (hne : Set.Nonempty C) :
∃ (L W : Submodule Real (Fin n → Real))
(Φ : (Fin n → Real) ≃ₗ[Real] (L × W))
(f : AffineMap Real L W),
Φ '' C = {p : L × W | p.2 = f p.1}§1 — Affine Sets — Part 4
Lean authors: Zichen Wang, Wanli Ma, Pengfei Hao, Zaiwen Wen.
A translate of a submodule can be written using a projection onto the submodule.
lemma translate_eq_exists_add_of_isCompl (n : Nat)
(L W : Submodule Real (Fin n → Real)) (hLW : IsCompl L W) (x0 : Fin n → Real) :
SetTranslate n (L : Set (Fin n → Real)) x0 =
{x : Fin n → Real | ∃ y : Fin n → Real,
x = x0 + (Submodule.IsCompl.projection hLW) y}
Convert a graph description in submodule coordinates to one in Fin coordinates.
lemma graph_of_affineMap_exists_fin (n : Nat) (C : Set (Fin n → Real))
(L W : Submodule Real (Fin n → Real))
(Φ : (Fin n → Real) ≃ₗ[Real] (L × W)) (f : AffineMap Real L W)
(hgraph : Φ '' C = {p : L × W | p.2 = f p.1}) :
∃ (n1 n2 : Nat) (f' : AffineMap Real (Fin n1 → Real) (Fin n2 → Real))
(e : (Fin n1 → Real) × (Fin n2 → Real) →ₗ[Real] (Fin n → Real)),
C = {x : Fin n → Real | ∃ y1 : Fin n1 → Real, x = e (y1, f' y1)}
Text 1.13.1: Affine sets are affine images and graphs of affine maps (existence forms).
theorem affineSet_eq_image_submodule_translate_and_graph (n : Nat)
(C : Set (Fin n → Real)) :
IsAffineSet n C → Set.Nonempty C → C ≠ Set.univ →
(∃ (m k : Nat) (L : Submodule Real (Fin m → Real))
(T : ContinuousAffineMap Real (Fin m → Real) (Fin k → Real))
(y0 : Fin m → Real)
(e : (Fin k → Real) ≃ₗ[Real] (Fin n → Real)),
C = {x : Fin n → Real | ∃ y : Fin m → Real,
y ∈ Set.image (fun l : Fin m → Real => l + y0) (L : Set (Fin m → Real)) ∧
x = e (T y)}) ∧
(∃ (m : Nat) (A : (Fin m → Real) →ₗ[Real] (Fin n → Real)) (x0 : Fin n → Real),
C = {x : Fin n → Real | ∃ y : Fin m → Real, x = x0 + A y} ∧
∃ (n1 n2 : Nat) (f : AffineMap Real (Fin n1 → Real) (Fin n2 → Real))
(e : (Fin n1 → Real) × (Fin n2 → Real) →ₗ[Real] (Fin n → Real)),
C = {x : Fin n → Real | ∃ y1 : Fin n1 → Real, x = e (y1, f y1)})§2 — Convex Sets and Cones — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yuhao Jiang, Zaiwen Wen.
Definition 2.0.1. A subset C of Real^n is convex if (1 - λ) • x + λ • y ∈ C whenever x ∈ C, y ∈ C, and 0 < λ < 1.
open scoped BigOperators
open scoped Pointwise
def IsConvexSet (n : Nat) (C : Set (Fin n → Real)) : Prop :=
∀ x ∈ C, ∀ y ∈ C, ∀ t : Real, 0 < t → t < 1 →
(1 - t) • x + t • y ∈ C
Convert the book's strict-parameter definition to mathlib's Convex.
open scoped BigOperators
open scoped Pointwise
lemma isConvexSet_imp_convex (n : Nat) (C : Set (Fin n → Real)) :
IsConvexSet n C → Convex Real C
Convert mathlib's Convex to the book's strict-parameter definition.
open scoped BigOperators
open scoped Pointwise
lemma convex_imp_isConvexSet (n : Nat) (C : Set (Fin n → Real)) :
Convex Real C → IsConvexSet n C
The book's convexity definition is equivalent to mathlib's Convex for subsets of Real^n.
open scoped BigOperators
open scoped Pointwise
theorem isConvexSet_iff_convex (n : Nat) (C : Set (Fin n → Real)) :
IsConvexSet n C ↔ Convex Real C
Definition 2.0.2. The set {(1 - λ) • x + λ • y | 0 ≤ λ ≤ 1} is called the (closed) line segment between x and y.
open scoped BigOperators
open scoped Pointwise
def lineSegment (n : Nat) (x y : Fin n → Real) : Set (Fin n → Real) :=
segment (𝕜:=Real) x y
The book's description of the line segment as an image of Icc (0:Real) 1 agrees with mathlib's segment.
open scoped BigOperators
open scoped Pointwise
theorem lineSegment_eq_image (n : Nat) (x y : Fin n → Real) :
lineSegment n x y =
(fun t : Real => (1 - t) • x + t • y) '' Set.Icc (0 : Real) 1
Definition 2.0.3. For non-zero b ∈ Real^n and β ∈ Real, the set {x | ⟪x, b⟫ ≤ β} is a closed half-space.
open scoped BigOperators
open scoped Pointwise
def closedHalfSpaceLE (n : Nat) (b : Fin n → Real) (β : Real) : Set (Fin n → Real) :=
{x : Fin n → Real | x ⬝ᵥ b ≤ β}
Definition 2.0.3. For non-zero b ∈ Real^n and β ∈ Real, the set {x | ⟪x, b⟫ ≥ β} is a closed half-space.
open scoped BigOperators
open scoped Pointwise
def closedHalfSpaceGE (n : Nat) (b : Fin n → Real) (β : Real) : Set (Fin n → Real) :=
{x : Fin n → Real | x ⬝ᵥ b ≥ β}
Definition 2.0.3. For non-zero b ∈ Real^n and β ∈ Real, the set {x | ⟪x, b⟫ < β} is an open half-space.
open scoped BigOperators
open scoped Pointwise
def openHalfSpaceLT (n : Nat) (b : Fin n → Real) (β : Real) : Set (Fin n → Real) :=
{x : Fin n → Real | x ⬝ᵥ b < β}
Definition 2.0.3. For non-zero b ∈ Real^n and β ∈ Real, the set {x | ⟪x, b⟫ > β} is an open half-space.
open scoped BigOperators
open scoped Pointwise
def openHalfSpaceGT (n : Nat) (b : Fin n → Real) (β : Real) : Set (Fin n → Real) :=
{x : Fin n → Real | x ⬝ᵥ b > β}
Theorem 2.1. The intersection of an arbitrary collection of convex sets is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_iInter_family {ι : Sort*} (n : Nat) (C : ι → Set (Fin n → Real))
(hC : ∀ i, Convex Real (C i)) : Convex Real (⋂ i, C i)
The dot product with a fixed vector is linear in the left argument.
open scoped BigOperators
open scoped Pointwise
lemma isLinearMap_dotProduct_left (n : Nat) (b : Fin n → Real) :
IsLinearMap ℝ (fun x : Fin n → Real => x ⬝ᵥ b)
Each half-space defined by a dot product inequality is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_dotProduct_le (n : Nat) (b : Fin n → Real) (β : Real) :
Convex Real {x : Fin n → Real | x ⬝ᵥ b ≤ β}
Corollary 2.1.1. For vectors b i ∈ Real^n and scalars β i ∈ Real indexed by an arbitrary set ι, the set C = {x | ⟪x, b i⟫ ≤ β i, ∀ i} is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_set_of_dotProduct_le {ι : Sort*} (n : Nat) (b : ι → Fin n → Real)
(β : ι → Real) :
Convex Real {x : Fin n → Real | ∀ i, x ⬝ᵥ b i ≤ β i}
Definition 2.1.2. A set is a polyhedral convex set if it can be expressed as the intersection of finitely many closed half-spaces in Real^n.
open scoped BigOperators
open scoped Pointwise
def IsPolyhedralConvexSet (n : Nat) (C : Set (Fin n → Real)) : Prop :=
∃ (ι : Type) (_ : Fintype ι) (b : ι → Fin n → Real) (β : ι → Real),
C = ⋂ i, closedHalfSpaceLE n (b i) (β i)
Definition 2.2.10. A vector sum λ₁ x₁ + ⋯ + λₘ xₘ is called a convex combination of x₁, ..., xₘ if λ i ≥ 0 for all i and λ₁ + ⋯ + λₘ = 1.
open scoped BigOperators
open scoped Pointwise
def IsConvexCombination (n m : Nat) (x : Fin m → Fin n → Real) (y : Fin n → Real) : Prop :=
∃ w : Fin m → Real, (∀ i, 0 ≤ w i) ∧ (∑ i, w i = (1 : Real)) ∧ y = ∑ i, w i • x i
A convex set contains all finite convex combinations of its elements.
open scoped BigOperators
open scoped Pointwise
lemma convex_mem_of_isConvexCombination (n : Nat) (C : Set (Fin n → Real)) :
Convex Real C →
∀ m (x : Fin m → Fin n → Real) (y : Fin n → Real),
(∀ i, x i ∈ C) →
IsConvexCombination n m x y →
y ∈ C
A two-point convex combination is an IsConvexCombination.
open scoped BigOperators
open scoped Pointwise
lemma isConvexCombination_two (n : Nat) (x y : Fin n → Real) (a b : Real) :
0 ≤ a → 0 ≤ b → a + b = 1 →
IsConvexCombination n 2 (fun i : Fin 2 => if i = 0 then x else y) (a • x + b • y)
If a set contains all finite convex combinations of its elements, then it is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_of_contains_convexCombinations (n : Nat) (C : Set (Fin n → Real)) :
(∀ m (x : Fin m → Fin n → Real) (y : Fin n → Real),
(∀ i, x i ∈ C) →
IsConvexCombination n m x y →
y ∈ C) →
Convex Real C
Theorem 2.2. A subset of Real^n is convex if and only if it contains all the convex combinations of its elements.
open scoped BigOperators
open scoped Pointwise
theorem convex_iff_contains_convex_combinations (n : Nat) (C : Set (Fin n → Real)) :
Convex Real C ↔
∀ m (x : Fin m → Fin n → Real) (y : Fin n → Real),
(∀ i, x i ∈ C) →
IsConvexCombination n m x y →
y ∈ C
Definition 2.3.10. The intersection of all convex sets containing a subset S ⊆ Real^n is called the convex hull of S and is denoted by conv S.
open scoped BigOperators
open scoped Pointwise
def convexHullIntersection (n : Nat) (S : Set (Fin n → Real)) : Set (Fin n → Real) :=
⋂ (C : {C : Set (Fin n → Real) // S ⊆ C ∧ Convex Real C}), C.1
The book's convex hull definition agrees with mathlib's convexHull.
open scoped BigOperators
open scoped Pointwise
theorem convexHullIntersection_eq_convexHull (n : Nat) (S : Set (Fin n → Real)) :
convexHullIntersection n S = convexHull Real S
Convert a Fintype-indexed convex combination into a Fin m-indexed one.
open scoped BigOperators
open scoped Pointwise
lemma exists_fin_convexCombination_of_exists_fintype (n : Nat) (S : Set (Fin n → Real))
(y : Fin n → Real) :
(∃ (ι : Type) (_ : Fintype ι) (w : ι → Real) (z : ι → Fin n → Real),
(∀ i, 0 ≤ w i) ∧ (∑ i, w i = 1) ∧ (∀ i, z i ∈ S) ∧ ∑ i, w i • z i = y) →
∃ m : Nat, ∃ x : Fin m → Fin n → Real,
(∀ i, x i ∈ S) ∧ IsConvexCombination n m x y
Characterize membership in the convex hull via IsConvexCombination.
open scoped BigOperators
open scoped Pointwise
lemma mem_convexHull_iff_exists_fin_isConvexCombination (n : Nat) (S : Set (Fin n → Real))
(y : Fin n → Real) :
y ∈ convexHull Real S ↔
∃ m : Nat, ∃ x : Fin m → Fin n → Real,
(∀ i, x i ∈ S) ∧ IsConvexCombination n m x y
Theorem 2.3. For any S ⊆ Real^n, conv S consists of all the convex combinations of the elements of S.
open scoped BigOperators
open scoped Pointwise
theorem convexHull_eq_setOf_convexCombination (n : Nat) (S : Set (Fin n → Real)) :
convexHull Real S =
{y : Fin n → Real |
∃ m : Nat, ∃ x : Fin m → Fin n → Real,
(∀ i, x i ∈ S) ∧ IsConvexCombination n m x y}
Choose indices witnessing membership in Set.range.
open scoped BigOperators
open scoped Pointwise
lemma range_choice_index {n m k : Nat} (b : Fin (m + 1) → Fin n → Real)
{x : Fin k → Fin n → Real} (hx : ∀ i, x i ∈ Set.range b) :
∃ f : Fin k → Fin (m + 1), ∀ i, x i = b (f i)
Summing weights over fibers preserves nonnegativity and total weight.
open scoped BigOperators
open scoped Pointwise
lemma weights_fiber_sum_eq {k m : Nat} (f : Fin k → Fin (m + 1)) (w : Fin k → Real)
(hw : ∀ i, 0 ≤ w i) :
(∀ j, 0 ≤ ∑ i, if f i = j then w i else 0) ∧
(∑ j, ∑ i, if f i = j then w i else 0) = ∑ i, w i
Summing weights over fibers preserves the weighted sum.
open scoped BigOperators
open scoped Pointwise
lemma weighted_sum_fiber_eq {n m k : Nat} (b : Fin (m + 1) → Fin n → Real)
(f : Fin k → Fin (m + 1)) (w : Fin k → Real) (x : Fin k → Fin n → Real)
(hx : ∀ i, x i = b (f i)) :
∑ j, (∑ i, if f i = j then w i else 0) • b j = ∑ i, w i • x i
Corollary 2.3.1. The convex hull of a finite subset {b_0, ..., b_m} of Real^n consists of all vectors of the form λ_0 b_0 + ⋯ + λ_m b_m with λ_i ≥ 0 and λ_0 + ⋯ + λ_m = 1.
open scoped BigOperators
open scoped Pointwise
theorem convexHull_range_eq_setOf_weighted_sum (n m : Nat)
(b : Fin (m + 1) → Fin n → Real) :
convexHull Real (Set.range b) =
{y : Fin n → Real |
∃ w : Fin (m + 1) → Real, (∀ i, 0 ≤ w i) ∧ (∑ i, w i = (1 : Real)) ∧
y = ∑ i, w i • b i}
Definition 2.3.11. A set which is the convex hull of finitely many points is called a polytope.
open scoped BigOperators
open scoped Pointwise
def IsPolytope (n : Nat) (P : Set (Fin n → Real)) : Prop :=
∃ S : Set (Fin n → Real), S.Finite ∧ P = convexHull Real S
Definition 2.3.12. If {b_0, b_1, ..., b_m} is affinely independent, its convex hull is called an m-dimensional simplex and b_0, ..., b_m are the vertices of the simplex.
open scoped BigOperators
open scoped Pointwise
def IsSimplex (n m : Nat) (P : Set (Fin n → Real)) : Prop :=
∃ b : Fin (m + 1) → Fin n → Real, AffineIndependent Real b ∧
P = convexHull Real (Set.range b)
Definition 2.3.13. For an m-dimensional simplex with vertices b_0, ..., b_m, the point λ_0 b_0 + ⋯ + λ_m b_m with λ_0 = ⋯ = λ_m = 1 / (m + 1) is called the midpoint or barycenter of the simplex.
open scoped BigOperators
open scoped Pointwise
noncomputable def simplexBarycenter (n m : Nat) (b : Fin (m + 1) → Fin n → Real) :
Fin n → Real :=
(Finset.univ).centroid (k:=Real) b
Definition 2.4.10. The dimension of a convex set C is the dimension of the affine hull of C.
open scoped BigOperators
open scoped Pointwise
noncomputable def convexSetDim (n : Nat) (C : Set (Fin n → Real)) : Nat :=
Module.finrank Real (affineSpan Real C).direction
Any simplex contained in C has dimension at most convexSetDim n C.
open scoped BigOperators
open scoped Pointwise
lemma simplex_dim_le_convexSetDim (n : Nat) (C : Set (Fin n → Real)) :
∀ m P, P ⊆ C → IsSimplex n m P → m ≤ convexSetDim n C
Construct a simplex from a finite affinely independent subset of a convex set.
open scoped BigOperators
open scoped Pointwise
lemma simplex_of_affineIndependent_finite (n : Nat) (C : Set (Fin n → Real))
(hC : Convex Real C) {t : Set (Fin n → Real)} (htC : t ⊆ C)
(htind : AffineIndependent Real ((↑) : t → Fin n → Real)) {m : Nat} [Fintype t]
(hcard : Fintype.card t = m + 1) :
∃ P ⊆ C, IsSimplex n m P
A nonempty convex set contains a simplex of dimension convexSetDim.
open scoped BigOperators
open scoped Pointwise
lemma exists_simplex_dim_convexSetDim (n : Nat) (C : Set (Fin n → Real))
(hC : Convex Real C) (hCne : C.Nonempty) :
∃ P ⊆ C, IsSimplex n (convexSetDim n C) P
Theorem 2.4. The dimension of a convex set C is the maximum of the dimensions of the simplices contained in C.
open scoped BigOperators
open scoped Pointwise
theorem convexSetDim_isGreatest_simplex_dim (n : Nat) (C : Set (Fin n → Real))
(hC : Convex Real C) (hCne : C.Nonempty) :
IsGreatest {m : Nat | ∃ P : Set (Fin n → Real), P ⊆ C ∧ IsSimplex n m P}
(convexSetDim n C)
Definition 2.5.9. A subset K of Real^n is a cone if it is closed under positive scalar multiplication, i.e. λ • x ∈ K when x ∈ K and λ > 0.
open scoped BigOperators
open scoped Pointwise
def IsConeSet (n : Nat) (K : Set (Fin n → Real)) : Prop :=
∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K
Definition 2.5.10. A convex cone is a cone which is also a convex set.
open scoped BigOperators
open scoped Pointwise
def IsConvexCone (n : Nat) (K : Set (Fin n → Real)) : Prop :=
IsConeSet n K ∧ Convex Real K
The intersection of cone sets is a cone.
open scoped BigOperators
open scoped Pointwise
lemma IsConeSet_iInter_family {ι : Sort*} (n : Nat) (K : ι → Set (Fin n → Real))
(hK : ∀ i, IsConeSet n (K i)) : IsConeSet n (⋂ i, K i)
Theorem 2.5. The intersection of an arbitrary collection of convex cones is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_iInter_family {ι : Sort*} (n : Nat) (K : ι → Set (Fin n → Real))
(hK : ∀ i, IsConvexCone n (K i)) : IsConvexCone n (⋂ i, K i)
A closed half-space through the origin is a cone.
open scoped BigOperators
open scoped Pointwise
lemma IsConeSet_dotProduct_le_zero (n : Nat) (b : Fin n → Real) :
IsConeSet n {x : Fin n → Real | x ⬝ᵥ b ≤ 0}
A closed half-space through the origin is a convex cone.
open scoped BigOperators
open scoped Pointwise
lemma IsConvexCone_dotProduct_le_zero (n : Nat) (b : Fin n → Real) :
IsConvexCone n {x : Fin n → Real | x ⬝ᵥ b ≤ 0}
Intersections of dot-product half-spaces encode pointwise inequalities.
open scoped BigOperators
open scoped Pointwise
lemma iInter_setOf_dotProduct_le_zero {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
(⋂ i, {x : Fin n → Real | x ⬝ᵥ b i ≤ 0}) =
{x : Fin n → Real | ∀ i, x ⬝ᵥ b i ≤ 0}
Corollary 2.5.1. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set. Then K = {x ∈ Real^n | ⟪x, b i⟫ ≤ 0, i ∈ I} is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_of_dotProduct_le_zero {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
IsConvexCone n {x : Fin n → Real | ∀ i, x ⬝ᵥ b i ≤ 0}
Definition 2.5.11. The non-negative orthant of Real^n is the set of vectors x = (xi_1, ..., xi_n) with xi_i ≥ 0 for all coordinates.
open scoped BigOperators
open scoped Pointwise
def nonNegativeOrthant (n : Nat) : Set (Fin n → Real) :=
{x : Fin n → Real | ∀ i, 0 ≤ x i}
Definition 2.5.12. The positive orthant of Real^n is the set of vectors x = (xi_1, ..., xi_n) with xi_i > 0 for all coordinates.
open scoped BigOperators
open scoped Pointwise
def positiveOrthant (n : Nat) : Set (Fin n → Real) :=
{x : Fin n → Real | ∀ i, 0 < x i}
Definition 2.5.13. It is customary to write x ≥ x' if x - x' belongs to the non-negative orthant, i.e. if ξ_j ≥ ξ'_j for j = 1, ..., n.
open scoped BigOperators
open scoped Pointwise
def coordwiseGE (n : Nat) (x x' : Fin n → Real) : Prop :=
x - x' ∈ nonNegativeOrthant n
The book's coordinatewise order agrees with the pointwise order on Fin n → Real.
open scoped BigOperators
open scoped Pointwise
theorem coordwiseGE_iff_le (n : Nat) (x x' : Fin n → Real) :
coordwiseGE n x x' ↔ x' ≤ x
A convex cone is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma isConvexCone_add_closed (n : Nat) (K : Set (Fin n → Real)) :
IsConvexCone n K → ∀ x ∈ K, ∀ y ∈ K, x + y ∈ K
Positive scalar closure and add-closure give two-point positive combinations.
open scoped BigOperators
open scoped Pointwise
lemma pos_combo_mem_of_add_closed_and_pos_smul_closed (n : Nat) (K : Set (Fin n → Real))
(hadd : ∀ x ∈ K, ∀ y ∈ K, x + y ∈ K)
(hsmul : ∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K) :
∀ x ∈ K, ∀ y ∈ K, ∀ a b : Real, 0 < a → 0 < b → a + b = 1 → a • x + b • y ∈ K
Add-closure and positive scalar closure imply convexity.
open scoped BigOperators
open scoped Pointwise
lemma convex_of_add_closed_and_pos_smul_closed (n : Nat) (K : Set (Fin n → Real))
(hadd : ∀ x ∈ K, ∀ y ∈ K, x + y ∈ K)
(hsmul : ∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K) :
Convex Real K
Theorem 2.6. A subset of Real^n is a convex cone if and only if it is closed under addition and positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
theorem isConvexCone_iff_add_closed_and_pos_smul_closed (n : Nat) (K : Set (Fin n → Real)) :
IsConvexCone n K ↔
(∀ x ∈ K, ∀ y ∈ K, x + y ∈ K) ∧
(∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K)
Finite positive linear combinations from add-closure and positive scalar closure.
open scoped BigOperators
open scoped Pointwise
lemma pos_linear_combo_mem_of_add_closed_and_pos_smul_closed (n : Nat) (K : Set (Fin n → Real))
(hadd : ∀ x ∈ K, ∀ y ∈ K, x + y ∈ K)
(hsmul : ∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K) :
∀ m : Nat, ∀ x : Fin (m + 1) → Fin n → Real, ∀ w : Fin (m + 1) → Real,
(∀ i, x i ∈ K) → (∀ i, 0 < w i) → (∑ i, w i • x i) ∈ K
Positive scaling follows from closure under positive linear combinations.
open scoped BigOperators
open scoped Pointwise
lemma pos_smul_closed_of_pos_linear_combinations (n : Nat) (K : Set (Fin n → Real))
(hcomb :
∀ m : Nat, ∀ x : Fin (m + 1) → Fin n → Real, ∀ w : Fin (m + 1) → Real,
(∀ i, x i ∈ K) → (∀ i, 0 < w i) → (∑ i, w i • x i) ∈ K) :
∀ x ∈ K, ∀ t : Real, 0 < t → t • x ∈ K
Add-closure follows from closure under positive linear combinations.
open scoped BigOperators
open scoped Pointwise
lemma add_closed_of_pos_linear_combinations (n : Nat) (K : Set (Fin n → Real))
(hcomb :
∀ m : Nat, ∀ x : Fin (m + 1) → Fin n → Real, ∀ w : Fin (m + 1) → Real,
(∀ i, x i ∈ K) → (∀ i, 0 < w i) → (∑ i, w i • x i) ∈ K) :
∀ x ∈ K, ∀ y ∈ K, x + y ∈ K
Corollary 2.6.1. A subset of Real^n is a convex cone if and only if it contains all the positive linear combinations of its elements, i.e. sums λ₁ x₁ + ⋯ + λ_m x_m with λ_i > 0.
open scoped BigOperators
open scoped Pointwise
theorem isConvexCone_iff_contains_pos_linear_combinations (n : Nat) (K : Set (Fin n → Real)) :
IsConvexCone n K ↔
∀ m : Nat, ∀ x : Fin (m + 1) → Fin n → Real, ∀ w : Fin (m + 1) → Real,
(∀ i, x i ∈ K) →
(∀ i, 0 < w i) →
(∑ i, w i • x i) ∈ K
A point is a positive linear combination of elements of a set.
open scoped BigOperators
open scoped Pointwise
def IsPosLinearCombination (n : Nat) (S : Set (Fin n → Real)) (y : Fin n → Real) : Prop :=
∃ m : Nat, ∃ x : Fin (m + 1) → Fin n → Real, ∃ w : Fin (m + 1) → Real,
(∀ i, x i ∈ S) ∧ (∀ i, 0 < w i) ∧ y = ∑ i, w i • x i
Positive linear combinations are closed under positive scaling.
open scoped BigOperators
open scoped Pointwise
lemma isPosLinearCombination_smul (n : Nat) (S : Set (Fin n → Real))
{y : Fin n → Real} (hy : IsPosLinearCombination n S y)
{t : Real} (ht : 0 < t) :
IsPosLinearCombination n S (t • y)
The sum of two positive linear combinations is a positive linear combination.
open scoped BigOperators
open scoped Pointwise
lemma isPosLinearCombination_add (n : Nat) (S : Set (Fin n → Real))
{y₁ y₂ : Fin n → Real} (hy₁ : IsPosLinearCombination n S y₁)
(hy₂ : IsPosLinearCombination n S y₂) :
IsPosLinearCombination n S (y₁ + y₂)
Corollary 2.6.2. Let S ⊆ Real^n, and let K be the set of all positive linear combinations of elements of S. Then K is the smallest convex cone containing S.
open scoped BigOperators
open scoped Pointwise
theorem positiveLinearCombinationCone_isSmallest (n : Nat) (S : Set (Fin n → Real)) :
let K : Set (Fin n → Real) :=
{y : Fin n → Real |
∃ m : Nat, ∃ x : Fin (m + 1) → Fin n → Real, ∃ w : Fin (m + 1) → Real,
(∀ i, x i ∈ S) ∧ (∀ i, 0 < w i) ∧ y = ∑ i, w i • x i}
; IsConvexCone n K ∧ S ⊆ K ∧
∀ K' : Set (Fin n → Real), IsConvexCone n K' → S ⊆ K' → K ⊆ K'
Corollary 2.6.3. Let C be a convex set, and let K = {λ • x | λ > 0, x ∈ C}. Then K is the smallest convex cone which includes C.
open scoped BigOperators
open scoped Pointwise
theorem positiveScalarCone_isSmallest (n : Nat) (C : Set (Fin n → Real))
(hC : Convex Real C) :
let K : Set (Fin n → Real) :=
{y : Fin n → Real | ∃ x ∈ C, ∃ t : Real, 0 < t ∧ y = t • x}
; IsConvexCone n K ∧ C ⊆ K ∧
∀ K' : Set (Fin n → Real), IsConvexCone n K' → C ⊆ K' → K ⊆ K'
Definition 2.6.10. The convex cone obtained by adjoining the origin to the cone in Corollary 2.6.2 (equivalently, Corollary 2.6.3) is called the convex cone generated by S (or by a convex set C) and is denoted cone S.
open scoped BigOperators
open scoped Pointwise
def convexConeGenerated (n : Nat) (S : Set (Fin n → Real)) : Set (Fin n → Real) :=
Set.insert (0 : Fin n → Real) ((ConvexCone.hull Real S) : Set (Fin n → Real))
The nonnegative ray generated by a set.
open scoped BigOperators
open scoped Pointwise
def rayNonneg (n : Nat) (S : Set (Fin n → Real)) : Set (Fin n → Real) :=
{y : Fin n → Real | ∃ x ∈ S, ∃ t : Real, 0 ≤ t ∧ y = t • x}
Elements of the nonnegative ray lie in the generated cone.
open scoped BigOperators
open scoped Pointwise
lemma rayNonneg_subset_convexConeGenerated (n : Nat) (S : Set (Fin n → Real)) :
rayNonneg n S ⊆ convexConeGenerated n S
The generated cone is convex.
open scoped BigOperators
open scoped Pointwise
lemma convexConeGenerated_convex (n : Nat) (S : Set (Fin n → Real)) :
Convex Real (convexConeGenerated n S)§2 — Convex Sets and Cones — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yuhao Jiang, Zaiwen Wen.
Positive scaling sends the nonnegative ray into itself.
open scoped BigOperators
open scoped Pointwise
lemma smul_rayNonneg_subset (n : Nat) (S : Set (Fin n → Real)) {t : Real} (ht : 0 < t) :
t • rayNonneg n S ⊆ rayNonneg n S
The convex hull of the ray is closed under positive scaling.
open scoped BigOperators
open scoped Pointwise
lemma convexHull_rayNonneg_smul_closed (n : Nat) (S : Set (Fin n → Real)) :
∀ x ∈ convexHull Real (rayNonneg n S), ∀ t : Real, 0 < t →
t • x ∈ convexHull Real (rayNonneg n S)
The convex hull of the ray is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma convexHull_rayNonneg_add_closed (n : Nat) (S : Set (Fin n → Real)) :
∀ x ∈ convexHull Real (rayNonneg n S), ∀ y ∈ convexHull Real (rayNonneg n S),
x + y ∈ convexHull Real (rayNonneg n S)
Corollary 2.6.11. For any nonempty subset S ⊆ Real^n, the convex cone generated by S satisfies cone S = conv (ray S).
open scoped BigOperators
open scoped Pointwise
theorem convexConeGenerated_eq_convexHull_ray (n : Nat) (S : Set (Fin n → Real))
(hS : S.Nonempty) :
convexConeGenerated n S =
convexHull Real {y : Fin n → Real | ∃ x ∈ S, ∃ t : Real, 0 ≤ t ∧ y = t • x}
Theorem 2.7. Let K be a convex cone containing 0. Then the smallest subspace containing K is the set of differences {x - y | x ∈ K, y ∈ K}, which coincides with aff K, and the largest subspace contained in K is (-K) ∩ K.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_smallest_largest_subspace (n : Nat) (K : Set (Fin n → Real))
(hK : IsConvexCone n K) (h0 : (0 : Fin n → Real) ∈ K) :
(Submodule.span Real K : Set (Fin n → Real)) =
{z : Fin n → Real | ∃ x ∈ K, ∃ y ∈ K, z = x - y} ∧
(Submodule.span Real K : Set (Fin n → Real)) = (affineSpan Real K : Set (Fin n → Real)) ∧
(∃ S : Submodule Real (Fin n → Real),
(S : Set (Fin n → Real)) ⊆ K ∧
(∀ T : Submodule Real (Fin n → Real), (T : Set (Fin n → Real)) ⊆ K → T ≤ S) ∧
(S : Set (Fin n → Real)) = {x : Fin n → Real | x ∈ K ∧ -x ∈ K})
Definition 2.7.10. A vector x* is normal to a convex set C at a point a ∈ C if ⟪x - a, x*⟫ ≤ 0 for every x ∈ C; the set of all vectors normal to C at a is called the normal cone to C at a.
open scoped BigOperators
open scoped Pointwise
def IsNormalToConvexSet (n : Nat) (C : Set (Fin n → Real)) (a xstar : Fin n → Real) : Prop :=
a ∈ C ∧ ∀ x ∈ C, (x - a) ⬝ᵥ xstar ≤ 0
Definition 2.7.10. The Euclidean-vector version of the normal cone to C at a. This early Chapter 2 API is kept distinct from the later canonical dual-valued normalConeAt.
open scoped BigOperators
open scoped Pointwise
def euclideanNormalConeAt (n : Nat) (C : Set (Fin n → Real)) (a : Fin n → Real) :
Set (Fin n → Real) :=
{xstar : Fin n → Real | IsNormalToConvexSet n C a xstar}
Definition 2.7.11. The barrier cone of a convex set C is the set of all vectors x* such that there exists β ∈ ℝ with ⟪x, x*⟫ ≤ β for every x ∈ C.
open scoped BigOperators
open scoped Pointwise
def barrierCone (n : Nat) (C : Set (Fin n → Real)) : Set (Fin n → Real) :=
{xstar : Fin n → Real | ∃ β : Real, ∀ x ∈ C, x ⬝ᵥ xstar ≤ β}
The barrier cone is closed under positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
lemma barrierCone_smul_mem (n : Nat) (C : Set (Fin n → Real)) {xstar : Fin n → Real}
(hx : xstar ∈ barrierCone n C) {t : Real} (ht : 0 < t) :
t • xstar ∈ barrierCone n C
The barrier cone is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma barrierCone_add_mem (n : Nat) (C : Set (Fin n → Real)) {xstar1 : Fin n → Real}
(hx1 : xstar1 ∈ barrierCone n C) {xstar2 : Fin n → Real} (hx2 : xstar2 ∈ barrierCone n C) :
xstar1 + xstar2 ∈ barrierCone n C
The normal cone at a is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma normalConeAt_add_mem (n : Nat) (C : Set (Fin n → Real)) (a : Fin n → Real)
{xstar1 : Fin n → Real} (hx1 : xstar1 ∈ euclideanNormalConeAt n C a)
{xstar2 : Fin n → Real} (hx2 : xstar2 ∈ euclideanNormalConeAt n C a) :
xstar1 + xstar2 ∈ euclideanNormalConeAt n C a
The normal cone at a is closed under positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
lemma normalConeAt_smul_mem (n : Nat) (C : Set (Fin n → Real)) (a : Fin n → Real)
{xstar : Fin n → Real} (hx : xstar ∈ euclideanNormalConeAt n C a) {t : Real} (ht : 0 < t) :
t • xstar ∈ euclideanNormalConeAt n C a
Proposition 2.7.12. For a convex set C ⊆ ℝ^n and a point a ∈ C, the normal cone to C at a is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem normalConeAt_isConvexCone (n : Nat) (C : Set (Fin n → Real)) (a : Fin n → Real)
(_hC : Convex Real C) (_ha : a ∈ C) :
IsConvexCone n (euclideanNormalConeAt n C a)
Proposition 2.7.13. For a convex set C ⊆ ℝ^n, the barrier cone of C is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem barrierCone_isConvexCone (n : Nat) (C : Set (Fin n → Real)) (_hC : Convex Real C) :
IsConvexCone n (barrierCone n C)
The ≤ dot-product half-space is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_closedHalfSpaceLE_dotProduct (n : Nat) (b : Fin n → Real) (β : Real) :
Convex Real (closedHalfSpaceLE n b β)
The ≥ dot-product half-space is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_closedHalfSpaceGE_dotProduct (n : Nat) (b : Fin n → Real) (β : Real) :
Convex Real (closedHalfSpaceGE n b β)
The strict dot-product half-spaces (< and >) are convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_openHalfSpaces_dotProduct (n : Nat) (b : Fin n → Real) (β : Real) :
Convex Real (openHalfSpaceLT n b β) ∧ Convex Real (openHalfSpaceGT n b β)
Corollary 2.0.4. For non-zero b ∈ Real^n and β ∈ Real, each of the four half-spaces {x | ⟪x, b⟫ ≤ β}, {x | ⟪x, b⟫ ≥ β}, {x | ⟪x, b⟫ < β}, {x | ⟪x, b⟫ > β} is a convex subset of Real^n.
open scoped BigOperators
open scoped Pointwise
theorem convex_halfSpaces_dotProduct (n : Nat) (b : Fin n → Real) (hb : b ≠ 0) (β : Real) :
Convex Real (closedHalfSpaceLE n b β) ∧
Convex Real (closedHalfSpaceGE n b β) ∧
Convex Real (openHalfSpaceLT n b β) ∧
Convex Real (openHalfSpaceGT n b β)
Proposition 2.0.5. Every affine subset of ℝ^n (including ∅ and ℝ^n itself) is convex.
open scoped BigOperators
open scoped Pointwise
theorem isAffineSet_imp_convex (n : Nat) (M : Set (Fin n → Real)) (hM : IsAffineSet n M) :
Convex Real M
A nonzero vector has positive dot product with itself.
open scoped BigOperators
open scoped Pointwise
lemma dotProduct_self_pos_of_ne_zero {n : Nat} {b : Fin n → Real} (hb : b ≠ 0) : 0 < b ⬝ᵥ b
For nonzero b, there is a vector with prescribed dot product with b.
open scoped BigOperators
open scoped Pointwise
lemma exists_dotProduct_eq_of_ne_zero (n : Nat) (b : Fin n → Real) (β : Real) (hb : b ≠ 0) :
∃ x0 : Fin n → Real, x0 ⬝ᵥ b = β
Dot products with b after shifting by ± b in the left argument.
open scoped BigOperators
open scoped Pointwise
lemma dotProduct_shift_by_b (n : Nat) (b x : Fin n → Real) :
(x + b) ⬝ᵥ b = x ⬝ᵥ b + b ⬝ᵥ b ∧ (x - b) ⬝ᵥ b = x ⬝ᵥ b - b ⬝ᵥ b
Proposition 2.0.6. For any non-zero b ∈ Real^n and any β ∈ Real, each of the four half-spaces {x | ⟪x, b⟫ ≤ β}, {x | ⟪x, b⟫ ≥ β}, {x | ⟪x, b⟫ < β}, {x | ⟪x, b⟫ > β} is non-empty.
open scoped BigOperators
open scoped Pointwise
theorem halfSpaces_dotProduct_nonempty (n : Nat) (b : Fin n → Real) (hb : b ≠ 0) (β : Real) :
(closedHalfSpaceLE n b β).Nonempty ∧
(closedHalfSpaceGE n b β).Nonempty ∧
(openHalfSpaceLT n b β).Nonempty ∧
(openHalfSpaceGT n b β).Nonempty
A comparison symbol for linear inequalities/equations.
open scoped BigOperators
open scoped Pointwise
inductive LinearComparison : Type
| le
| ge
| lt
| gt
| eq
Interpret ⟪x, b⟫ (rel) β as a subset of Real^n.
open scoped BigOperators
open scoped Pointwise
def linearComparisonSet (n : Nat) (b : Fin n → Real) (β : Real) :
LinearComparison → Set (Fin n → Real)
The hyperplane {x | ⟪x, b⟫ = β} is convex, as an intersection of the two closed half-spaces {x | ⟪x, b⟫ ≤ β} and {x | ⟪x, b⟫ ≥ β}.
open scoped BigOperators
open scoped Pointwise
lemma convex_dotProduct_eq (n : Nat) (b : Fin n → Real) (β : Real) :
Convex Real {x : Fin n → Real | x ⬝ᵥ b = β}
Each of the five comparison relations (≤, ≥, <, >, =) defines a convex subset of Real^n via linearComparisonSet.
open scoped BigOperators
open scoped Pointwise
lemma convex_linearComparisonSet (n : Nat) (b : Fin n → Real) (β : Real) (r : LinearComparison) :
Convex Real (linearComparisonSet n b β r)
The solution set of a family of linear comparisons is the intersection of the individual constraint sets.
open scoped BigOperators
open scoped Pointwise
lemma solutionSet_linearComparison_eq_iInter {ι : Sort*} (n : Nat) (b : ι → Fin n → Real)
(β : ι → Real) (rel : ι → LinearComparison) :
{x : Fin n → Real | ∀ i, x ∈ linearComparisonSet n (b i) (β i) (rel i)} =
⋂ i, linearComparisonSet n (b i) (β i) (rel i)
Corollary 2.1.2. Given any system of simultaneous linear inequalities and equations in n variables, obtained by combining relations of the form ⟪x, b i⟫ ≤ β i, ⟪x, b i⟫ ≥ β i, ⟪x, b i⟫ < β i, ⟪x, b i⟫ > β i, and ⟪x, b i⟫ = β i (with b i ∈ Real^n and β i ∈ Real), the set of all solutions C ⊆ Real^n is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_solutionSet_linearComparison {ι : Sort*} (n : Nat) (b : ι → Fin n → Real)
(β : ι → Real) (rel : ι → LinearComparison) :
Convex Real {x : Fin n → Real | ∀ i, x ∈ linearComparisonSet n (b i) (β i) (rel i)}
If D lies in an affine subspace A, then the dimension of D is at most the finrank of A.direction.
open scoped BigOperators
open scoped Pointwise
lemma convexSetDim_le_finrank_direction_of_subset_affineSubspace {n : Nat}
{D : Set (Fin n → Real)} {A : AffineSubspace Real (Fin n → Real)}
(hDA : D ⊆ (A : Set (Fin n → Real))) :
convexSetDim n D ≤ Module.finrank Real A.direction
If D contains a 2-simplex, then the dimension of D is at least 2.
open scoped BigOperators
open scoped Pointwise
lemma two_le_convexSetDim_of_exists_simplex_two {n : Nat} {D : Set (Fin n → Real)}
(hsimplex : ∃ P, P ⊆ D ∧ IsSimplex n 2 P) :
2 ≤ convexSetDim n D
Proposition 2.4.11. Every convex disk in ℝ^n has dimension 2, independently of the ambient dimension n.
open scoped BigOperators
open scoped Pointwise
theorem convexDisk_convexSetDim_eq_two (n : Nat) (D : Set (Fin n → Real))
(hconv : Convex Real D)
(hsub :
∃ A : AffineSubspace Real (Fin n → Real),
D ⊆ (A : Set (Fin n → Real)) ∧ Module.finrank Real A.direction = 2)
(hsimplex : ∃ P, P ⊆ D ∧ IsSimplex n 2 P) :
convexSetDim n D = 2
Rewrite ∀ i, 0 ≤ ⟪x, b i⟫ as ∀ i, ⟪x, -b i⟫ ≤ 0.
open scoped BigOperators
open scoped Pointwise
lemma setOf_forall_dotProduct_ge_zero_eq_setOf_forall_dotProduct_le_zero_neg {ι : Sort*}
(n : Nat) (b : ι → Fin n → Real) :
{x : Fin n → Real | ∀ i, 0 ≤ x ⬝ᵥ b i} =
{x : Fin n → Real | ∀ i, x ⬝ᵥ (-b i) ≤ 0}
Corollary 2.5.2. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set. Then K = {x ∈ Real^n | ⟪x, b i⟫ ≥ 0, i ∈ I} is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_of_dotProduct_ge_zero {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
IsConvexCone n {x : Fin n → Real | ∀ i, 0 ≤ x ⬝ᵥ b i}
Pointwise add-closure for {x | ∀ i, 0 < x ⬝ᵥ b i}.
open scoped BigOperators
open scoped Pointwise
lemma add_mem_setOf_forall_dotProduct_pos {ι : Sort*} {n : Nat} {b : ι → Fin n → Real}
{x y : Fin n → Real} :
(∀ i, 0 < x ⬝ᵥ b i) → (∀ i, 0 < y ⬝ᵥ b i) → (∀ i, 0 < (x + y) ⬝ᵥ b i)
Pointwise positive-scalar closure for {x | ∀ i, 0 < x ⬝ᵥ b i}.
open scoped BigOperators
open scoped Pointwise
lemma smul_mem_setOf_forall_dotProduct_pos {ι : Sort*} {n : Nat} {b : ι → Fin n → Real}
{x : Fin n → Real} {t : Real} :
(∀ i, 0 < x ⬝ᵥ b i) → 0 < t → (∀ i, 0 < (t • x) ⬝ᵥ b i)
Corollary 2.5.3. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set. Then K = {x ∈ Real^n | ⟪x, b i⟫ > 0, i ∈ I} is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_of_dotProduct_pos {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
IsConvexCone n {x : Fin n → Real | ∀ i, 0 < x ⬝ᵥ b i}
Rewrite ∀ i, ⟪x, b i⟫ < 0 as ∀ i, 0 < ⟪x, -b i⟫.
open scoped BigOperators
open scoped Pointwise
lemma setOf_forall_dotProduct_lt_zero_eq_setOf_forall_dotProduct_pos_neg {ι : Sort*}
(n : Nat) (b : ι → Fin n → Real) :
{x : Fin n → Real | ∀ i, x ⬝ᵥ b i < 0} =
{x : Fin n → Real | ∀ i, 0 < x ⬝ᵥ (-b i)}
Corollary 2.5.4. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set. Then K = {x ∈ Real^n | ⟪x, b i⟫ < 0, i ∈ I} is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_of_dotProduct_lt_zero {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
IsConvexCone n {x : Fin n → Real | ∀ i, x ⬝ᵥ b i < 0}
Pointwise add-closure for {x | ∀ i, x ⬝ᵥ b i = 0}.
open scoped BigOperators
open scoped Pointwise
lemma add_mem_setOf_forall_dotProduct_eq_zero {ι : Sort*} {n : Nat} {b : ι → Fin n → Real}
{x y : Fin n → Real} :
(∀ i, x ⬝ᵥ b i = 0) → (∀ i, y ⬝ᵥ b i = 0) → (∀ i, (x + y) ⬝ᵥ b i = 0)
Pointwise scalar closure for {x | ∀ i, x ⬝ᵥ b i = 0}.
open scoped BigOperators
open scoped Pointwise
lemma smul_mem_setOf_forall_dotProduct_eq_zero {ι : Sort*} {n : Nat} {b : ι → Fin n → Real}
{x : Fin n → Real} {t : Real} :
(∀ i, x ⬝ᵥ b i = 0) → (∀ i, (t • x) ⬝ᵥ b i = 0)
Corollary 2.5.5. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set. Then K = {x ∈ Real^n | ⟪x, b i⟫ = 0, i ∈ I} is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_of_dotProduct_eq_zero {ι : Sort*} (n : Nat) (b : ι → Fin n → Real) :
IsConvexCone n {x : Fin n → Real | ∀ i, x ⬝ᵥ b i = 0}
Each homogeneous linear comparison set ⟪x, b⟫ (rel) 0 is a convex cone.
open scoped BigOperators
open scoped Pointwise
lemma convexCone_linearComparisonSet_zero (n : Nat) (b : Fin n → Real) (r : LinearComparison) :
IsConvexCone n (linearComparisonSet n b (0 : Real) r)
Corollary 2.5.6. Let b i ∈ Real^n for i ∈ I, where I is an arbitrary index set, and consider a system of homogeneous linear relations of the form ⟪x, b i⟫ ≤ 0, ⟪x, b i⟫ ≥ 0, ⟪x, b i⟫ < 0, ⟪x, b i⟫ > 0, and ⟪x, b i⟫ = 0 for various indices i ∈ I. Then the set K of all solutions x ∈ Real^n is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_solutionSet_homogeneous_linearComparison {ι : Sort*} (n : Nat)
(b : ι → Fin n → Real) (rel : ι → LinearComparison) :
IsConvexCone n
{x : Fin n → Real | ∀ i, x ∈ linearComparisonSet n (b i) (0 : Real) (rel i)}
A submodule (linear subspace) is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma submodule_add_closed (n : Nat) (S : Submodule Real (Fin n → Real)) :
∀ x ∈ (S : Set (Fin n → Real)), ∀ y ∈ (S : Set (Fin n → Real)), x + y ∈ (S : Set (Fin n → Real))
A submodule (linear subspace) is closed under positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
lemma submodule_pos_smul_closed (n : Nat) (S : Submodule Real (Fin n → Real)) :
∀ x ∈ (S : Set (Fin n → Real)), ∀ t : Real, 0 < t → t • x ∈ (S : Set (Fin n → Real))
Proposition 2.5.14. Every linear subspace of Real^n is a convex cone.
open scoped BigOperators
open scoped Pointwise
theorem submodule_isConvexCone (n : Nat) (S : Submodule Real (Fin n → Real)) :
IsConvexCone n (S : Set (Fin n → Real))
The nonnegative orthant is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma nonNegativeOrthant_add_mem (n : Nat) :
∀ x ∈ nonNegativeOrthant n, ∀ y ∈ nonNegativeOrthant n, x + y ∈ nonNegativeOrthant n
The nonnegative orthant is closed under positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
lemma nonNegativeOrthant_pos_smul_mem (n : Nat) :
∀ x ∈ nonNegativeOrthant n, ∀ t : Real, 0 < t → t • x ∈ nonNegativeOrthant n
The positive orthant is closed under addition.
open scoped BigOperators
open scoped Pointwise
lemma positiveOrthant_add_mem (n : Nat) :
∀ x ∈ positiveOrthant n, ∀ y ∈ positiveOrthant n, x + y ∈ positiveOrthant n
The positive orthant is closed under positive scalar multiplication.
open scoped BigOperators
open scoped Pointwise
lemma positiveOrthant_pos_smul_mem (n : Nat) :
∀ x ∈ positiveOrthant n, ∀ t : Real, 0 < t → t • x ∈ positiveOrthant n
Proposition 2.5.15. The non-negative orthant and the positive orthant of Real^n are convex cones.
open scoped BigOperators
open scoped Pointwise
theorem orthants_isConvexCone (n : Nat) :
IsConvexCone n (nonNegativeOrthant n) ∧ IsConvexCone n (positiveOrthant n)
Proposition 2.5.16. The open and closed half-spaces corresponding to a hyperplane through the origin are convex cones. Concretely, for b : Real^n, the hyperplane {x | ⟪x, b⟫ = 0} has associated closed half-spaces {x | ⟪x, b⟫ ≤ 0}, {x | ⟪x, b⟫ ≥ 0} and open half-spaces {x | ⟪x, b⟫ < 0}, {x | ⟪x, b⟫ > 0}.
open scoped BigOperators
open scoped Pointwise
theorem halfSpaces_through_origin_isConvexCone (n : Nat) (b : Fin n → Real) :
IsConvexCone n (closedHalfSpaceLE n b (0 : Real)) ∧
IsConvexCone n (closedHalfSpaceGE n b (0 : Real)) ∧
IsConvexCone n (openHalfSpaceLT n b (0 : Real)) ∧
IsConvexCone n (openHalfSpaceGT n b (0 : Real))
Reading off the 0-th coordinate of a Fin.cons equality gives the normalization ∑ w = 1.
open scoped BigOperators
open scoped Pointwise
lemma convexConeSection_sum_weights_eq_one_of_cons_eq {n m : Nat}
{y : Fin n → Real} {x : Fin (m + 1) → Fin n → Real} {w : Fin (m + 1) → Real}
(h :
(Fin.cons (n := n) (α := fun _ : Fin (n + 1) => Real) (1 : Real) y) =
∑ i : Fin (m + 1),
w i • (Fin.cons (n := n) (α := fun _ : Fin (n + 1) => Real) (1 : Real) (x i))) :
(∑ i : Fin (m + 1), w i) = 1
Reading off the tail coordinates of a Fin.cons equality gives the corresponding weighted-sum identity in Fin n → ℝ.
open scoped BigOperators
open scoped Pointwise
lemma convexConeSection_tail_eq_sum_smul_of_cons_eq {n m : Nat}
{y : Fin n → Real} {x : Fin (m + 1) → Fin n → Real} {w : Fin (m + 1) → Real}
(h :
(Fin.cons (n := n) (α := fun _ : Fin (n + 1) => Real) (1 : Real) y) =
∑ i : Fin (m + 1),
w i • (Fin.cons (n := n) (α := fun _ : Fin (n + 1) => Real) (1 : Real) (x i))) :
y = ∑ i : Fin (m + 1), w i • x i
Proposition 2.6.12. Every convex set C ⊆ ℝ^n can be realized as a cross-section of a convex cone in a higher-dimensional space: there exists a convex cone K ⊆ ℝ^{n+1} such that C = {x ∈ ℝ^n | (1, x) ∈ K}.
open scoped BigOperators
open scoped Pointwise
theorem exists_convexCone_section_eq (n : Nat) (C : Set (Fin n → Real)) (hC : Convex Real C) :
∃ K : Set (Fin (n + 1) → Real),
IsConvexCone (n + 1) K ∧ C = {x : Fin n → Real | Fin.cons (n := n) (1 : Real) x ∈ K}§3 — The Algebra of Convex Sets — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Translation by adding on the right equals translation by adding on the left.
open scoped BigOperators
open scoped Pointwise
lemma image_add_right_eq_image_add_left {n : ℕ} (C : Set (Fin n → Real))
(a : Fin n → Real) :
Set.image (fun x => x + a) C = Set.image (fun x => a + x) C
Theorem 3.0.1: If C is a convex set in Real^n, then C + a is convex for any a in Real^n.
open scoped BigOperators
open scoped Pointwise
theorem convex_translate {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) (a : Fin n → Real) :
Convex Real (Set.image (fun x => x + a) C)
Theorem 3.0.2: If C is a convex set in Real^n, then r C = {r x | x ∈ C} is convex for any r ∈ Real.
open scoped BigOperators
open scoped Pointwise
theorem convex_smul_image {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) (r : Real) :
Convex Real (Set.image (fun x => r • x) C)
Theorem 3.1: If C1 and C2 are convex sets in Real^n, then their sum C1 + C2 = {x1 + x2 | x1 ∈ C1, x2 ∈ C2} is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_add {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real (C1 + C2)
The upper set {x | ∃ x1 ∈ C1, x1 ≤ x} lies in C1 + {x | 0 ≤ x}.
open scoped BigOperators
open scoped Pointwise
lemma upper_set_subset_add_nonneg {n : ℕ} {C1 : Set (Fin n → Real)} :
{x : Fin n → Real | ∃ x1 ∈ C1, x1 ≤ x} ⊆
C1 + Set.Ici (0 : Fin n → Real)
A pointwise nonnegative orthant is a convex set.
open scoped BigOperators
open scoped Pointwise
lemma convex_nonneg_orthant {n : ℕ} :
Convex Real (Set.Ici (0 : Fin n → Real))
The sum with the nonnegative orthant lies in the upper set.
open scoped BigOperators
open scoped Pointwise
lemma add_nonneg_subset_upper_set {n : ℕ} {C1 : Set (Fin n → Real)} :
C1 + Set.Ici (0 : Fin n → Real) ⊆
{x : Fin n → Real | ∃ x1 ∈ C1, x1 ≤ x}
Text 3.1.1: If C1 is a convex set in R^n, then the set {x | ∃ x1 ∈ C1, x1 ≤ x} is also convex, where ≤ is understood componentwise.
open scoped BigOperators
open scoped Pointwise
theorem convex_upper_set_of_le {n : ℕ} {C1 : Set (Fin n → Real)}
(hC1 : Convex Real C1) :
Convex Real {x : Fin n → Real | ∃ x1 ∈ C1, x1 ≤ x}
Unpack the inclusion r • K ⊆ K into pointwise closure under scaling.
open scoped BigOperators
open scoped Pointwise
lemma smul_mem_of_smul_subset {n : ℕ} {K : Set (Fin n → Real)}
(hK : ∀ {r : Real}, 0 < r → r • K ⊆ K) {r : Real} (hr : 0 < r)
{x : Fin n → Real} (hx : x ∈ K) : r • x ∈ K
Unpack the inclusion K + K ⊆ K into pointwise closure under addition.
open scoped BigOperators
open scoped Pointwise
lemma add_mem_of_add_subset {n : ℕ} {K : Set (Fin n → Real)}
(hK : K + K ⊆ K) {x y : Fin n → Real} (hx : x ∈ K) (hy : y ∈ K) :
x + y ∈ K
Text 3.1.2: A set K is a convex cone iff for every λ > 0 we have λ • K ⊆ K, and K + K ⊆ K.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_iff_smul_subset_add_subset {n : ℕ} (K : Set (Fin n → Real)) :
(∃ C : ConvexCone Real (Fin n → Real), (C : Set (Fin n → Real)) = K) ↔
(∀ {r : Real}, 0 < r → r • K ⊆ K) ∧ K + K ⊆ K
A finite Minkowski sum of convex sets is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_sum_finset_set {n : ℕ} {ι : Type*} (s : Finset ι)
(A : ι → Set (Fin n → Real)) (hA : ∀ i ∈ s, Convex Real (A i)) :
Convex Real (s.sum A)
Text 3.1.3: If C1, ..., Cm are convex sets, then the linear combination C = lambda_1 • C1 + ... + lambda_m • Cm is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_linear_combination {n m : ℕ} (C : Fin m → Set (Fin n → Real))
(w : Fin m → Real) (hC : ∀ i, Convex Real (C i)) :
Convex Real (∑ i, w i • C i)
Text 3.1.4: A set C = lambda_1 • C1 + ... + lambda_m • Cm is called a convex combination of C1, ..., Cm when lambda_i ≥ 0 for all i and lambda_1 + ... + lambda_m = 1.
open scoped BigOperators
open scoped Pointwise
def IsConvexCombinationSet {n m : ℕ} (C : Set (Fin n → Real))
(C' : Fin m → Set (Fin n → Real)) (w : Fin m → Real) : Prop :=
C = ∑ i, w i • C' i ∧ (∀ i, 0 ≤ w i) ∧ (∑ i, w i) = (1 : Real)
A Minkowski sum point lies in a translate of the second set.
open scoped BigOperators
open scoped Pointwise
lemma minkowski_sum_subset_iUnion_translate {n : ℕ} (C1 C2 : Set (Fin n → Real)) :
C1 + C2 ⊆ ⋃ x1 ∈ C1, (fun x2 => x1 + x2) '' C2
A point in a translate union lies in the Minkowski sum.
open scoped BigOperators
open scoped Pointwise
lemma iUnion_translate_subset_minkowski_sum {n : ℕ} (C1 C2 : Set (Fin n → Real)) :
(⋃ x1 ∈ C1, (fun x2 => x1 + x2) '' C2) ⊆ C1 + C2
Text 3.1.5: For sets C1, C2 ⊆ ℝ^n, the Minkowski sum satisfies C1 + C2 = ⋃ x1 ∈ C1, (x1 + C2), where x1 + C2 = {x1 + x2 | x2 ∈ C2} is the translate of C2 by the vector x1.
open scoped BigOperators
open scoped Pointwise
theorem minkowski_sum_eq_iUnion_translate {n : ℕ} (C1 C2 : Set (Fin n → Real)) :
C1 + C2 = ⋃ x1 ∈ C1, (fun x2 => x1 + x2) '' C2
Minkowski sum is commutative.
open scoped BigOperators
open scoped Pointwise
lemma minkowski_sum_comm {n : ℕ} (C1 C2 : Set (Fin n → Real)) :
C1 + C2 = C2 + C1
Minkowski sum is associative.
open scoped BigOperators
open scoped Pointwise
lemma minkowski_sum_assoc {n : ℕ} (C1 C2 C3 : Set (Fin n → Real)) :
(C1 + C2) + C3 = C1 + (C2 + C3)
Scalar multiplication on sets is associative.
open scoped BigOperators
open scoped Pointwise
lemma smul_smul_set {n : ℕ} (C : Set (Fin n → Real)) (r1 r2 : Real) :
r1 • (r2 • C) = (r1 * r2) • C
Scalar multiplication distributes over Minkowski sums.
open scoped BigOperators
open scoped Pointwise
lemma smul_add_set {n : ℕ} (C1 C2 : Set (Fin n → Real)) (r : Real) :
r • (C1 + C2) = r • C1 + r • C2
The easy inclusion of a scaled set into a Minkowski sum of scaled sets.
open scoped BigOperators
open scoped Pointwise
lemma smul_set_subset_add_smul_set {n : ℕ} (C : Set (Fin n → Real)) (r1 r2 : Real) :
(r1 + r2) • C ⊆ r1 • C + r2 • C
Convexity gives closure under binary convex combinations inside C.
open scoped BigOperators
open scoped Pointwise
lemma convex_combo_subset {n : ℕ} {C : Set (Fin n → Real)} (hC : Convex Real C)
{a b : Real} (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) :
a • C + b • C ⊆ C
Scale a convex combination back to a Minkowski sum of scaled sets.
open scoped BigOperators
open scoped Pointwise
lemma add_smul_subset_smul_of_pos {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) {r1 r2 : Real} (hr1 : 0 ≤ r1) (hr2 : 0 ≤ r2)
(hpos : 0 < r1 + r2) :
r1 • C + r2 • C ⊆ (r1 + r2) • C
Text 3.1.6: For sets C1, C2, C3 in ℝ^n and real numbers λ1, λ2, λ, the Minkowski sum is commutative and associative, scalar multiplication is associative, and scalar multiplication distributes over sums: C1 + C2 = C2 + C1, (C1 + C2) + C3 = C1 + (C2 + C3), λ1(λ2 C) = (λ1 λ2) C, and λ(C1 + C2) = λ C1 + λ C2.
open scoped BigOperators
open scoped Pointwise
theorem minkowski_sum_smul_properties {n : ℕ} (C1 C2 C3 C : Set (Fin n → Real))
(r1 r2 r : Real) :
C1 + C2 = C2 + C1 ∧
(C1 + C2) + C3 = C1 + (C2 + C3) ∧
r1 • (r2 • C) = (r1 * r2) • C ∧
r • (C1 + C2) = r • C1 + r • C2
Theorem 3.2: If C is a convex set in Real^n and λ1 ≥ 0, λ2 ≥ 0, then (λ1 + λ2) • C = λ1 • C + λ2 • C.
open scoped BigOperators
open scoped Pointwise
theorem convex_smul_add_eq {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) {r1 r2 : Real} (hr1 : 0 ≤ r1) (hr2 : 0 ≤ r2) :
(r1 + r2) • C = r1 • C + r2 • C
Text 3.2.1: For a convex set C ⊆ ℝ^n and any λ with 1 ≥ λ ≥ 0, it holds that C = λ • C + (1 - λ) • C.
open scoped BigOperators
open scoped Pointwise
theorem convex_eq_smul_add_smul_self {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) {r : Real} (hr0 : 0 ≤ r) (hr1 : r ≤ 1) :
C = r • C + (1 - r) • C
Text 3.2.2: For a convex set C ⊆ ℝ^n, it holds that C + C = 2C.
open scoped BigOperators
open scoped Pointwise
theorem convex_add_eq_two_smul {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) :
C + C = (2 : Real) • C
Text 3.2.3: For a convex set C ⊆ ℝ^n, it holds that C + C + C = 3C.
open scoped BigOperators
open scoped Pointwise
theorem convex_add_eq_three_smul {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) :
C + C + C = (3 : Real) • C
Membership in a finite Minkowski sum of scaled sets is equivalent to a pointwise witness.
open scoped BigOperators
open scoped Pointwise
lemma mem_sum_smul_set_iff_exists_points {n m : ℕ} (C : Fin m → Set (Fin n → Real))
(w : Fin m → Real) (x : Fin n → Real) :
x ∈ ∑ i, w i • C i ↔
∃ z : Fin m → Fin n → Real, (∀ i, z i ∈ C i) ∧ x = ∑ i, w i • z i
Choose indices witnessing membership in a union of sets.
open scoped BigOperators
open scoped Pointwise
lemma choose_index_family_of_mem_iUnion {n m : ℕ} {I : Type*} {C : I → Set (Fin n → Real)}
{x : Fin m → Fin n → Real} (hx : ∀ i, x i ∈ ⋃ j, C j) :
∃ f : Fin m → I, ∀ i, x i ∈ C (f i)
Theorem 3.3: If {C_i | i ∈ I} is a collection of nonempty convex sets in ℝ^n and C is the convex hull of their union, then C is the union of all finite convex combinations ∑ i, λ_i C_i, where the coefficients are nonnegative, only finitely many are nonzero, and they sum to 1.
open scoped BigOperators
open scoped Pointwise
theorem convexHull_iUnion_eq_setOf_finite_convexCombinations {n : ℕ} {I : Type*}
(C : I → Set (Fin n → Real)) (_hCne : ∀ i, (C i).Nonempty)
(_hCconv : ∀ i, Convex Real (C i)) :
convexHull Real (⋃ i, C i) =
{x : Fin n → Real |
∃ m : ℕ, ∃ f : Fin m → I, ∃ w : Fin m → Real,
(∀ i, 0 ≤ w i) ∧ (∑ i, w i = 1) ∧ x ∈ ∑ i, w i • C (f i)}
Text 3.4.0: Given a linear transformation A from ℝ^n to ℝ^m, the image of C ⊆ ℝ^n under A is AC = {A x | x ∈ C}.
open scoped BigOperators
open scoped Pointwise
def linearImage {n m : ℕ} (A : (Fin n → Real) →ₗ[Real] (Fin m → Real))
(C : Set (Fin n → Real)) : Set (Fin m → Real) :=
A '' C
Text 3.4.0: Given a linear transformation A from ℝ^n to ℝ^m, the inverse image of D ⊆ ℝ^m under A is A⁻¹ D = {x | A x ∈ D}.
open scoped BigOperators
open scoped Pointwise
def linearPreimage {n m : ℕ} (A : (Fin n → Real) →ₗ[Real] (Fin m → Real))
(D : Set (Fin m → Real)) : Set (Fin n → Real) :=
A ⁻¹' D
Linear images of convex sets are convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_linearImage {n m : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) {C : Set (Fin n → Real)}
(hC : Convex Real C) : Convex Real (linearImage A C)
Linear preimages of convex sets are convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_linearPreimage {n m : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) {D : Set (Fin m → Real)}
(hD : Convex Real D) : Convex Real (linearPreimage A D)
Theorem 3.4: Let A be a linear transformation from ℝ^n to ℝ^m. Then A C is a convex set in ℝ^m for every convex set C in ℝ^n, and A⁻¹ D is a convex set in ℝ^n for every convex set D in ℝ^m.
open scoped BigOperators
open scoped Pointwise
theorem convex_linearImage_and_preimage {n m : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
(∀ {C : Set (Fin n → Real)}, Convex Real C → Convex Real (linearImage A C)) ∧
(∀ {D : Set (Fin m → Real)}, Convex Real D → Convex Real (linearPreimage A D))
Corollary 3.4.1: The orthogonal projection of a convex set C on a subspace L is another convex set.
open scoped BigOperators
open scoped Pointwise
theorem convex_orthogonalProjection {n : ℕ}
(L : Submodule Real (EuclideanSpace Real (Fin n)))
[Submodule.HasOrthogonalProjection L] {C : Set (EuclideanSpace Real (Fin n))}
(hC : Convex Real C) :
Convex Real ((Submodule.starProjection (𝕜 := Real)
(E := EuclideanSpace Real (Fin n)) L) '' C)
Translating the nonnegative orthant yields the upper set ≥ a.
open scoped BigOperators
open scoped Pointwise
lemma translate_nonneg_orthant_eq_ge {m : ℕ} (a : Fin m → Real) :
Set.image (fun u => u + a) {u : Fin m → Real | 0 ≤ u} =
{y : Fin m → Real | y ≥ a}
The preimage of the translated nonnegative orthant is a pointwise inequality.
open scoped BigOperators
open scoped Pointwise
lemma linearPreimage_translate_nonneg_orthant_eq_ge {m n : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) (a : Fin m → Real) :
linearPreimage A (Set.image (fun u => u + a) {u : Fin m → Real | 0 ≤ u}) =
{x : Fin n → Real | A x ≥ a}
The image of the nonnegative orthant is characterized by existence.
open scoped BigOperators
open scoped Pointwise
lemma linearImage_nonneg_orthant_eq_exists {m n : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
linearImage A {x : Fin n → Real | 0 ≤ x} =
{y : Fin m → Real | ∃ x, 0 ≤ x ∧ A x = y}
Text 3.4.2: Let A ∈ ℝ^{m×n}. Define the nonnegative orthants K = {u ∈ ℝ^m | u ≥ 0} and C = {x ∈ ℝ^n | x ≥ 0} and for a ∈ ℝ^m set D = K + a = {u + a | u ∈ K} = {y ∈ ℝ^m | y ≥ a}. Then the preimage A⁻¹ D equals {x ∈ ℝ^n | A x ≥ a} and the image A C equals {y ∈ ℝ^m | ∃ x ∈ ℝ^n_+, A x = y}.
open scoped BigOperators
open scoped Pointwise
theorem linearImage_preimage_nonneg_orthant {m n : ℕ}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) (a : Fin m → Real) :
(let K : Set (Fin m → Real) := {u | 0 ≤ u}
let C : Set (Fin n → Real) := {x | 0 ≤ x}
let D : Set (Fin m → Real) := Set.image (fun u => u + a) K
D = {y | y ≥ a} ∧
linearPreimage A D = {x | A x ≥ a} ∧
linearImage A C = {y | ∃ x, 0 ≤ x ∧ A x = y})
Theorem 3.5: For convex sets C ⊆ ℝ^m and D ⊆ ℝ^n, the direct-sum set C ⊕ D = {x = (y, z) | y ∈ C, z ∈ D} is a convex set in ℝ^{m+n}.
open scoped BigOperators
open scoped Pointwise
theorem convex_prod {m n : ℕ} {C : Set (Fin m → Real)} {D : Set (Fin n → Real)}
(hC : Convex Real C) (hD : Convex Real D) :
Convex Real (Set.prod C D)
Text 3.5.1: Let C and D be convex sets in ℝ^m and ℝ^n. Then C ⊕ D = {x = (y, z) | y ∈ C, z ∈ D} is called the direct sum of C and D.
open scoped BigOperators
open scoped Pointwise
def directSumSet {m n : ℕ} (C : Set (Fin m → Real)) (D : Set (Fin n → Real)) :
Set ((Fin m → Real) × (Fin n → Real)) :=
Set.prod C D
Text 3.5.2: The direct sum of two convex sets is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_directSumSet {m n : ℕ} {C : Set (Fin m → Real)} {D : Set (Fin n → Real)}
(hC : Convex Real C) (hD : Convex Real D) :
Convex Real (directSumSet C D)
Unique decomposition forces elements of (C - C) ∩ (D - D) to be zero.
open scoped BigOperators
open scoped Pointwise
lemma unique_decomp_imp_intersection_subset_zero {n : ℕ} {C D : Set (Fin n → Real)}
(huniq : ∀ x ∈ C + D, ∃! yz : (Fin n → Real) × (Fin n → Real),
yz.1 ∈ C ∧ yz.2 ∈ D ∧ x = yz.1 + yz.2) :
∀ v, v ∈ (C - C) ∩ (D - D) → v = 0
If C and D are nonempty, then 0 ∈ (C - C) ∩ (D - D).
open scoped BigOperators
open scoped Pointwise
lemma zero_mem_intersection_of_nonempty {n : ℕ} {C D : Set (Fin n → Real)}
(hC : C.Nonempty) (hD : D.Nonempty) :
(0 : Fin n → Real) ∈ (C - C) ∩ (D - D)
Intersection criterion implies uniqueness of decompositions in C + D.
open scoped BigOperators
open scoped Pointwise
lemma intersection_eq_zero_imp_unique_decomp {n : ℕ} {C D : Set (Fin n → Real)}
(hinter : (C - C) ∩ (D - D) = ({0} : Set (Fin n → Real))) :
∀ x ∈ C + D, ∃! yz : (Fin n → Real) × (Fin n → Real),
yz.1 ∈ C ∧ yz.2 ∈ D ∧ x = yz.1 + yz.2
Text 3.5.3: For sets C, D ⊆ ℝ^n, the following are equivalent: (1) (Unique decomposition) Every x ∈ C + D can be written in a unique way as x = y + z with (y, z) ∈ C × D. (2) (Intersection criterion) (C - C) ∩ (D - D) = {0}.
open scoped BigOperators
open scoped Pointwise
theorem unique_decomposition_iff_intersection_sub {n : ℕ}
(C D : Set (Fin n → Real)) (hC : C.Nonempty) (hD : D.Nonempty) :
(∀ x ∈ C + D, ∃! yz : (Fin n → Real) × (Fin n → Real),
yz.1 ∈ C ∧ yz.2 ∈ D ∧ x = yz.1 + yz.2) ↔
(C - C) ∩ (D - D) = ({0} : Set (Fin n → Real))
Text 3.5.4: If C ⊆ ℝ^n is convex, then C - C is a convex set.
open scoped BigOperators
open scoped Pointwise
theorem convex_sub_self {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) :
Convex Real (C - C)
Push a scalar factor through membership in a scaled set.
open scoped BigOperators
open scoped Pointwise
lemma coneSet_smul_mem {n : ℕ} {C : Set (Fin n → Real)} {r a : Real}
{x : Fin n → Real} (hx : x ∈ r • C) : a • x ∈ (a * r) • C
Convexity combines elements of scaled sets into a larger scaled set.
open scoped BigOperators
open scoped Pointwise
lemma coneSet_combo_mem {n : ℕ} {C : Set (Fin n → Real)} (hC : Convex Real C)
{r1 r2 a b : Real} {x1 x2 : Fin n → Real}
(hr1 : 0 ≤ r1) (hr2 : 0 ≤ r2)
(hx1 : x1 ∈ r1 • C) (hx2 : x2 ∈ r2 • C)
(ha : 0 ≤ a) (hb : 0 ≤ b) :
a • x1 + b • x2 ∈ (a * r1 + b * r2) • C
Text 3.5.5: For a convex set C ⊆ ℝ^n, the set K_C = { (λ, x) ∈ ℝ × ℝ^n | λ ≥ 0, x ∈ λ C } is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_coneSet_of_convex {n : ℕ} {C : Set (Fin n → Real)}
(hC : Convex Real C) :
Convex Real {p : Real × (Fin n → Real) | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C}
Linear combinations distribute over coordinatewise additions in ℝ^p.
open scoped BigOperators
open scoped Pointwise
lemma smul_add_smul_add_eq {p : ℕ} {a b : Real}
(z1 z1' z2 z2' : Fin p → Real) :
(a • z1 + b • z1') + (a • z2 + b • z2') =
a • (z1 + z2) + b • (z1' + z2')
Theorem 3.6: Let C1 and C2 be convex sets in ℝ^{m+p}. Let C be the set of vectors x = (y, z) with y ∈ ℝ^m and z ∈ ℝ^p such that there exist z1 and z2 with (y, z1) ∈ C1, (y, z2) ∈ C2, and z1 + z2 = z. Then C is a convex set in ℝ^{m+p}.
open scoped BigOperators
open scoped Pointwise
theorem convex_fiberwise_add {m p : ℕ}
{C1 C2 : Set ((Fin m → Real) × (Fin p → Real))}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real
{x : (Fin m → Real) × (Fin p → Real) |
∃ z1 z2 : Fin p → Real,
(x.1, z1) ∈ C1 ∧ (x.1, z2) ∈ C2 ∧ z1 + z2 = x.2}
Text 3.6.1: Define the inverse addition C1 # C2 by ⋃₀ {S | ∃ λ1 λ2, 0 ≤ λ1, 0 ≤ λ2, λ1 + λ2 = 1, S = (λ1 • C1) ∩ (λ2 • C2)}, equivalently as ⋃₀ { (1 - λ) • C1 ∩ λ • C2 | 0 ≤ λ ∧ λ ≤ 1 }.
open scoped BigOperators
open scoped Pointwise
def inverseAddition {n : ℕ} (C1 C2 : Set (Fin n → Real)) : Set (Fin n → Real) :=
⋃₀ {S : Set (Fin n → Real) |
∃ r1 r2 : Real, 0 ≤ r1 ∧ 0 ≤ r2 ∧ r1 + r2 = 1 ∧
S = (r1 • C1) ∩ (r2 • C2)}
Text 3.6.2: Let C1 and C2 be convex sets in ℝ^{m+p}. Let C be the set of vectors x = (y, z) with y ∈ ℝ^m and z ∈ ℝ^p such that there exist y1 and y2 with (y1, z) ∈ C1, (y2, z) ∈ C2, and y1 + y2 = y. Then C is a convex set in ℝ^{m+p}.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
theorem convex_fiberwise_add_left {m p : ℕ}
{C1 C2 : Set ((Fin m → Real) × (Fin p → Real))}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real
{x : (Fin m → Real) × (Fin p → Real) |
∃ y1 y2 : Fin m → Real,
(y1, x.2) ∈ C1 ∧ (y2, x.2) ∈ C2 ∧ y1 + y2 = x.1}
Membership in the componentwise-sum set is equivalent to membership in the Minkowski sum in the product space.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
lemma mem_add_prod_iff {m p : ℕ}
{C1 C2 : Set ((Fin m → Real) × (Fin p → Real))}
{x : (Fin m → Real) × (Fin p → Real)} :
x ∈ {x : (Fin m → Real) × (Fin p → Real) |
∃ y1 y2 : Fin m → Real, ∃ z1 z2 : Fin p → Real,
(y1, z1) ∈ C1 ∧ (y2, z2) ∈ C2 ∧ y1 + y2 = x.1 ∧ z1 + z2 = x.2} ↔
x ∈ C1 + C2
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
theorem convex_add_prod {m p : ℕ}
{C1 C2 : Set ((Fin m → Real) × (Fin p → Real))}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real
{x : (Fin m → Real) × (Fin p → Real) |
∃ y1 y2 : Fin m → Real, ∃ z1 z2 : Fin p → Real,
(y1, z1) ∈ C1 ∧ (y2, z2) ∈ C2 ∧ y1 + y2 = x.1 ∧ z1 + z2 = x.2}
Text 3.6.4: If C1 and C2 are convex sets in ℝ^n, then C1 ∩ C2 is convex.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
theorem convex_intersection {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real (C1 ∩ C2)
Text 3.6.5: Let C1 and C2 be convex sets in ℝ^{m+p}. Let C be the set of vectors x = (y, z) with y ∈ ℝ^m and z ∈ ℝ^p such that (y, z) ∈ C1 and (y, z) ∈ C2. Then C is a convex set in ℝ^{m+p}.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
theorem convex_intersection_prod {m p : ℕ}
{C1 C2 : Set ((Fin m → Real) × (Fin p → Real))}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real (C1 ∩ C2)
Membership in the cone set at λ = 1 reduces to membership in the base set.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
lemma mem_coneSet_one_iff {n : ℕ} {C : Set (Fin n → Real)} {x : Fin n → Real} :
((1 : Real), x) ∈ {p : Real × (Fin n → Real) | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C} ↔
x ∈ C
Unfolding the cone sum at λ = 1 yields a decomposition into C1 and C2.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
lemma mem_K_iff_exists_add {n : ℕ} {C1 C2 : Set (Fin n → Real)} {x : Fin n → Real} :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ x1 x2 : Fin n → Real,
p.2 = x1 + x2 ∧ (p.1, x1) ∈ K1 ∧ (p.1, x2) ∈ K2}
(1, x) ∈ K) ↔
∃ x1 x2 : Fin n → Real, x = x1 + x2 ∧ x1 ∈ C1 ∧ x2 ∈ C2
Text 3.6.6: For convex sets C1 and C2 in ℝ^n, define K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | ∃ x1 x2, x = x1 + x2 ∧ (λ, x1) ∈ K1 ∧ (λ, x2) ∈ K2 }. Then (1, x) ∈ K iff x ∈ C1 + C2.
open scoped BigOperators
open scoped Pointwise
notation:70 C1 " # " C2 => inverseAddition C1 C2
theorem coneSet_add_iff {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ x1 x2 : Fin n → Real,
p.2 = x1 + x2 ∧ (p.1, x1) ∈ K1 ∧ (p.1, x2) ∈ K2}
(1, x) ∈ K ↔ x ∈ C1 + C2)§3 — The Algebra of Convex Sets — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Fiberwise addition over a real scalar coordinate preserves convexity.
open scoped BigOperators
open scoped Pointwise
lemma convex_fiberwise_add_real {n : ℕ}
{K1 K2 : Set (Real × (Fin n → Real))}
(hK1 : Convex Real K1) (hK2 : Convex Real K2) :
Convex Real
{p : Real × (Fin n → Real) |
∃ x1 x2 : Fin n → Real,
p.2 = x1 + x2 ∧ (p.1, x1) ∈ K1 ∧ (p.1, x2) ∈ K2}
Fiberwise addition on the real coordinate preserves convexity.
open scoped BigOperators
open scoped Pointwise
lemma convex_fiberwise_add_real_left {n : ℕ}
{K1 K2 : Set (Real × (Fin n → Real))}
(hK1 : Convex Real K1) (hK2 : Convex Real K2) :
Convex Real
{p : Real × (Fin n → Real) |
∃ r1 r2 : Real,
p.1 = r1 + r2 ∧ (r1, p.2) ∈ K1 ∧ (r2, p.2) ∈ K2}
Text 3.6.7: For convex sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | ∃ x1 x2, x = x1 + x2 ∧ (λ, x1) ∈ K1 ∧ (λ, x2) ∈ K2 }. Then K is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_coneSet_add {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ x1 x2 : Fin n → Real,
p.2 = x1 + x2 ∧ (p.1, x1) ∈ K1 ∧ (p.1, x2) ∈ K2}
Convex Real K)
Text 3.6.8: For convex sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | ∃ λ1 λ2, λ = λ1 + λ2, (λ1, x) ∈ K1, (λ2, x) ∈ K2 }. Then (1, x) ∈ K iff x ∈ C1 # C2.
open scoped BigOperators
open scoped Pointwise
theorem coneSet_inverseAddition_iff {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(_hC1 : Convex Real C1) (_hC2 : Convex Real C2) (x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real,
p.1 = r1 + r2 ∧ (r1, p.2) ∈ K1 ∧ (r2, p.2) ∈ K2}
(1, x) ∈ K ↔ x ∈ C1 # C2)
Text 3.6.9: For convex sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | ∃ λ1 λ2, λ = λ1 + λ2, (λ1, x) ∈ K1, (λ2, x) ∈ K2 }. Then K is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_coneSet_inverseAddition {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real,
p.1 = r1 + r2 ∧ (r1, p.2) ∈ K1 ∧ (r2, p.2) ∈ K2}
Convex Real K)§3 — The Algebra of Convex Sets — Part 3
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Membership in the cone-sum set is equivalent to an explicit convex combination.
open scoped BigOperators
open scoped Pointwise
lemma coneSet_sum_iff_exists_convex_combo {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real, ∃ x1 x2 : Fin n → Real,
p.1 = r1 + r2 ∧ p.2 = x1 + x2 ∧
(r1, x1) ∈ K1 ∧ (r2, x2) ∈ K2}
(1, x) ∈ K) ↔
∃ r1 r2 : Real, ∃ c1 c2 : Fin n → Real,
0 ≤ r1 ∧ 0 ≤ r2 ∧ r1 + r2 = 1 ∧ c1 ∈ C1 ∧ c2 ∈ C2 ∧
x = r1 • c1 + r2 • c2
Membership in the cone-sum set is equivalent to membership in the convex join.
open scoped BigOperators
open scoped Pointwise
lemma coneSet_sum_iff_mem_convexJoin {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real, ∃ x1 x2 : Fin n → Real,
p.1 = r1 + r2 ∧ p.2 = x1 + x2 ∧
(r1, x1) ∈ K1 ∧ (r2, x2) ∈ K2}
(1, x) ∈ K) ↔ x ∈ convexJoin Real C1 C2
open scoped BigOperators
open scoped Pointwise
theorem coneSet_sum_iff_convexHull_union {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2)
(hC1ne : C1.Nonempty) (hC2ne : C2.Nonempty) (x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real, ∃ x1 x2 : Fin n → Real,
p.1 = r1 + r2 ∧ p.2 = x1 + x2 ∧
(r1, x1) ∈ K1 ∧ (r2, x2) ∈ K2}
(1, x) ∈ K ↔ x ∈ convexHull Real (C1 ∪ C2))
Text 3.6.11: For convex sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and `K = { (λ, x) | ∃ λ1 λ2 x1 x2, λ = λ1 + λ2, x = x1 + x2, (λ1, x1) ∈ K1, (λ2, x2) ∈ K2 }`. Then K is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_coneSet_sum {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real, ∃ x1 x2 : Fin n → Real,
p.1 = r1 + r2 ∧ p.2 = x1 + x2 ∧
(r1, x1) ∈ K1 ∧ (r2, x2) ∈ K2}
Convex Real K)§3 — The Algebra of Convex Sets — Part 4
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Membership in the cone at scale 1 is exactly membership in the base set.
open scoped BigOperators
open scoped Pointwise
lemma coneSet_mem_one_iff {n : ℕ} (C : Set (Fin n → Real)) (x : Fin n → Real) :
(1, x) ∈ {p : Real × (Fin n → Real) | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C} ↔ x ∈ C
Text 3.6.12: For sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | (λ, x) ∈ K1, (λ, x) ∈ K2 }. Then (1, x) ∈ K iff x ∈ C1 ∩ C2.
open scoped BigOperators
open scoped Pointwise
theorem coneSet_intersection_iff {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(x : Fin n → Real) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) := K1 ∩ K2
(1, x) ∈ K ↔ x ∈ C1 ∩ C2)
Text 3.6.13: For convex sets C1 and C2, let K1 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C1 }, K2 = { (λ, x) | 0 ≤ λ ∧ x ∈ λ • C2 }, and K = { (λ, x) | (λ, x) ∈ K1, (λ, x) ∈ K2 }. Then K is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_coneSet_intersection {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) := K1 ∩ K2
Convex Real K)
The hyperplane {(1, x)} in ℝ × ℝ^n is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_H_hyperplane_one {n : ℕ} :
Convex Real {p : Real × (Fin n → Real) | p.1 = 1}
The inverse addition is the projection of K ∩ H to the second coordinate.
open scoped BigOperators
open scoped Pointwise
lemma inverseAddition_eq_snd_image_K_inter_H {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real,
p.1 = r1 + r2 ∧ (r1, p.2) ∈ K1 ∧ (r2, p.2) ∈ K2}
let H : Set (Real × (Fin n → Real)) := {p | p.1 = 1}
(C1 # C2) =
(LinearMap.snd (R := Real) (M := Real) (M₂ := Fin n → Real)) '' (K ∩ H))
The intersection of the cone-set K with the hyperplane H is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_K_inter_H {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
(let K1 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C1}
let K2 : Set (Real × (Fin n → Real)) :=
{p | 0 ≤ p.1 ∧ p.2 ∈ p.1 • C2}
let K : Set (Real × (Fin n → Real)) :=
{p |
∃ r1 r2 : Real,
p.1 = r1 + r2 ∧ (r1, p.2) ∈ K1 ∧ (r2, p.2) ∈ K2}
let H : Set (Real × (Fin n → Real)) := {p | p.1 = 1}
Convex Real (K ∩ H))
Theorem 3.7: If C1 and C2 are convex sets in ℝ^n, then their inverse sum C1 # C2 is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_inverseAddition {n : ℕ} {C1 C2 : Set (Fin n → Real)}
(hC1 : Convex Real C1) (hC2 : Convex Real C2) :
Convex Real (C1 # C2)§3 — The Algebra of Convex Sets — Part 5
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
A convex cone containing 0 is closed under nonnegative scaling.
open scoped BigOperators
open scoped Pointwise
lemma cone_smul_mem_of_nonneg {n : ℕ} (K : ConvexCone Real (Fin n → Real))
(h0 : (0 : Fin n → Real) ∈ K) {r : Real} (hr : 0 ≤ r)
{x : Fin n → Real} (hx : x ∈ K) : r • x ∈ K
For convex cones containing 0, the convex join equals the Minkowski sum.
open scoped BigOperators
open scoped Pointwise
lemma convexJoin_eq_add_of_cones {n : ℕ}
(K1 K2 : ConvexCone Real (Fin n → Real))
(h0K1 : (0 : Fin n → Real) ∈ K1) (h0K2 : (0 : Fin n → Real) ∈ K2) :
convexJoin Real (K1 : Set (Fin n → Real)) (K2 : Set (Fin n → Real)) =
(K1 : Set (Fin n → Real)) + (K2 : Set (Fin n → Real))
For convex cones containing 0, inverse addition equals intersection.
open scoped BigOperators
open scoped Pointwise
lemma inverseAddition_eq_inter_of_cones {n : ℕ}
(K1 K2 : ConvexCone Real (Fin n → Real))
(h0K1 : (0 : Fin n → Real) ∈ K1) (h0K2 : (0 : Fin n → Real) ∈ K2) :
((K1 : Set (Fin n → Real)) # (K2 : Set (Fin n → Real))) =
(K1 : Set (Fin n → Real)) ∩ (K2 : Set (Fin n → Real))
Theorem 3.8: If K1 and K2 are convex cones containing the origin, then K1 + K2 = conv(K1 ∪ K2) and K1 # K2 = K1 ∩ K2.
open scoped BigOperators
open scoped Pointwise
theorem convexCone_add_eq_convexHull_union_and_inverseAddition_eq_inter {n : ℕ}
(K1 K2 : ConvexCone Real (Fin n → Real))
(h0K1 : (0 : Fin n → Real) ∈ K1) (h0K2 : (0 : Fin n → Real) ∈ K2) :
((K1 : Set (Fin n → Real)) + (K2 : Set (Fin n → Real)) =
convexHull Real ((K1 : Set (Fin n → Real)) ∪ (K2 : Set (Fin n → Real)))) ∧
(((K1 : Set (Fin n → Real)) # (K2 : Set (Fin n → Real))) =
((K1 : Set (Fin n → Real)) ∩ (K2 : Set (Fin n → Real))))
Text 3.8.1: The umbra of C with respect to S, for disjoint subsets C, S ⊆ ℝ^n, is the set ⋂ x ∈ S, ⋃ λ ≥ 1, ((1 - λ) • x) + λ • C.
open scoped BigOperators
open scoped Pointwise
def umbra {n : ℕ} (C S : Set (Fin n → Real)) : Set (Fin n → Real) :=
⋂ x ∈ S, ⋃ r ≥ (1 : Real), ({(1 - r) • x} : Set (Fin n → Real)) + (r • C)
Text 3.8.2: The penumbra of C with respect to S, for disjoint subsets C, S ⊆ ℝ^n, is the set ⋃ x ∈ S, ⋃ λ ≥ 1, ((1 - λ) • x) + λ • C.
open scoped BigOperators
open scoped Pointwise
def penumbra {n : ℕ} (C S : Set (Fin n → Real)) : Set (Fin n → Real) :=
⋃ x ∈ S, ⋃ r ≥ (1 : Real), ({(1 - r) • x} : Set (Fin n → Real)) + (r • C)
Membership in a slice of the umbra can be written with explicit witnesses.
open scoped BigOperators
open scoped Pointwise
lemma mem_umbra_slice_iff {n : ℕ} {C : Set (Fin n → Real)} {x u : Fin n → Real} :
u ∈ ⋃ r ≥ (1 : Real), ({(1 - r) • x} : Set (Fin n → Real)) + (r • C) ↔
∃ r ≥ (1 : Real), ∃ c ∈ C, u = (1 - r) • x + r • c
Each umbra slice is convex when C is convex.
open scoped BigOperators
open scoped Pointwise
lemma convex_umbra_slice {n : ℕ} {C : Set (Fin n → Real)} (hC : Convex Real C)
(x : Fin n → Real) :
Convex Real (⋃ r ≥ (1 : Real), ({(1 - r) • x} : Set (Fin n → Real)) + (r • C))
Text 3.8.3: The umbra is convex if C is convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_umbra_of_convex {n : ℕ} {C S : Set (Fin n → Real)}
(hC : Convex Real C) :
Convex Real (umbra C S)
Text 3.8.4: The penumbra is convex if both S and C are convex.
open scoped BigOperators
open scoped Pointwise
theorem convex_penumbra_of_convex {n : ℕ} {C S : Set (Fin n → Real)}
(hC : Convex Real C) (hS : Convex Real S) :
Convex Real (penumbra C S)§4 — Convex Functions — Part 1
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
Definition 4.1: Let f be a function with values in R union {plus or minus infinity} whose domain is a subset S of R^n. The set {(x, mu) | x in S, mu in R, mu >= f x} is called the epigraph of f, denoted epi f.
open scoped Matrix Topology
def epigraph {n : Nat} (S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
Set (Prod (Fin n -> Real) Real) :=
{p | And (S p.1) (f p.1 <= (p.2 : EReal))}
Definition 4.2: A function f on S is a convex function if epi f is convex as a subset of R^{n+1}.
open scoped Matrix Topology
def ConvexFunctionOn {n : Nat} (S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
Prop :=
Convex ℝ (epigraph S f)
If x ∈ S and f x ≤ μ, then (x, μ) belongs to the epigraph.
open scoped Matrix Topology
lemma epigraph_mem_of_le_aux {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x : Fin n → Real} {μ : Real}
(hx : x ∈ S) (hμ : f x ≤ (μ : EReal)) : (x, μ) ∈ epigraph S f
Convexity of the epigraph yields convex combinations of its points.
open scoped Matrix Topology
lemma convex_combo_mem_epigraph_aux {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x y : Fin n → Real} {μ v t : Real}
(hconv : Convex ℝ (epigraph S f))
(hx : (x, μ) ∈ epigraph S f) (hy : (y, v) ∈ epigraph S f)
(ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
(1 - t) • (x, μ) + t • (y, v) ∈ epigraph S f
Unpack epigraph membership of a convex combination.
open scoped Matrix Topology
lemma epigraph_combo_proj_aux {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x y : Fin n → Real} {μ v t : Real} :
((1 - t) • (x, μ) + t • (y, v)) ∈ epigraph S f →
((1 - t) • x + t • y) ∈ S ∧
f ((1 - t) • x + t • y) ≤
(((1 - t) * μ + t * v : Real) : EReal)
Convexity of the epigraph gives a real upper bound along segments.
open scoped Matrix Topology
lemma epigraph_combo_ineq_aux {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x y : Fin n → Real} {μ v t : Real}
(hconv : Convex ℝ (epigraph S f))
(hx : x ∈ S) (hy : y ∈ S)
(hμ : f x ≤ (μ : EReal)) (hv : f y ≤ (v : EReal))
(ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
f ((1 - t) • x + t • y) ≤ (((1 - t) * μ + t * v : Real) : EReal)
Theorem 4.1: Let f be a function from C to (-∞, +∞], where C is convex. Then f is convex on C iff f ((1 - λ) • x + λ • y) ≤ (1 - λ) * f x + λ * f y for 0 < λ < 1, for every x and y in C.
open scoped Matrix Topology
theorem convexFunctionOn_iff_segment_inequality {n : Nat} {C : Set (Fin n -> Real)}
{f : (Fin n -> Real) → EReal} (hC : Convex ℝ C)
(hnotbot : ∀ x ∈ C, f x ≠ ⊥) :
ConvexFunctionOn C f ↔
∀ x ∈ C, ∀ y ∈ C, ∀ t : Real, 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤
((1 - t : Real) : EReal) * f x + ((t : Real) : EReal) * f y
Choose a real bound between an EReal value and a real upper bound.
open scoped Matrix Topology
lemma ereal_exists_real_between_of_lt {u : EReal} {α : Real} (h : u < (α : EReal)) :
∃ μ : Real, u ≤ (μ : EReal) ∧ μ < α
Strict inequality for convex combinations of real bounds in EReal.
open scoped Matrix Topology
lemma ereal_convex_combo_lt_of_lt {μ α v β t : Real} (hμ : μ < α) (hv : v < β)
(ht0 : 0 < t) (ht1 : t < 1) :
((1 - t : Real) : EReal) * (μ : EReal) + ((t : Real) : EReal) * (v : EReal) <
((1 - t : Real) : EReal) * (α : EReal) + ((t : Real) : EReal) * (β : EReal)
Strict segment bounds yield a non-strict bound with real upper bounds.
open scoped Matrix Topology
lemma segment_inequality_le_of_strict {n : Nat} {f : (Fin n → Real) → EReal}
(hstrict : ∀ x y : (Fin n → Real), ∀ α β : Real, ∀ t : Real,
f x < (α : EReal) → f y < (β : EReal) → 0 < t → t < 1 →
f ((1 - t) • x + t • y) <
((1 - t : Real) : EReal) * (α : EReal) + ((t : Real) : EReal) * (β : EReal)) :
∀ x y : (Fin n → Real), ∀ μ v t : Real,
f x ≤ (μ : EReal) → f y ≤ (v : EReal) → 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤
(((1 - t) * μ + t * v : Real) : EReal)
Theorem 4.2: Let f be a function from ℝ^n to [-∞, +∞]. Then f is convex iff f ((1 - λ) • x + λ • y) < (1 - λ) * α + λ * β for 0 < λ < 1, whenever f x < α and f y < β.
open scoped Matrix Topology
theorem convexFunctionOn_univ_iff_strict_inequality {n : Nat}
{f : (Fin n -> Real) → EReal} :
ConvexFunctionOn (Set.univ) f ↔
∀ x y : (Fin n → Real), ∀ α β : Real, ∀ t : Real,
f x < (α : EReal) → f y < (β : EReal) →
0 < t → t < 1 →
f ((1 - t) • x + t • y) <
((1 - t : Real) : EReal) * (α : EReal) + ((t : Real) : EReal) * (β : EReal)
Distribute a finite nonnegative scalar over a finite EReal sum.
open scoped Matrix Topology
lemma EReal.mul_sum_of_nonneg_of_ne_top {α : Type*} {s : Finset α} {a : EReal}
(ha : 0 ≤ a) (ha_top : a ≠ ⊤) (f : α → EReal) :
a * (Finset.sum s f) = Finset.sum s (fun i => a * f i)
If nonnegative weights sum to one and the head weight is one, all tail weights vanish.
open scoped Matrix Topology
lemma tail_weights_zero_of_head_eq_one {m : Nat} {w : Fin (m + 1) → Real}
(hw : ∀ i, 0 ≤ w i) (hsum : (∑ i : Fin (m + 1), w i) = 1) (h0 : w 0 = 1) :
∀ i : Fin m, w (Fin.succ i) = 0
Jensen inequality from convexity on the whole space.
open scoped Matrix Topology
lemma jensen_inequality_of_convexFunctionOn_univ {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (Set.univ) f) (hnotbot : ∀ x, f x ≠ ⊥) :
∀ m : Nat, ∀ w : Fin m → Real, ∀ x : Fin m → (Fin n → Real),
(∀ i, 0 ≤ w i) → (Finset.univ.sum (fun i => w i) = 1) →
f (Finset.univ.sum (fun i => w i • x i)) ≤
Finset.univ.sum (fun i => ((w i : Real) : EReal) * f (x i))
Jensen inequality for m = 2 yields the segment inequality.
open scoped Matrix Topology
lemma segment_inequality_of_jensen {n : Nat} {f : (Fin n → Real) → EReal}
(hjensen :
∀ m : Nat, ∀ w : Fin m → Real, ∀ x : Fin m → (Fin n → Real),
(∀ i, 0 ≤ w i) → (Finset.univ.sum (fun i => w i) = 1) →
f (Finset.univ.sum (fun i => w i • x i)) ≤
Finset.univ.sum (fun i => ((w i : Real) : EReal) * f (x i))) :
∀ x y : (Fin n → Real), ∀ t : Real, 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤
((1 - t : Real) : EReal) * f x + ((t : Real) : EReal) * f y
Theorem 4.3 (Jensen's Inequality): Let f be a function from R^n to (-∞, +∞]. Then f is convex iff f (lambda_1 x_1 + ... + lambda_m x_m) ≤ lambda_1 f x_1 + ... + lambda_m f x_m whenever lambda_1, ..., lambda_m ≥ 0 and lambda_1 + ... + lambda_m = 1.
open scoped Matrix Topology
theorem convexFunctionOn_univ_iff_jensen_inequality {n : Nat}
(f : (Fin n → Real) → EReal) (hnotbot : ∀ x, f x ≠ ⊥) :
ConvexFunctionOn (Set.univ) f ↔
∀ m : Nat, ∀ w : Fin m → Real, ∀ x : Fin m → (Fin n → Real),
(∀ i, 0 ≤ w i) → (Finset.univ.sum (fun i => w i) = 1) →
f (Finset.univ.sum (fun i => w i • x i)) ≤
Finset.univ.sum (fun i => ((w i : Real) : EReal) * f (x i))
Definition 4.3: An affine function on S is a function which is finite, convex, and concave.
open scoped Matrix Topology
def AffineFunctionOn {n : Nat} (S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
Prop :=
(∀ x ∈ S, f x ≠ ⊥ ∧ f x ≠ ⊤) ∧
ConvexFunctionOn S f ∧
Convex ℝ {p : Prod (Fin n -> Real) Real | p.1 ∈ S ∧ ((p.2 : EReal) <= f p.1)}
On an open interval, the derivative within equals the usual derivative.
open scoped Matrix Topology
lemma derivWithin_Ioo_eq_deriv {g : ℝ → ℝ} {α β x : ℝ} (hx : x ∈ Set.Ioo α β) :
derivWithin g (Set.Ioo α β) x = deriv g x
Nonnegative second derivative implies convexity on an open interval.
open scoped Matrix Topology
lemma convexOn_Ioo_of_second_deriv_nonneg {f : ℝ → ℝ} {α β : ℝ}
(hcont : ContDiffOn ℝ 2 f (Set.Ioo α β))
(hderiv2 : ∀ x ∈ Set.Ioo α β, 0 ≤ deriv (deriv f) x) :
ConvexOn ℝ (Set.Ioo α β) f
Convexity on an open interval forces a nonnegative second derivative.
open scoped Matrix Topology
lemma second_deriv_nonneg_of_convexOn_Ioo {f : ℝ → ℝ} {α β : ℝ}
(hcont : ContDiffOn ℝ 2 f (Set.Ioo α β)) (hconv : ConvexOn ℝ (Set.Ioo α β) f) :
∀ x ∈ Set.Ioo α β, 0 ≤ deriv (deriv f) x
Theorem 4.4: Let f be a twice continuously differentiable real-valued function on an open interval (α, β). Then f is convex iff its second derivative f'' is nonnegative throughout (α, β).
open scoped Matrix Topology
theorem convexOn_interval_iff_second_deriv_nonneg {f : ℝ → ℝ} {α β : ℝ}
(hcont : ContDiffOn ℝ 2 f (Set.Ioo α β)) :
ConvexOn ℝ (Set.Ioo α β) f ↔
∀ x ∈ Set.Ioo α β, 0 ≤ deriv (deriv f) x
Restricting a C^2 function to a line is C^2 on any interval contained in C.
open scoped Matrix Topology
lemma contDiffOn_line_restrict {n : Nat} {C : Set (Fin n → ℝ)} {f : (Fin n → ℝ) → ℝ}
(hcont : ContDiffOn ℝ 2 f C) {y z : Fin n → ℝ} {a b : ℝ}
(hmem : ∀ t ∈ Set.Ioo a b, y + t • z ∈ C) :
ContDiffOn ℝ 2 (fun t : ℝ => f (y + t • z)) (Set.Ioo a b)
An open set contains a small open interval of a line through any point.
open scoped Matrix Topology
lemma exists_line_interval_subset {n : Nat} {C : Set (Fin n → ℝ)} (hopen : IsOpen C)
{x : Fin n → ℝ} (hx : x ∈ C) (z : Fin n → ℝ) :
∃ ε : ℝ, 0 < ε ∧ ∀ t ∈ Set.Ioo (-ε) ε, x + t • z ∈ C
Convexity of a function on C implies convexity of its restriction to any line segment in C.
open scoped Matrix Topology
lemma convexOn_line_restrict {n : Nat} {C : Set (Fin n → ℝ)} {f : (Fin n → ℝ) → ℝ}
(hconv : ConvexOn ℝ C f) {y z : Fin n → ℝ} {a b : ℝ}
(hmem : ∀ t ∈ Set.Ioo a b, y + t • z ∈ C) :
ConvexOn ℝ (Set.Ioo a b) (fun t : ℝ => f (y + t • z))
The Hessian matrix defined by iterated coordinate derivatives.
open scoped Matrix Topology
noncomputable def hessianMatrix {n : Nat} (f : (Fin n → ℝ) → ℝ) (x : Fin n → ℝ) :
Matrix (Fin n) (Fin n) ℝ :=
fun i j =>
deriv (fun t : ℝ => deriv (fun s : ℝ =>
f (x + s • (Pi.single (M := fun _ : Fin n => ℝ) i (1 : ℝ)) +
t • (Pi.single (M := fun _ : Fin n => ℝ) j (1 : ℝ)))) 0) 0
Over ℝ, the quadratic form in Matrix.PosSemidef uses no conjugation.
open scoped Matrix Topology
lemma posSemidef_iff_real {n : Nat} (M : Matrix (Fin n) (Fin n) ℝ) :
Matrix.PosSemidef M ↔ M.IsHermitian ∧ ∀ x, 0 ≤ x ⬝ᵥ (M *ᵥ x)
Derivative along a line equals the Fréchet derivative applied to the direction.
open scoped Matrix Topology
lemma line_deriv_eq_fderiv {n : Nat} {f : (Fin n → ℝ) → ℝ} {y z : Fin n → ℝ} {t : ℝ}
(hderiv : DifferentiableAt ℝ f (y + t • z)) :
deriv (fun s : ℝ => f (y + s • z)) t = (fderiv ℝ f (y + t • z)) z
Coordinate second derivatives match the second Fréchet derivative on basis vectors.
open scoped Matrix Topology
lemma hessian_entry_eq_fderiv {n : Nat} {f : (Fin n → ℝ) → ℝ} {x : Fin n → ℝ}
(hcont : ContDiffAt ℝ 2 f x) (i j : Fin n) :
hessianMatrix f x i j =
(fderiv ℝ (fderiv ℝ f) x)
(Pi.single (M := fun _ : Fin n => ℝ) i (1 : ℝ))
(Pi.single (M := fun _ : Fin n => ℝ) j (1 : ℝ))
Second derivatives along lines are given by the Hessian quadratic form.
open scoped Matrix Topology
lemma line_second_deriv_eq_quadratic_form {n : Nat} {C : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → ℝ} (hopen : IsOpen C) (hcont : ContDiffOn ℝ 2 f C)
{y z : Fin n → ℝ} {t : ℝ} (ht : y + t • z ∈ C) :
deriv (deriv (fun s : ℝ => f (y + s • z))) t =
star z ⬝ᵥ (hessianMatrix f (y + t • z) *ᵥ z)
The Hessian matrix is Hermitian at points of an open C^2 set.
open scoped Matrix Topology
lemma hessian_symm {n : Nat} {C : Set (Fin n → ℝ)} {f : (Fin n → ℝ) → ℝ}
(hopen : IsOpen C) (hcont : ContDiffOn ℝ 2 f C) {x : Fin n → ℝ} (hx : x ∈ C) :
(hessianMatrix f x).IsHermitian
Convexity implies positive semidefiniteness of the Hessian.
open scoped Matrix Topology
lemma hessian_posSemidef_of_convexOn {n : Nat} {C : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → ℝ} (hopen : IsOpen C)
(hcont : ContDiffOn ℝ 2 f C) (hconv : ConvexOn ℝ C f) :
∀ x ∈ C, Matrix.PosSemidef (hessianMatrix f x)
Positive semidefinite Hessian implies convexity.
open scoped Matrix Topology
lemma convexOn_of_hessian_posSemidef {n : Nat} {C : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → ℝ} (hC : Convex ℝ C) (hopen : IsOpen C)
(hcont : ContDiffOn ℝ 2 f C)
(hpos : ∀ x ∈ C, Matrix.PosSemidef (hessianMatrix f x)) :
ConvexOn ℝ C f
Theorem 4.5: Let f be a twice continuously differentiable real-valued function on an open convex set C in ℝ^n. Then f is convex on C iff its Hessian matrix Q_x = (q_ij(x)) with q_ij(x) = ∂^2 f / ∂ ξ_i ∂ ξ_j (x) is positive semidefinite for every x ∈ C.
open scoped Matrix Topology
theorem convexOn_iff_hessian_posSemidef {n : Nat} {C : Set (Fin n → ℝ)}
{f : (Fin n → ℝ) → ℝ} (hC : Convex ℝ C) (hopen : IsOpen C)
(hcont : ContDiffOn ℝ 2 f C) :
ConvexOn ℝ C f ↔
∀ x ∈ C,
Matrix.PosSemidef (fun i j : Fin n =>
deriv (fun t : ℝ => deriv (fun s : ℝ =>
f (x + s • (Pi.single (M := fun _ : Fin n => ℝ) i (1 : ℝ)) +
t • (Pi.single (M := fun _ : Fin n => ℝ) j (1 : ℝ)))) 0) 0)
Lift real convexity to ConvexFunctionOn for finite-valued functions.
open scoped Matrix Topology
lemma convexFunctionOn_of_convexOn_real {n : Nat} {S : Set (Fin n → ℝ)}
{g : (Fin n → ℝ) → ℝ} (hg : ConvexOn ℝ S g) :
ConvexFunctionOn S (fun x => (g x : EReal))
Extending by ⊤ outside a convex domain preserves convexity on Set.univ.
open scoped Matrix Topology
lemma convexFunctionOn_univ_if_top {n : Nat} {C : Set (Fin n → ℝ)}
{g : (Fin n → ℝ) → ℝ} (hg : ConvexOn ℝ C g) :
ConvexFunctionOn Set.univ (fun x => by
classical
exact if x ∈ C then (g x : EReal) else (⊤ : EReal))
Pull back convexity along the coordinate projection on Fin 1.
open scoped Matrix Topology
lemma convexOn_comp_proj {s : Set ℝ} {f : ℝ → ℝ} (hf : ConvexOn ℝ s f) :
ConvexOn ℝ ((LinearMap.proj (R := ℝ) (φ := fun _ : Fin 1 => ℝ) 0) ⁻¹' s)
(fun x : Fin 1 → ℝ => f (x 0))
x ↦ x^p is convex on (0, ∞) for p ≤ 0.
open scoped Matrix Topology
lemma convexOn_rpow_Ioi_of_nonpos {p : ℝ} (hp : p ≤ 0) :
ConvexOn ℝ (Set.Ioi 0) (fun x : ℝ => x ^ p)
x ↦ x^p is antitone on (0, ∞) for p ≤ 0.
open scoped Matrix Topology
lemma antitoneOn_rpow_Ioi_of_nonpos {p : ℝ} (hp : p ≤ 0) :
AntitoneOn (fun x : ℝ => x ^ p) (Set.Ioi 0)
x ↦ a^2 - x^2 is concave on (-a, a).
open scoped Matrix Topology
lemma concaveOn_sub_sq_Ioo (a : ℝ) :
ConcaveOn ℝ (Set.Ioo (-a) a) (fun x : ℝ => a ^ 2 - x ^ 2)
Image of x ↦ a^2 - x^2 on (-a, a) is (0, a^2].
open scoped Matrix Topology
lemma image_sub_sq_Ioo {a : ℝ} (ha : 0 < a) :
(fun x : ℝ => a ^ 2 - x ^ 2) '' Set.Ioo (-a) a = Set.Ioc 0 (a ^ 2)
Example 4.4.1: Here are some functions on Real whose convexity is a consequence of Theorem 4.4: (i) f(x) = exp(alpha * x) for -infty < alpha < infty; (ii) f(x) = x^p if x >= 0, f(x) = infty if x < 0, where 1 <= p < infty; (iii) f(x) = -x^p if x >= 0, f(x) = infty if x < 0, where 0 <= p <= 1; (iv) f(x) = x^p if x > 0, f(x) = infty if x <= 0, where -infty < p <= 0; (v) f(x) = (alpha^2 - x^2)^(-1/2) if |x| < alpha, f(x) = infty if |x| >= alpha, where alpha > 0; (vi) f(x) = -log x if x > 0, f(x) = infty if x <= 0.
open scoped Matrix Topology
lemma convexFunctionOn_example_functions :
(∀ a : Real,
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
(Real.exp (a * x 0) : EReal))) ∧
(∀ p : Real, 1 ≤ p →
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
if 0 ≤ x 0 then ((Real.rpow (x 0) p : Real) : EReal) else (⊤ : EReal))) ∧
(∀ p : Real, 0 ≤ p → p ≤ 1 →
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
if 0 ≤ x 0 then ((- Real.rpow (x 0) p : Real) : EReal) else (⊤ : EReal))) ∧
(∀ p : Real, p ≤ 0 →
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
if 0 < x 0 then ((Real.rpow (x 0) p : Real) : EReal) else (⊤ : EReal))) ∧
(∀ a : Real, 0 < a →
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
if |x 0| < a then
((Real.rpow (a ^ 2 - (x 0) ^ 2) (-((1 : Real) / 2)) : Real) : EReal)
else (⊤ : EReal))) ∧
ConvexFunctionOn (Set.univ) (fun x : Fin 1 → Real =>
if 0 < x 0 then ((- Real.log (x 0) : Real) : EReal) else (⊤ : EReal))
Definition 4.4: The effective domain of a convex function f on S, denoted dom f, is the projection of epi f onto R^n; equivalently, dom f = {x | ∃ μ, (x, μ) ∈ epi f} = {x | f x < +infty}.
open scoped Matrix Topology
def effectiveDomain {n : Nat} (S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
Set (Fin n -> Real) :=
{x | ∃ μ : Real, (x, μ) ∈ epigraph S f}
open scoped Matrix Topology
lemma effectiveDomain_eq {n : Nat} (S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
effectiveDomain S f = {x | x ∈ S ∧ f x < (⊤ : EReal)}
The effective domain is the projection of the epigraph onto the first coordinate.
open scoped Matrix Topology
lemma effectiveDomain_eq_image_fst {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) :
effectiveDomain S f =
(LinearMap.fst ℝ (Fin n -> Real) Real) '' epigraph S f
The image of the epigraph under the first projection is convex.
open scoped Matrix Topology
lemma convex_image_fst_epigraph {n : Nat} {S : Set (Fin n -> Real)}
{f : (Fin n -> Real) -> EReal} (hf : ConvexFunctionOn S f) :
Convex ℝ ((LinearMap.fst ℝ (Fin n -> Real) Real) '' epigraph S f)§4 — Convex Functions — Part 2
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
Prop 4.4.1: The effective domain of a convex function is a convex set in ℝ^n.
open scoped Matrix Topology
lemma effectiveDomain_convex {n : Nat} {S : Set (Fin n -> Real)}
{f : (Fin n -> Real) -> EReal} (hf : ConvexFunctionOn S f) :
Convex ℝ (effectiveDomain S f)
The effective domain is contained in the original set.
open scoped Matrix Topology
lemma effectiveDomain_subset {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) :
effectiveDomain S f ⊆ S
The epigraph is unchanged by restricting to the effective domain.
open scoped Matrix Topology
lemma epigraph_effectiveDomain_eq {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) :
epigraph (effectiveDomain S f) f = epigraph S f
Prop 4.4.2: Trivially, the convexity of f is equivalent to that of the restriction of f to dom f (the effective domain). All the interest really centers on this restriction, and S has little role of its own.
open scoped Matrix Topology
lemma convexFunctionOn_iff_convexFunctionOn_effectiveDomain {n : Nat}
(S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
ConvexFunctionOn S f ↔ ConvexFunctionOn (effectiveDomain S f) f
The inequality ⊤ ≤ (r : EReal) never holds for real r.
open scoped Matrix Topology
lemma not_top_le_coe (r : Real) : ¬ ((⊤ : EReal) ≤ (r : EReal))
The constant ⊤ function is convex on any set.
open scoped Matrix Topology
lemma convexFunctionOn_const_top {n : Nat} (C : Set (Fin n -> Real)) :
ConvexFunctionOn C (fun _ => (⊤ : EReal))
The effective domain of the constant ⊤ function is empty.
open scoped Matrix Topology
lemma effectiveDomain_const_top {n : Nat} (C : Set (Fin n -> Real)) :
effectiveDomain C (fun _ => (⊤ : EReal)) = (∅ : Set (Fin n -> Real))
Remark 4.4.5: There are weighty reasons, soon apparent, why one does not want to consider merely the class of all convex functions having a fixed set C as their common effective domain.
open scoped Matrix Topology
lemma fixedEffectiveDomain_restriction_not_preferred {n : Nat} (C : Set (Fin n -> Real))
(hC : Set.Nonempty C) :
¬ (∀ f : (Fin n -> Real) → EReal, ConvexFunctionOn C f → effectiveDomain C f = C)
Defintion 4.4.6: The forbidden sums are ⊤ + ⊥ (that is, ⊤ - ⊤) and ⊥ + ⊤ in the extended real line.
open scoped Matrix Topology
def ERealForbiddenSum (a b : EReal) : Prop :=
(a = ⊤ ∧ b = ⊥) ∨ (a = ⊥ ∧ b = ⊤)
Defintion 4.4.6: Conventions for arithmetic on EReal include α + ⊤ = ⊤ + α = ⊤ for ⊥ < α, α - ⊤ = ⊥ + α = ⊥ for α < ⊤, rules for multiplication by ⊤ or ⊥ depending on the sign of α, the identities 0 * ⊤ = ⊤ * 0 = 0 = 0 * ⊥ = ⊥ * 0, -⊥ = ⊤, and sInf ∅ = ⊤, sSup ∅ = ⊥.
open scoped Matrix Topology
def ERealArithmeticConventions : Prop :=
(∀ α : EReal, ⊥ < α → α + ⊤ = ⊤ ∧ ⊤ + α = ⊤) ∧
(∀ α : EReal, α < ⊤ → α - ⊤ = ⊥ ∧ ⊥ + α = ⊥) ∧
(∀ α : EReal, 0 < α → α * ⊤ = ⊤ ∧ ⊤ * α = ⊤) ∧
(∀ α : EReal, 0 < α → α * ⊥ = ⊥ ∧ ⊥ * α = ⊥) ∧
(∀ α : EReal, α < 0 → α * ⊤ = ⊥ ∧ ⊤ * α = ⊥) ∧
(∀ α : EReal, α < 0 → α * ⊥ = ⊤ ∧ ⊥ * α = ⊤) ∧
(0 * (⊤ : EReal) = 0 ∧ (⊤ : EReal) * 0 = 0 ∧ 0 * (⊥ : EReal) = 0 ∧
(⊥ : EReal) * 0 = 0) ∧
(-(⊥ : EReal) = ⊤) ∧
(sInf (∅ : Set EReal) = (⊤ : EReal) ∧ sSup (∅ : Set EReal) = (⊥ : EReal))
Negating both arguments preserves the forbidden-sum condition.
open scoped Matrix Topology
lemma ereal_forbiddenSum_neg_iff {a b : EReal} :
ERealForbiddenSum (-a) (-b) ↔ ERealForbiddenSum a b
Disjunctions needed to apply EReal.neg_add from a non-forbidden sum.
open scoped Matrix Topology
lemma ereal_no_forbidden_neg_add {a b : EReal} (h : ¬ ERealForbiddenSum a b) :
(a ≠ ⊥ ∨ b ≠ ⊤) ∧ (a ≠ ⊤ ∨ b ≠ ⊥)
Left distributivity for multiplication by ⊤ under a non-forbidden sum.
open scoped Matrix Topology
lemma ereal_top_mul_add_of_no_forbidden {x1 x2 : EReal}
(h : ¬ ERealForbiddenSum ((⊤ : EReal) * x1) ((⊤ : EReal) * x2)) :
(⊤ : EReal) * (x1 + x2) = (⊤ : EReal) * x1 + (⊤ : EReal) * x2§4 — Convex Functions — Part 3
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
Left distributivity for multiplication by ⊥ under a non-forbidden sum.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_bot_mul_add_of_no_forbidden {x1 x2 : EReal}
(h : ¬ ERealForbiddenSum ((⊥ : EReal) * x1) ((⊥ : EReal) * x2)) :
(⊥ : EReal) * (x1 + x2) = (⊥ : EReal) * x1 + (⊥ : EReal) * x2
Left distributivity under a non-forbidden sum.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_mul_add_of_no_forbidden {α x1 x2 : EReal}
(hα : ¬ ERealForbiddenSum (α * x1) (α * x2)) :
α * (x1 + x2) = α * x1 + α * x2
Defintion 4.4.6: Under these conventions, the usual arithmetic laws remain valid as long as none of the indicated binary sums is forbidden.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_arithmetic_laws_of_no_forbidden {x1 x2 x3 α : EReal}
(_h12 : ¬ ERealForbiddenSum x1 x2)
(_h23 : ¬ ERealForbiddenSum x2 x3)
(_h123 : ¬ ERealForbiddenSum (x1 + x2) x3)
(_h123' : ¬ ERealForbiddenSum x1 (x2 + x3))
(hα : ¬ ERealForbiddenSum (α * x1) (α * x2)) :
x1 + x2 = x2 + x1 ∧ (x1 + x2) + x3 = x1 + (x2 + x3) ∧
x1 * x2 = x2 * x1 ∧ (x1 * x2) * x3 = x1 * (x2 * x3) ∧
α * (x1 + x2) = α * x1 + α * x2
Remark 4.4.7: In this book, a “convex function” means an EReal-valued convex function defined on all of ℝ^n, unless otherwise specified; this convention lets the effective domain be determined implicitly by where f x is or is not ⊤.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
def ConvexFunction {n : Nat} (f : (Fin n -> Real) -> EReal) : Prop :=
ConvexFunctionOn (Set.univ) f
Convex combinations preserve linear-plus-constant forms.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma inner_add_const_combo_eq {n : Nat} (a : Fin n → Real) (α t : Real)
(x y : Fin n → Real) :
((Finset.univ.sum (fun i => ((1 - t) • x + t • y) i * a i) + α : Real) : EReal)
= ((1 - t : Real) : EReal) * ((Finset.univ.sum (fun i => x i * a i) + α : Real) : EReal)
+ ((t : Real) : EReal) * ((Finset.univ.sum (fun i => y i * a i) + α : Real) : EReal)
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma affineFunctionOn_univ_inner_add_const {n : Nat} (a : Fin n → Real) (α : Real) :
AffineFunctionOn (Set.univ) (fun x : Fin n → Real =>
((Finset.univ.sum (fun i => x i * a i) + α : Real) : EReal))
Affine functions on Set.univ agree with convex combinations.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma affineFunctionOn_univ_eq_combo {n : Nat} {f : (Fin n → Real) → EReal}
(hf : AffineFunctionOn (Set.univ) f) :
∀ x y t, 0 ≤ t → t ≤ 1 →
f ((1 - t) • x + t • y) =
((1 - t : Real) : EReal) * f x + ((t : Real) : EReal) * f y
Subtracting the value at 0 gives a linear map for an affine function.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma affineFunctionOn_univ_toReal_linearMap {n : Nat} {f : (Fin n → Real) → EReal}
(hf : AffineFunctionOn (Set.univ) f) :
∃ A : (Fin n → Real) →ₗ[Real] Real, ∀ x, (f x).toReal = A x + (f 0).toReal
A linear functional on Fin n → ℝ is determined by its values on the standard basis.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma linearMap_apply_eq_sum_mul_basis {n : Nat} (A : (Fin n → Real) →ₗ[Real] Real)
(x : Fin n → Real) :
A x = ∑ i, x i * A (fun j => if j = i then 1 else 0)
Remark 4.5.0: Every affine function on ℝ^n is of the form x ↦ ⟪x, a⟫ + α for some a ∈ ℝ^n and α ∈ ℝ (Theorem 1.5).
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma affineFunctionOn_univ_exists_inner_add_const {n : Nat}
{f : (Fin n → Real) → EReal} (hf : AffineFunctionOn (Set.univ) f) :
∃ a : Fin n → Real, ∃ α : Real, ∀ x,
f x = ((Finset.univ.sum (fun i => x i * a i) + α : Real) : EReal)
Definition 4.5: The dimension of the effective domain of f is called the dimension of f.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
noncomputable def functionDimension {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) :
Nat :=
Module.finrank ℝ (affineSpan ℝ (effectiveDomain S f)).direction
If x ∈ S and f x ≤ μ, then (x, μ) is in the epigraph.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma epigraph_mem_of_le {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x : Fin n → Real} {μ : Real}
(hx : x ∈ S) (hμ : f x ≤ (μ : EReal)) : (x, μ) ∈ epigraph S f
Convexity of the epigraph yields convex combinations of points in it.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_combo_mem_epigraph {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x y : Fin n → Real} {μ v t : Real}
(hconv : Convex ℝ (epigraph S f))
(hx : (x, μ) ∈ epigraph S f) (hy : (y, v) ∈ epigraph S f)
(ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
(1 - t) • (x, μ) + t • (y, v) ∈ epigraph S f
Unpack epigraph membership of a convex combination.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma epigraph_combo_proj {n : Nat} {S : Set (Fin n → Real)}
{f : (Fin n → Real) → EReal} {x y : Fin n → Real} {μ v t : Real} :
((1 - t) • (x, μ) + t • (y, v)) ∈ epigraph S f →
((1 - t) • x + t • y) ∈ S ∧
f ((1 - t) • x + t • y) ≤
(((1 - t) * μ + t * v : Real) : EReal)
Remark 4.5.1: For convexity of the epigraph, one requires that for any x, y ∈ S, any μ, v ∈ ℝ with f x ≤ μ and f y ≤ v, and any 0 ≤ λ ≤ 1, the point (1 - λ) x + λ y lies in S and satisfies f ((1 - λ) x + λ y) ≤ (1 - λ) μ + λ v; this condition admits several equivalent formulations.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexFunctionOn_epigraph_condition {n : Nat} {S : Set (Fin n -> Real)}
{f : (Fin n -> Real) -> EReal} (hf : ConvexFunctionOn S f) :
∀ x ∈ S, ∀ y ∈ S, ∀ μ v : Real,
f x ≤ (μ : EReal) → f y ≤ (v : EReal) →
∀ t : Real, 0 ≤ t → t ≤ 1 →
((1 - t) • x + t • y) ∈ S ∧
f ((1 - t) • x + t • y) ≤
(((1 - t) * μ + t * v : Real) : EReal)
Expansion of the quadratic form on a linear combination.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma quadratic_combo_expansion {n : Nat} {Q : Matrix (Fin n) (Fin n) ℝ}
(x y : Fin n → ℝ) (t u : ℝ) :
dotProduct (t • x + u • y) (Q.mulVec (t • x + u • y)) =
t ^ 2 * dotProduct x (Q.mulVec x) + u ^ 2 * dotProduct y (Q.mulVec y) +
t * u * (dotProduct x (Q.mulVec y) + dotProduct y (Q.mulVec x))
Quadratic form of a difference expressed via cross terms.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma quadratic_sub_cross {n : Nat} {Q : Matrix (Fin n) (Fin n) ℝ}
(x y : Fin n → ℝ) :
dotProduct (x - y) (Q.mulVec (x - y)) =
dotProduct x (Q.mulVec x) + dotProduct y (Q.mulVec y) -
(dotProduct x (Q.mulVec y) + dotProduct y (Q.mulVec x))
Convexity of the quadratic function forces its quadratic form to be nonnegative.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexity_implies_quadratic_nonneg {n : Nat}
{Q : Matrix (Fin n) (Fin n) ℝ} {a : Fin n → ℝ} {α : ℝ}
(hconv : ConvexOn ℝ (Set.univ) (fun x : Fin n → ℝ =>
(1 / 2 : ℝ) * dotProduct x (Q.mulVec x) + dotProduct x a + α)) :
∀ x, 0 ≤ dotProduct x (Q.mulVec x)
Positive semidefinite quadratic form yields convexity of the quadratic function.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma posSemidef_implies_convexity_quadratic {n : Nat}
{Q : Matrix (Fin n) (Fin n) ℝ} {a : Fin n → ℝ} {α : ℝ}
(hpos : Matrix.PosSemidef Q) :
ConvexOn ℝ (Set.univ) (fun x : Fin n → ℝ =>
(1 / 2 : ℝ) * dotProduct x (Q.mulVec x) + dotProduct x a + α)
Remark 4.5.1: A quadratic function f x = (1/2) ⟪x, Q x⟫ + ⟪x, a⟫ + α, where Q is a symmetric n × n matrix, is convex on ℝ^n iff Q is positive semidefinite, i.e. ⟪z, Q z⟫ ≥ 0 for every z ∈ ℝ^n.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexOn_quadratic_iff_posSemidef {n : Nat}
{Q : Matrix (Fin n) (Fin n) ℝ} {a : Fin n → ℝ} {α : ℝ}
(hQ : Matrix.IsSymm Q) :
ConvexOn ℝ (Set.univ) (fun x : Fin n → ℝ =>
((1 / 2 : ℝ) * dotProduct x (Q.mulVec x) + dotProduct x a + α)) ↔
Matrix.PosSemidef Q
Cauchy-Schwarz for Fin n: the square of the sum is bounded by n times the sum of squares.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma sum_sq_le_n_mul_sum_sq {n : Nat} (u : Fin n → Real) :
(Finset.univ.sum u) ^ 2 ≤ (n : Real) * Finset.univ.sum (fun i => (u i) ^ 2)
The closure of the positive orthant is the nonnegative orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma closure_posOrthant_eq_nonneg {n : Nat} :
closure {x : Fin n → Real | ∀ i, 0 < x i} = {x | ∀ i, 0 ≤ x i}
The positive orthant is open.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma isOpen_posOrthant {n : Nat} : IsOpen {x : Fin n → Real | ∀ i, 0 < x i}
The positive orthant is convex.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_posOrthant {n : Nat} : Convex ℝ {x : Fin n → Real | ∀ i, 0 < x i}
The coordinate product is C^2 on any set.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma contDiffOn_prod_coord {n : Nat} {C : Set (Fin n → Real)} :
ContDiffOn ℝ 2 (fun x : Fin n → Real => ∏ i, x i) C
The coordinate product is nonzero on the positive orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma prod_ne_zero_of_pos {n : Nat} {x : Fin n → Real} (hx : ∀ i, 0 < x i) :
(Finset.univ.prod (fun i => x i)) ≠ 0
The negative geometric mean is C^2 on the positive orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma contDiffOn_negGeomMean_pos {n : Nat} :
ContDiffOn ℝ 2 (fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))))
{x | ∀ i, 0 < x i}
Product over Finset.univ with two entries removed.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma prod_erase_erase_eq_div {n : Nat} (x : Fin n → Real) (hx : ∀ i, x i ≠ 0) {i j : Fin n}
(hj : j ∈ (Finset.univ.erase i)) :
((Finset.univ.erase i).erase j).prod (fun k => x k) =
(Finset.univ.prod (fun k => x k)) / x i / x j
Off-diagonal double sum identity.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma sum_erase_mul_sum_eq_sum_sq_sub_sum_sq {n : Nat} (u : Fin n → Real) :
(∑ i, (Finset.sum (s := (Finset.univ.erase i)) (fun j => u i * u j))) =
(Finset.univ.sum u) ^ 2 - Finset.univ.sum (fun i => (u i) ^ 2)§4 — Convex Functions — Part 4
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
First derivative of the coordinate product along a line at 0.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_prod_deriv_at0 {n : Nat} {x z : Fin n → Real} (hx : ∀ i, x i ≠ 0) :
let P : ℝ → ℝ := fun t => Finset.univ.prod (fun i => x i + t * z i)
deriv P 0 = (Finset.univ.prod (fun i => x i)) * Finset.univ.sum (fun i => z i / x i)
Second derivative of the coordinate product along a line at 0.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_prod_second_deriv_at0 {n : Nat} {x z : Fin n → Real} (hx : ∀ i, x i ≠ 0) :
let P : ℝ → ℝ := fun t => Finset.univ.prod (fun i => x i + t * z i)
deriv (deriv P) 0 =
(Finset.univ.prod (fun i => x i)) *
((Finset.univ.sum (fun i => z i / x i)) ^ 2 -
Finset.univ.sum (fun i => (z i / x i) ^ 2))
The negative geometric mean is continuous on the nonnegative orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma continuousOn_negGeomMean_nonneg {n : Nat} :
ContinuousOn (fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))))
{x | ∀ i, 0 ≤ x i}
The line product is nonzero near 0 when the base point is positive.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma prod_line_ne_zero_eventually {n : Nat} {x z : Fin n → Real} (hx : ∀ i, 0 < x i) :
∀ᶠ t in 𝓝 (0 : ℝ),
(Finset.univ.prod (fun i => x i + t * z i)) ≠ 0
The derivative of the line product is differentiable at 0.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma deriv_line_prod_differentiable_at0 {n : Nat} {x z : Fin n → Real} :
DifferentiableAt ℝ
(fun t => deriv (fun s => Finset.univ.prod (fun i => x i + s * z i)) t) 0
Second derivative of t ↦ (P t)^a at 0 under a local nonzero hypothesis.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma line_rpow_second_deriv_at0 {P : ℝ → ℝ} {a : ℝ}
(hP0 : P 0 ≠ 0)
(hP_diff : ∀ᶠ t in 𝓝 0, DifferentiableAt ℝ P t)
(hP_near : ∀ᶠ t in 𝓝 0, P t ≠ 0)
(hP0_diff : DifferentiableAt ℝ P 0)
(hP' : DifferentiableAt ℝ (deriv P) 0) :
deriv (deriv (fun t => (P t) ^ a)) 0 =
a * (a - 1) * (P 0) ^ (a - 1 - 1) * (deriv P 0) ^ 2 +
a * (P 0) ^ (a - 1) * deriv (deriv P) 0
Second derivative of the negative geometric mean along a line.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_line_second_deriv {n : Nat} (hn : n ≠ 0) {x z : Fin n → Real}
(hx : ∀ i, 0 < x i) :
let g : (Fin n → Real) → Real :=
fun x => -(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real)))
deriv (deriv (fun t : ℝ => g (x + t • z))) 0 =
(1 / (n : Real)) ^ 2 * g x *
((∑ i, z i / x i) ^ 2 - (n : Real) * ∑ i, (z i / x i) ^ 2)
The Hessian quadratic form for the negative geometric mean.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_hessian_quadratic_form {n : Nat} (hn : n ≠ 0) {x z : Fin n → Real}
(hx : ∀ i, 0 < x i) :
star z ⬝ᵥ
(hessianMatrix (fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real)))) x *ᵥ z) =
(1 / (n : Real)) ^ 2 *
(-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real)))) *
((∑ i, z i / x i) ^ 2 - (n : Real) * ∑ i, (z i / x i) ^ 2)
Nonnegativity of the quadratic form for the negative geometric mean.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_quadratic_form_nonneg {n : Nat} {x z : Fin n → Real}
(hx : ∀ i, 0 < x i) :
0 ≤ (1 / (n : Real)) ^ 2 *
(-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real)))) *
((∑ i, z i / x i) ^ 2 - (n : Real) * ∑ i, (z i / x i) ^ 2)
The Hessian of the negative geometric mean is positive semidefinite on the positive orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma negGeomMean_hessian_posSemidef {n : Nat} (hn : n ≠ 0) :
∀ x, (∀ i, 0 < x i) →
Matrix.PosSemidef
(hessianMatrix (fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real)))) x)
Convexity of the negative geometric mean on the positive orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexOn_negGeomMean_pos {n : Nat} (hn : n ≠ 0) :
ConvexOn ℝ {x | ∀ i, 0 < x i}
(fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))))§4 — Convex Functions — Part 5
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
Extend convexity to the closure under continuity.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexOn_closure_of_continuousOn {n : Nat} {C : Set (Fin n → Real)}
{f : (Fin n → Real) → Real} (hconv : ConvexOn ℝ C f)
(hcont : ContinuousOn f (closure C)) :
ConvexOn ℝ (closure C) f
Convexity of the negative geometric mean on the nonnegative orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexOn_negGeomMean_nonneg {n : Nat} (hn : n ≠ 0) :
ConvexOn ℝ {x | ∀ i, 0 ≤ x i}
(fun x : Fin n → Real =>
-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))))
The effective domain of the negative geometric mean is the nonnegative orthant.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma effectiveDomain_negativeGeometricMean {n : Nat} :
effectiveDomain Set.univ (fun x : Fin n → Real =>
if (∀ i, 0 ≤ x i) then
(-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))) : EReal)
else (⊤ : EReal)) = {x | ∀ i, 0 ≤ x i}
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexFunction_negativeGeometricMean {n : Nat} :
(let f : (Fin n → Real) → EReal :=
fun x =>
if (∀ i, 0 ≤ x i) then
(-(Real.rpow (Finset.univ.prod (fun i => x i)) (1 / (n : Real))) : EReal)
else (⊤ : EReal);
ConvexFunction f)
Remark 4.5.3: One of the most important convex functions on ℝ^n is the Euclidean norm |x| = ⟪x, x⟫^{1/2} = (xi_1^2 + ... + xi_n^2)^{1/2}.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexOn_univ_euclidean_norm {n : Nat} :
ConvexOn ℝ (Set.univ) (fun x : EuclideanSpace ℝ (Fin n) => ‖x‖)
Remark 4.5.3: This Euclidean norm is the absolute value when n = 1.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma euclidean_norm_eq_abs (x : ℝ) : ‖x‖ = |x|
Strict real sublevel sets of a convex function are convex.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_sublevel_lt_real_of_convexFunction {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunction f) (r : Real) :
Convex ℝ {x | f x < (r : EReal)}
The strict sublevel at ⊤ is the effective domain, hence convex.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_sublevel_lt_top_of_convexFunction {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunction f) :
Convex ℝ {x | f x < (⊤ : EReal)}
A non-strict sublevel is the intersection of strict real sublevels above it.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma sublevel_le_eq_iInter_lt_real {n : Nat} {f : (Fin n → Real) → EReal} (α : EReal) :
{x | f x ≤ α} =
⋂ (β : {β : Real // (α : EReal) < β}), {x | f x < (β : EReal)}
Theorem 4.6: For any convex function f and any α ∈ [-∞, +∞], the level sets {x | f x < α} and {x | f x ≤ α} are convex.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
theorem convexFunction_level_sets_convex {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunction f) (α : EReal) :
Convex ℝ {x | f x < α} ∧ Convex ℝ {x | f x ≤ α}
Remark 4.6.1: Taking f to be a quadratic convex function in Theorem 4.6, the set {x | (1/2) ⟪x, Q x⟫ + ⟪x, a⟫ + α ≤ 0} is convex when Q is positive semidefinite (Theorem 4.5). Sets of this form include solid ellipsoids and paraboloids, in particular the ball {x | ⟪x, x⟫ ≤ 1}.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_quadratic_inequality_set {n : Nat}
{Q : Matrix (Fin n) (Fin n) ℝ} {a : Fin n → ℝ} {α : ℝ}
(hQ : Matrix.PosSemidef Q) :
Convex ℝ {x : Fin n → ℝ |
((1 / 2 : ℝ) * dotProduct x (Q.mulVec x) + dotProduct x a + α) ≤ 0}
Corollary 4.6.1: Let f_i be a convex function on ℝ^n and α_i be a real number for each i ∈ I. Then C = {x | f_i(x) ≤ α_i, ∀ i ∈ I} is a convex set.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_iInter_sublevel_sets {n : Nat} {I : Type*}
(f : I → (Fin n → Real) → EReal) (α : I → Real) (hf : ∀ i, ConvexFunction (f i)) :
Convex ℝ {x | ∀ i, f i x ≤ (α i : EReal)}
Remark 4.6.2: Theorem 4.6 and Corollary 4.6.1 are significant for systems of nonlinear inequalities. Convexity also enters other aspects of inequality theory, since various classical inequalities can be regarded as special cases of Theorem 4.3.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexity_inequality_analysis {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunction f) (hnotbot : ∀ x, f x ≠ ⊥) (β : EReal) {I : Type*}
(g : I → (Fin n → Real) → EReal) (α : I → Real) (hg : ∀ i, ConvexFunction (g i)) :
(Convex ℝ {x | f x < β} ∧ Convex ℝ {x | f x ≤ β}) ∧
Convex ℝ {x | ∀ i, g i x ≤ (α i : EReal)} ∧
(∀ m : Nat, ∀ w : Fin m → Real, ∀ x : Fin m → (Fin n → Real),
(∀ i, 0 ≤ w i) → (Finset.univ.sum (fun i => w i) = 1) →
f (Finset.univ.sum (fun i => w i • x i)) ≤
Finset.univ.sum (fun i => ((w i : Real) : EReal) * f (x i)))
Definition 4.6: A convex function f is proper if its epigraph is nonempty and contains no vertical lines (equivalently, f x ≠ ⊥ for all x ∈ S).
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
def ProperConvexFunctionOn {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) : Prop :=
ConvexFunctionOn S f ∧ Set.Nonempty (epigraph S f) ∧
∀ x ∈ S, f x ≠ (⊥ : EReal)
The epigraph is nonempty iff the effective domain is nonempty.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma nonempty_epigraph_iff_nonempty_effectiveDomain {n : Nat}
(S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
Set.Nonempty (epigraph S f) ↔ Set.Nonempty (effectiveDomain S f)
Points in the effective domain have value different from ⊤.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma mem_effectiveDomain_imp_ne_top {n : Nat} {S : Set (Fin n -> Real)}
{f : (Fin n -> Real) -> EReal} {x : Fin n -> Real} :
x ∈ effectiveDomain S f → f x ≠ (⊤ : EReal)
Points in S outside the effective domain cannot take value ⊥.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma not_mem_effectiveDomain_imp_ne_bot {n : Nat} {S : Set (Fin n -> Real)}
{f : (Fin n -> Real) -> EReal} {x : Fin n -> Real} (hxS : x ∈ S)
(hx : x ∉ effectiveDomain S f) : f x ≠ (⊥ : EReal)
Remark 4.6.1: f is proper iff the convex set C = dom f is nonempty and the restriction of f to C is finite; equivalently, a proper convex function on ℝ^n comes from a finite convex function on a nonempty convex set C and is extended by f x = +∞ outside C.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma properConvexFunctionOn_iff_effectiveDomain_nonempty_finite {n : Nat}
(S : Set (Fin n -> Real)) (f : (Fin n -> Real) -> EReal) :
ProperConvexFunctionOn S f ↔
(ConvexFunctionOn S f ∧ Set.Nonempty (effectiveDomain S f) ∧
∀ x ∈ effectiveDomain S f, f x ≠ (⊥ : EReal) ∧ f x ≠ (⊤ : EReal))
Definition 4.7: A convex function which is not proper is improper.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
def ImproperConvexFunctionOn {n : Nat} (S : Set (Fin n -> Real))
(f : (Fin n -> Real) -> EReal) : Prop :=
ConvexFunctionOn S f ∧ ¬ ProperConvexFunctionOn S f
Example 4.7.2: An improper convex function on ℝ that is not identically +∞ or -∞ is given by f x = -∞ if |x| < 1, f x = 0 if |x| = 1, and f x = +∞ if |x| > 1.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma improperConvexExample :
(let f : (Fin 1 → Real) → EReal :=
fun x =>
if |x 0| < 1 then (⊥ : EReal)
else if |x 0| = 1 then ((0 : Real) : EReal)
else (⊤ : EReal);
ImproperConvexFunctionOn (Set.univ) f ∧
¬ (∀ x, f x = (⊤ : EReal)) ∧
¬ (∀ x, f x = (⊥ : EReal)))
Definition 4.8: A function f on ℝ^n is positively homogeneous (of degree 1) if for every x and every λ with 0 < λ, one has f (λ • x) = λ * f x.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
def PositivelyHomogeneous {n : Nat} (f : (Fin n → Real) → EReal) : Prop :=
∀ x : Fin n → Real, ∀ t : Real, 0 < t → f (t • x) = (t : EReal) * f x
A convex positively homogeneous function is subadditive.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma subadditive_of_convex_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f) (hconv : ConvexFunction f) (hnotbot : ∀ x, f x ≠ ⊥) :
∀ x y : Fin n → Real, f (x + y) ≤ f x + f y
Subadditivity and positive homogeneity yield the segment inequality.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma segment_inequality_of_subadditive_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hsub : ∀ x y : Fin n → Real, f (x + y) ≤ f x + f y) :
∀ x y : Fin n → Real, ∀ t : Real, 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤
((1 - t : Real) : EReal) * f x + ((t : Real) : EReal) * f y
Subadditivity and positive homogeneity imply convexity.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convex_of_subadditive_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hsub : ∀ x y : Fin n → Real, f (x + y) ≤ f x + f y)
(hnotbot : ∀ x, f x ≠ ⊥) :
ConvexFunction f
Theorem 4.7: A positively homogeneous function f from R^n to (-∞, +∞] is convex iff f (x + y) ≤ f x + f y for every x and y in R^n.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
theorem convexFunction_iff_subadditive_of_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f) (hnotbot : ∀ x, f x ≠ ⊥) :
ConvexFunction f ↔ ∀ x y : Fin n → Real, f (x + y) ≤ f x + f y
Corollary 4.7.1: If f is a positively homogeneous proper convex function, then f (lambda_1 x_1 + ... + lambda_m x_m) ≤ lambda_1 f x_1 + ... + lambda_m f x_m whenever lambda_1 > 0, ..., lambda_m > 0.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexFunction_jensen_inequality_of_posHom_proper {n : Nat}
{f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f) :
∀ m : Nat, m ≠ 0 → ∀ w : Fin m → Real, ∀ x : Fin m → (Fin n → Real),
(∀ i, 0 < w i) →
f (Finset.univ.sum (fun i => w i • x i)) ≤
Finset.univ.sum (fun i => ((w i : Real) : EReal) * f (x i))
For a positively homogeneous proper convex function, f 0 is nonnegative.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma posHom_zero_nonneg {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f) :
(0 : EReal) ≤ f 0
Proper convexity plus positive homogeneity yield subadditivity.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma subadditive_of_posHom_proper {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f) :
∀ x y : Fin n → Real, f (x + y) ≤ f x + f y
A nonnegative sum gives a lower bound on the second term.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_neg_le_of_add_nonneg {a b : EReal}
(ha : a ≠ (⊥ : EReal)) (hb : b ≠ (⊥ : EReal))
(h : (0 : EReal) ≤ a + b) : -a ≤ b
Corollary 4.7.2: If f is a positively homogeneous proper convex function, then f (-x) ≥ -f x for every x.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma convexFunction_neg_ge_neg_of_posHom_proper {n : Nat}
{f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f) :
∀ x : Fin n → Real, f (-x) ≥ -f x
Oddness at a point rules out the value ⊤.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ne_top_of_neg_eq_neg {n : Nat} {f : (Fin n → Real) → EReal}
(hproper : ProperConvexFunctionOn (Set.univ) f) {x : Fin n → Real}
(hneg : f (-x) = -f x) : f x ≠ (⊤ : EReal)
Under oddness at x, f x can be rewritten as a real.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma coe_toReal_of_neg_eq_neg {n : Nat} {f : (Fin n → Real) → EReal}
(hproper : ProperConvexFunctionOn (Set.univ) f) {x : Fin n → Real}
(hneg : f (-x) = -f x) : ((f x).toReal : EReal) = f x
Oddness at a vector extends positive homogeneity to all real scalars.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma posHom_all_real_of_neg_vec {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f) {v : Fin n → Real}
(hnegv : f (-v) = -f v) :
∀ t : Real, f (t • v) = (t : EReal) * f v
Oddness on a submodule yields additivity there.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma additive_on_L_of_neg {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f)
{L : Submodule Real (Fin n → Real)}
(hneg : ∀ x : L, f (-(x : (Fin n → Real))) = -f (x : (Fin n → Real))) :
∀ x y : L, f ((x + y : L) : (Fin n → Real)) =
f (x : (Fin n → Real)) + f (y : (Fin n → Real))
Oddness on a submodule yields a linear map representing f there.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma linear_map_of_neg_on_L {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f)
{L : Submodule Real (Fin n → Real)}
(hneg : ∀ x : L, f (-(x : (Fin n → Real))) = -f (x : (Fin n → Real))) :
∃ g : L →ₗ[Real] Real, ∀ x : L,
f (x : (Fin n → Real)) = (g x : EReal)
Subadditivity extends to finite sums for positively homogeneous proper convex functions.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma subadditive_finset_of_posHom_proper {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f)
(hzero : f 0 = (0 : EReal))
{ι : Type*} (s : Finset ι) (g : ι → Fin n → Real) :
f (s.sum g) ≤ s.sum (fun i => f (g i))
A finite sum of real-coe values in EReal is the coe of the real sum.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_sum_coe {ι : Type*} (s : Finset ι) (r : ι → Real) :
s.sum (fun i => ((r i : Real) : EReal)) = ((s.sum r : Real) : EReal)
Oddness on a basis implies oddness on all of the submodule.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma neg_on_L_of_basis_neg {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f)
{L : Submodule Real (Fin n → Real)} {ι : Type*} [Fintype ι] [Nonempty ι]
(b : Module.Basis ι Real L)
(hnegb : ∀ i, f (-(b i : (Fin n → Real))) = -f (b i : (Fin n → Real))) :
∀ x : L, f (-(x : (Fin n → Real))) = -f (x : (Fin n → Real))
Theorem 4.8: A positively homogeneous proper convex function f is linear on a subspace L iff f (-x) = -f x for every x ∈ L. This is true if merely f (-b_i) = -f b_i for all vectors in some basis b_1, ..., b_m for L.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
theorem positivelyHomogeneous_properConvex_linear_on_submodule_iff_neg {n : Nat}
{f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hproper : ProperConvexFunctionOn (Set.univ) f)
(L : Submodule Real (Fin n → Real)) :
((∃ g : L →ₗ[Real] Real, ∀ x : L, f (x : (Fin n → Real)) = (g x : EReal)) ↔
(∀ x : L, f (-(x : (Fin n → Real))) = -f (x : (Fin n → Real))))
∧
((∃ (ι : Type*) (_ : Fintype ι) (_ : Nonempty ι) (b : Module.Basis ι Real L),
(∀ i, f (-(b i : (Fin n → Real))) = -f (b i : (Fin n → Real)))) →
(∃ g : L →ₗ[Real] Real, ∀ x : L, f (x : (Fin n → Real)) = (g x : EReal)))
Membership in the epigraph over Set.univ is just the inequality.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma mem_epigraph_univ_iff {n : Nat} {f : (Fin n → Real) → EReal}
{x : Fin n → Real} {μ : Real} :
((x, μ) ∈ epigraph (Set.univ) f) ↔ f x ≤ (μ : EReal)
An extended real bounded above by every real is ⊥.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_eq_bot_of_le_all_coe {x : EReal}
(h : ∀ μ : Real, x ≤ (μ : EReal)) : x = (⊥ : EReal)
Multiplying by a positive real preserves order against a real upper bound.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma ereal_mul_le_mul_of_pos_left {t : Real} (ht : 0 < t)
{x : EReal} {μ : Real} (hx : x ≤ (μ : EReal)) :
(t : EReal) * x ≤ ((t * μ : Real) : EReal)
Positive homogeneity implies the epigraph is closed under positive scaling.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma epigraph_cone_of_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f) :
∀ t : Real, 0 < t →
Set.image (fun p : (Fin n → Real) × Real => t • p) (epigraph (Set.univ) f) ⊆
epigraph (Set.univ) f
The cone property of the epigraph implies positive homogeneity.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma posHom_of_epigraph_cone {n : Nat} {f : (Fin n → Real) → EReal}
(hcone : ∀ t : Real, 0 < t →
Set.image (fun p : (Fin n → Real) × Real => t • p) (epigraph (Set.univ) f) ⊆
epigraph (Set.univ) f) :
PositivelyHomogeneous f
Remark 4.8.1: Obviously, positive homogeneity is equivalent to the epigraph being a cone in ℝ^{n+1}.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma positivelyHomogeneous_iff_epigraph_cone {n : Nat} (f : (Fin n → Real) → EReal) :
PositivelyHomogeneous f ↔
(∀ t : Real, 0 < t →
Set.image (fun p : (Fin n → Real) × Real => t • p) (epigraph (Set.univ) f) ⊆
epigraph (Set.univ) f)
The absolute value is positively homogeneous as an EReal-valued function.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma posHom_abs_ereal :
PositivelyHomogeneous (fun x : Fin 1 → Real => ((|x 0| : Real) : EReal))
The absolute value is subadditive when coerced to EReal.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma subadditive_abs_ereal :
∀ x y : Fin 1 → Real,
((|x 0 + y 0| : Real) : EReal) ≤
((|x 0| : Real) : EReal) + ((|y 0| : Real) : EReal)
The absolute value is not linear as an EReal-valued function.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma abs_not_linear_ereal :
¬ ∃ a : Real, ∀ x : Fin 1 → Real,
((|x 0| : Real) : EReal) = ((a * x 0 : Real) : EReal)
Example 4.8.2: An example of a positively homogeneous convex function which is not simply a linear function is f(x) = |x|.
open Matrix
open scoped BigOperators
open scoped Topology
open scoped BigOperators
lemma positivelyHomogeneous_convex_abs_not_linear :
(let f : (Fin 1 → Real) → EReal := fun x => ((|x 0| : Real) : EReal);
PositivelyHomogeneous f ∧ ConvexFunction f ∧
¬ (∃ a : Real, ∀ x : Fin 1 → Real, f x = ((a * x 0 : Real) : EReal)))§4 — Convex Functions — Part 6
Lean authors: Zichen Wang, Wanli Ma, Xuran Sun, Zaiwen Wen.
Defintion 4.8.1: For a set C ⊆ ℝ^n, the indicator function δ(· | C) is 0 on C and +∞ outside C.
open Matrix
noncomputable def indicatorFunction {n : Nat} (C : Set (Fin n → Real)) :
(Fin n → Real) → EReal
The indicator function is finite exactly on the set.
open Matrix
lemma indicatorFunction_lt_top_iff_mem {n : Nat} {C : Set (Fin n → Real)} {x : Fin n → Real} :
indicatorFunction C x < (⊤ : EReal) ↔ x ∈ C
The effective domain of the indicator function is the original set.
open Matrix
lemma effectiveDomain_indicatorFunction_eq {n : Nat} (C : Set (Fin n → Real)) :
effectiveDomain Set.univ (indicatorFunction C) = C
The indicator function of a convex set is convex.
open Matrix
lemma convexFunction_indicator_of_convex {n : Nat} {C : Set (Fin n → Real)}
(hC : Convex ℝ C) : ConvexFunction (indicatorFunction C)
Remark 4.8.1: The epigraph of the indicator function is a half-cylinder with cross-section C. Clearly C is a convex set iff δ(· | C) is a convex function on ℝ^n.
open Matrix
lemma convex_iff_convexFunction_indicatorFunction {n : Nat} (C : Set (Fin n → Real)) :
Convex ℝ C ↔ ConvexFunction (indicatorFunction C)
Defintion 4.8.2: The support function delta*(· | C) of a convex set C in R^n is defined by delta*(x | C) = sup {dotProduct x y | y ∈ C}.
open Matrix
noncomputable def supportFunction {n : Nat} (C : Set (Fin n → Real)) :
(Fin n → Real) → ℝ :=
fun x => sSup {r : ℝ | ∃ y ∈ C, r = dotProduct x y}
Defintion 4.8.2: The gauge gamma(· | C) is defined by gamma(x | C) = inf {lambda >= 0 | x ∈ lambda C}, for C ≠ ∅.
open Matrix
noncomputable def gaugeFunction {n : Nat} (C : Set (Fin n → Real)) :
(Fin n → Real) → ℝ :=
fun x => sInf {r : ℝ | 0 ≤ r ∧ ∃ y ∈ C, x = r • y}
Defintion 4.8.3: The (Euclidean) distance function d(·, C) is defined by d(x, C) = inf { |x - y| | y ∈ C }.
open Matrix
noncomputable def distanceFunction {n : Nat} (C : Set (Fin n → Real)) :
(Fin n → Real) → ℝ :=
fun x => Metric.infDist x C§5 — Functional Operations — Part 1
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Multiplying a non-⊥ value by a positive real does not yield ⊥ in EReal.
lemma ereal_mul_ne_bot_of_pos {a : EReal} {r : Real} (hr : 0 < r) (ha : a ≠ ⊥) :
((r : Real) : EReal) * a ≠ ⊥
Segment inequality for a convex function on Set.univ with no ⊥ values.
lemma segment_inequality_f_univ {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hnotbot : ∀ x, f x ≠ ⊥) :
∀ x y t, 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤
((1 - t : Real) : EReal) * f x + ((t : Real) : EReal) * f y
Segment inequality for phi on real arguments from convexity on Fin 1.
lemma segment_inequality_phi_real {phi : EReal → EReal}
(hphi : ConvexFunctionOn (S := (Set.univ : Set (Fin 1 → Real)))
(fun x : Fin 1 → Real => phi (x 0)))
(hphi_notbot : ∀ r : Real, phi r ≠ ⊥) :
∀ a b t : Real, 0 < t → t < 1 →
phi (((1 - t) * a + t * b : Real)) ≤
((1 - t : Real) : EReal) * phi a + ((t : Real) : EReal) * phi b
Theorem 5.1: Let f be a convex function from R^n to (-infty, +infty], and let phi be a convex function from R to (-infty, +infty] which is non-decreasing (with phi (+infty) = +infty). Then h x = phi (f x) is convex on R^n.
theorem convexFunctionOn_comp_nondecreasing {n : Nat} {f : (Fin n → Real) → EReal}
{phi : EReal → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hf_notbot : ∀ x, f x ≠ ⊥)
(hphi : ConvexFunctionOn (S := (Set.univ : Set (Fin 1 → Real)))
(fun x : Fin 1 → Real => phi (x 0)))
(hphi_notbot : ∀ r : Real, phi r ≠ ⊥)
(hphi_top : phi ⊤ = ⊤)
(hmono : Monotone phi) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (fun x => phi (f x))
Extended-real exponential with expEReal ⊤ = ⊤ and expEReal ⊥ = 0.
noncomputable def expEReal (z : EReal) : EReal :=
if z = ⊥ then (0 : Real) else if z = ⊤ then (⊤ : EReal) else (Real.exp z.toReal : EReal)
On real inputs, expEReal agrees with Real.exp.
@[simp] lemma expEReal_coe (r : Real) : expEReal (r : EReal) = (Real.exp r : EReal)
expEReal is monotone on EReal.
lemma expEReal_monotone : Monotone expEReal
Convexity of expEReal on Fin 1 over Set.univ.
lemma convexFunctionOn_expEReal_univ :
ConvexFunctionOn (S := (Set.univ : Set (Fin 1 → Real)))
(fun x : Fin 1 → Real => expEReal (x 0))
Text 5.1.1: The function h x = exp (f x) is a proper convex function on R^n if f is a proper convex function.
lemma properConvexFunctionOn_exp {n : Nat} {f : (Fin n → Real) → Real}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (f x : EReal))) :
ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (Real.exp (f x) : EReal))
The function r ↦ max r 0 is convex on ℝ.
lemma convexOn_max_zero :
ConvexOn ℝ (Set.univ : Set ℝ) (fun r : ℝ => max r 0)
Convexity of r ↦ (max r 0) ^ p on ℝ for p ≥ 1.
lemma convexOn_rpow_max_zero {p : Real} (hp1 : 1 ≤ p) :
ConvexOn ℝ (Set.univ : Set ℝ) (fun r : ℝ => Real.rpow (max r 0) p)
The map r ↦ (max r 0) ^ p is monotone for p ≥ 0.
lemma monotone_rpow_max_zero {p : Real} (hp0 : 0 ≤ p) :
Monotone (fun r : ℝ => Real.rpow (max r 0) p)
Text 5.1.2: The function h x = f x ^ p is convex for p > 1 when f is convex and non-negative.
lemma convexFunctionOn_rpow_of_convex_nonneg {n : Nat} {f : (Fin n → Real) → Real}
{p : Real} (hp : 1 < p)
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (f x : EReal)))
(h_nonneg : ∀ x, 0 ≤ f x) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (Real.rpow (f x) p : EReal))
Text 5.1.3: In particular, h(x) = |x|^p is convex on R^n for p ≥ 1 (|x| being the Euclidean norm).
lemma convexOn_univ_euclidean_norm_rpow {n : Nat} {p : Real} (hp : 1 ≤ p) :
ConvexOn ℝ (Set.univ)
(fun x : EuclideanSpace ℝ (Fin n) => Real.rpow ‖x‖ p)
Positivity domain of a concave function on Set.univ is convex.
lemma convex_pos_set_of_concave {n : Nat} {g : (Fin n → Real) → Real}
(hg : ConcaveOn ℝ (Set.univ : Set (Fin n → Real)) g) :
Convex ℝ {x : Fin n → Real | 0 < g x}
The reciprocal function is convex on (0, +∞).
lemma convexOn_inv_Ioi : ConvexOn ℝ (Set.Ioi (0 : ℝ)) (fun r : ℝ => r⁻¹)
Text 5.1.4: If g is a concave function, then h x = 1 / g x is convex on C = {x | g x > 0}.
lemma convexOn_inv_of_concave_pos {n : Nat} {g : (Fin n → Real) → Real}
(hg : ConcaveOn ℝ (Set.univ : Set (Fin n → Real)) g) :
ConvexOn ℝ {x : Fin n → Real | 0 < g x} (fun x => (g x)⁻¹)
Segment inequality on ℝ obtained from convexity of the EReal coercion.
lemma segment_inequality_real_of_ereal {n : Nat} {f : (Fin n → Real) → Real}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (f x : EReal))) :
∀ x y t, 0 < t → t < 1 →
f ((1 - t) • x + t • y) ≤ (1 - t) * f x + t * f y
A nonnegative affine map preserves convex-combination inequalities on ℝ.
lemma affine_le_affine_combo {a b c t lam alpha : Real} (hlam : 0 ≤ lam)
(h : a ≤ (1 - t) * b + t * c) :
lam * a + alpha ≤ (1 - t) * (lam * b + alpha) + t * (lam * c + alpha)
Text 5.1.5: (lambda f + alpha) is a proper convex function when f is a proper convex function and lambda and alpha are real numbers with lambda ≥ 0.
lemma properConvexFunctionOn_mul_add_const {n : Nat} {f : (Fin n → Real) → Real}
{lam alpha : Real} (hlam : 0 ≤ lam)
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (f x : EReal))) :
ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => ((lam * f x + alpha : Real) : EReal))
The sum of two non-⊥ values in EReal is non-⊥.
lemma add_ne_bot_of_notbot {a b : EReal} (ha : a ≠ ⊥) (hb : b ≠ ⊥) : a + b ≠ ⊥
Segment inequality for the sum of convex functions on Set.univ.
lemma segment_inequality_add_univ {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2)
(hnotbot1 : ∀ x, f1 x ≠ ⊥) (hnotbot2 : ∀ x, f2 x ≠ ⊥) :
∀ x y t, 0 < t → t < 1 →
f1 ((1 - t) • x + t • y) + f2 ((1 - t) • x + t • y) ≤
((1 - t : Real) : EReal) * (f1 x + f2 x) + ((t : Real) : EReal) * (f1 y + f2 y)
Theorem 5.2: If f1 and f2 are proper convex functions on R^n, then f1 + f2 is convex.
theorem convexFunctionOn_add_of_proper {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (fun x => f1 x + f2 x)
Text 5.2.1: A linear combination lambda_1 f_1 + ... + lambda_m f_m of proper convex functions with non-negative coefficients is convex.
theorem convexFunctionOn_linearCombination_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal} {lam : Fin m → Real}
(hlam : ∀ i, 0 ≤ lam i)
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => Finset.univ.sum (fun i => ((lam i : Real) : EReal) * f i x))
Text 5.2.2: If f is a finite convex function and C is a nonempty convex set, then f x + δ(x | C) = f x for x ∈ C and f x + δ(x | C) = +∞ for x ∉ C, where δ(· | C) is the indicator function of C.
lemma add_indicatorFunction_eq {n : Nat} {f : (Fin n → Real) → Real} {C : Set (Fin n → Real)} :
∀ x, (f x : EReal) + indicatorFunction C x =
(by
classical
exact if x ∈ C then (f x : EReal) else (⊤ : EReal))§5 — Functional Operations — Part 2
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
From a strict upper bound on the infimum of a fiber, pick a point below it.
lemma exists_fiber_lt_of_sInf_lt {n : Nat} {F : Set ((Fin n → Real) × Real)}
{x : Fin n → Real} {α : Real}
(h : sInf { μ : ℝ | (x, μ) ∈ F } < α)
(hne : Set.Nonempty { μ : ℝ | (x, μ) ∈ F }) :
∃ μ, (x, μ) ∈ F ∧ μ < α
If every fiber is nonempty and bounded below, the inf-section is convex.
lemma convexOn_inf_section_of_convex_of_nonempty_bddBelow {n : Nat}
{F : Set ((Fin n → Real) × Real)} (hF : Convex ℝ F)
(hne : ∀ x, Set.Nonempty { μ : ℝ | (x, μ) ∈ F })
(hbdd : ∀ x, BddBelow { μ : ℝ | (x, μ) ∈ F }) :
ConvexOn ℝ (Set.univ : Set (Fin n → Real))
(fun x => sInf { μ : ℝ | (x, μ) ∈ F })
From a strict upper bound on the EReal-infimum of a fiber, pick a real point below it.
lemma exists_fiber_lt_of_sInf_lt_ereal {n : Nat} {F : Set ((Fin n → Real) × Real)}
{x : Fin n → Real} {α : Real}
(h :
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F }) < (α : EReal)) :
∃ μ, (x, μ) ∈ F ∧ (μ : EReal) < (α : EReal)
Convexity of F gives closure under convex combinations.
lemma convex_combo_mem_F {n : Nat} {F : Set ((Fin n → Real) × Real)} (hF : Convex ℝ F)
{x y : Fin n → Real} {μ ν : Real} {a b : Real}
(hx : (x, μ) ∈ F) (hy : (y, ν) ∈ F)
(ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) :
(a • x + b • y, a * μ + b * ν) ∈ F
Strict inequality for the inf-section in the EReal setting.
lemma strict_ineq_inf_section_ereal {n : Nat} {F : Set ((Fin n → Real) × Real)}
(hF : Convex ℝ F) {x y : Fin n → Real} {α β t : Real}
(hfx :
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F }) < (α : EReal))
(hfy :
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (y, μ) ∈ F }) < (β : EReal))
(ht0 : 0 < t) (ht1 : t < 1) :
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | ((1 - t) • x + t • y, μ) ∈ F }) <
((1 - t : Real) : EReal) * (α : EReal) + ((t : Real) : EReal) * (β : EReal)
Theorem 5.3: Let F be a convex set in R^{n+1}, and define f x = inf { μ | (x, μ) ∈ F }, interpreted in EReal so empty fibers give +∞. Then f is convex on R^n.
theorem convexOn_inf_section_of_convex {n : Nat} {F : Set ((Fin n → Real) × Real)}
(hF : Convex ℝ F) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F }))
Theorem 5.4: Let f_1, ..., f_m be proper convex functions on R^n, and define f x = inf { f_1 x_1 + ... + f_m x_m | x_i ∈ R^n, x_1 + ... + x_m = x }. Then f is a convex function on R^n.
theorem convexFunctionOn_inf_sum_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x =>
sInf { z : EReal |
∃ x' : Fin m → (Fin n → Real),
(Finset.univ.sum (fun i => x' i) = x) ∧
z = Finset.univ.sum (fun i => f i (x' i)) })
Text 5.4.0 (Infimal convolution of two functions): Let f, g : R^n -> R union {+infty} be proper convex functions. Their infimal convolution f square g is the function (f square g)(x) = inf { f x1 + g x2 | x1, x2 in R^n, x1 + x2 = x }, equivalently (f square g)(x) = inf_{y in R^n} { f y + g (x - y) }.
noncomputable def infimalConvolution {n : Nat} (f g : (Fin n → Real) → EReal) :
(Fin n → Real) → EReal :=
fun x =>
sInf { z : EReal |
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧ z = f x1 + g x2 }
Text 5.4.1: Let f_1, ..., f_m be proper convex functions on R^n, and let f x = inf { f_1 x_1 + ... + f_m x_m | x_i ∈ R^n, x_1 + ... + x_m = x }. The function f is denoted by f_1 square f_2 square ... square f_m; the operation square is called infimal convolution.
noncomputable def infimalConvolutionFamily {n m : Nat}
(f : Fin m → (Fin n → Real) → EReal) : (Fin n → Real) → EReal :=
fun x =>
sInf { z : EReal |
∃ x' : Fin m → (Fin n → Real),
(Finset.univ.sum (fun i => x' i) = x) ∧
z = Finset.univ.sum (fun i => f i (x' i)) }
The two-function infimal convolution matches the family version on Fin 2.
lemma infimalConvolution_eq_infimalConvolutionFamily_two {n : Nat}
(f g : (Fin n → Real) → EReal) :
infimalConvolution f g =
infimalConvolutionFamily (fun i : Fin 2 => if i = 0 then f else g)
The indicator of a singleton is 0 at the point and ⊤ elsewhere.
lemma indicatorFunction_singleton_simp {n : Nat} (a x : Fin n → Real) :
indicatorFunction ({a} : Set (Fin n → Real)) x =
(if x = a then (0 : EReal) else ⊤)
The infimal convolution is bounded above by the translate f (x - a).
lemma infimalConvolution_indicator_singleton_le {n : Nat} (f : (Fin n → Real) → EReal)
(a : Fin n → Real) :
∀ x, infimalConvolution f (indicatorFunction ({a} : Set (Fin n → Real))) x ≤ f (x - a)
The translate f (x - a) is a lower bound when f never takes the value ⊥.
lemma infimalConvolution_indicator_singleton_ge {n : Nat} (f : (Fin n → Real) → EReal)
(a : Fin n → Real) (hf : ∀ x, f x ≠ (⊥ : EReal)) :
∀ x, f (x - a) ≤ infimalConvolution f (indicatorFunction ({a} : Set (Fin n → Real))) x
Text 5.4.1.1: If g = δ(· | a) for a point a ∈ R^n (where δ(x | a) = +infty for x ≠ a and δ(a | a) = 0), then (f square g)(x) = f (x - a).
lemma infimalConvolution_indicator_singleton {n : Nat} (f : (Fin n → Real) → EReal)
(a : Fin n → Real) (hf : ∀ x, f x ≠ (⊥ : EReal)) :
infimalConvolution f (indicatorFunction ({a} : Set (Fin n → Real))) =
(fun x => f (x - a))
Reparametrize the defining set in infimalConvolution.
lemma infimalConvolution_eq_sInf_param {n : Nat} (f g : (Fin n → Real) → EReal) :
∀ x : Fin n → Real,
infimalConvolution f g x =
sInf { r : EReal | ∃ z : Fin n → Real, r = g z + f (x - z) }
The singleton indicator collapses the reflected infimal convolution.
lemma infimalConvolution_reflection_indicator_inner {n : Nat}
(f : (Fin n → Real) → EReal) (x z : Fin n → Real)
(hf : ∀ y, f y ≠ (⊥ : EReal)) :
infimalConvolution (fun y => f (-y))
(indicatorFunction ({x} : Set (Fin n → Real))) z =
f (x - z)
Replace the inner infimal convolution using the singleton indicator formula.
lemma infimalConvolution_reflection_indicator_finalize {n : Nat}
(f g : (Fin n → Real) → EReal) (hf : ∀ y, f y ≠ (⊥ : EReal)) :
∀ x : Fin n → Real,
sInf { r : EReal |
∃ z : Fin n → Real,
r = g z +
infimalConvolution (fun y => f (-y))
(indicatorFunction ({x} : Set (Fin n → Real))) z } =
sInf { r : EReal | ∃ z : Fin n → Real, r = g z + f (x - z) }
Text 5.4.1.2: Let f, g : ℝ^n → ℝ ∪ {+∞} and define the reflection h(y) = f(-y). Then for every x ∈ ℝ^n, (f □ g)(x) = inf_{z ∈ ℝ^n} { g(z) + (h □ δ(· | x))(z) }.
theorem infimalConvolution_reflection_indicator {n : Nat}
(f g : (Fin n → Real) → EReal) (hf : ∀ y, f y ≠ (⊥ : EReal)) :
∀ x : Fin n → Real,
infimalConvolution f g x =
sInf { r : EReal |
∃ z : Fin n → Real,
r = g z +
infimalConvolution (fun y => f (-y))
(indicatorFunction ({x} : Set (Fin n → Real))) z }
Points in the effective domain of the infimal convolution decompose into points in each effective domain, assuming no ⊥ values.
lemma effectiveDomain_infimalConvolution_subset_sum {n : Nat}
(f g : (Fin n → Real) → EReal)
(hf : ∀ x, f x ≠ (⊥ : EReal)) (hg : ∀ x, g x ≠ (⊥ : EReal)) :
∀ x,
x ∈ effectiveDomain Set.univ (infimalConvolution f g) →
x ∈ Set.image2 (fun x y => x + y)
(effectiveDomain Set.univ f) (effectiveDomain Set.univ g)
Any sum of points from the effective domains lies in the effective domain of f □ g.
lemma effectiveDomain_sum_subset_infimalConvolution {n : Nat}
(f g : (Fin n → Real) → EReal) :
∀ x,
x ∈ Set.image2 (fun x y => x + y)
(effectiveDomain Set.univ f) (effectiveDomain Set.univ g) →
x ∈ effectiveDomain Set.univ (infimalConvolution f g)
Text 5.4.1.3: The effective domain of f □ g is the sum of dom f and dom g.
lemma effectiveDomain_infimalConvolution_eq_sum {n : Nat}
(f g : (Fin n → Real) → EReal)
(hf : ∀ x, f x ≠ (⊥ : EReal)) (hg : ∀ x, g x ≠ (⊥ : EReal)) :
effectiveDomain Set.univ (infimalConvolution f g) =
Set.image2 (fun x y => x + y)
(effectiveDomain Set.univ f) (effectiveDomain Set.univ g)
Adding the indicator yields the norm on C and ⊤ outside.
lemma indicator_add_norm_eq_if {n : Nat} {C : Set (Fin n → Real)}
(x z : Fin n → Real) :
indicatorFunction C z + ((‖x - z‖ : Real) : EReal) =
(by
classical
exact if z ∈ C then ((‖x - z‖ : Real) : EReal) else (⊤ : EReal))
Rewriting the infimal convolution with an indicator as an infimum over C.
lemma infimalConvolution_norm_indicator_eq_sInf_range {n : Nat} {C : Set (Fin n → Real)} :
∀ x : Fin n → Real,
infimalConvolution (fun y => ((‖y‖ : Real) : EReal)) (indicatorFunction C) x =
sInf (Set.range (fun z : C => ((‖x - z‖ : Real) : EReal)))
The infimum of norms over a nonempty set gives the distance.
lemma sInf_range_norm_eq_infDist {n : Nat} {C : Set (Fin n → Real)} (hCne : C.Nonempty) :
∀ x : Fin n → Real,
sInf (Set.range (fun z : C => ((‖x - z‖ : Real) : EReal))) =
((Metric.infDist x C : Real) : EReal)
Text 5.4.1.4: Taking f to be the Euclidean norm and g to be the indicator function of a convex set C, we get (f □ g)(x) = d(x, C), where d(x, C) denotes the distance between x and C.
lemma infimalConvolution_norm_indicator_eq_infDist {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) :
∀ x : Fin n → Real,
infimalConvolution (fun y => ((‖y‖ : Real) : EReal)) (indicatorFunction C) x =
((Metric.infDist x C : Real) : EReal)
The Euclidean norm is a proper convex function on Set.univ.
lemma properConvexFunctionOn_norm {n : Nat} :
ProperConvexFunctionOn (Set.univ : Set (Fin n → Real))
(fun x => ((‖x‖ : Real) : EReal))
The indicator of a nonempty convex set is a proper convex function.
lemma properConvexFunctionOn_indicator_of_convex_of_nonempty {n : Nat} {C : Set (Fin n → Real)}
(hC : Convex ℝ C) (hCne : C.Nonempty) :
ProperConvexFunctionOn (Set.univ : Set (Fin n → Real)) (indicatorFunction C)
The infimal convolution of two proper convex functions is convex.
lemma convexFunctionOn_infimalConvolution_of_proper {n : Nat}
{f g : (Fin n → Real) → EReal}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hg : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) g) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (infimalConvolution f g)
Text 5.4.1.5: For a convex set C, let d(x, C) denote the distance between x and C. Then the function d(·, C) is convex on ℝ^n.
lemma convexOn_infDist_of_convex {n : Nat} {C : Set (Fin n → Real)}
(hC : Convex ℝ C) :
ConvexOn ℝ (Set.univ : Set (Fin n → Real)) (fun x => Metric.infDist x C)§5 — Functional Operations — Part 3
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Text 5.4.1.6: For any functions f_1 and f_2 from R^n to [-infty, +infty] (not necessarily convex nor proper), (f_1 □ f_2)(x) can be defined directly in terms of addition of epigraphs: (f_1 □ f_2)(x) = inf { μ | (x, μ) ∈ (epi f_1 + epi f_2) }.
open scoped Pointwise
theorem infimalConvolution_eq_sInf_epigraph_add {n : Nat}
(f1 f2 : (Fin n → Real) → EReal) :
∀ x : Fin n → Real,
infimalConvolution f1 f2 x =
sInf { z : EReal |
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧ z = f1 x1 + f2 x2 }
Text 5.4.2: Let f : R^n → R ∪ {+infty} be convex and lam ∈ [0, +infty). Define the right scalar multiple f lam to be the convex function obtained from Theorem 5.3 by taking F = lam (epi f) ⊆ R^{n+1}.
open scoped Pointwise
noncomputable def rightScalarMultiple {n : Nat} (f : (Fin n → Real) → EReal) (lam : Real) :
(Fin n → Real) → EReal :=
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈
Set.image (fun p : (Fin n → Real) × Real => lam • p)
(epigraph (Set.univ : Set (Fin n → Real)) f) })
Membership in the scaled epigraph fiber for positive scaling.
open scoped Pointwise
lemma mem_image_smul_epigraph_iff {n : Nat} {f : (Fin n → Real) → EReal} {lam : Real}
(hlam : 0 < lam) {x : Fin n → Real} {μ : Real} :
(x, μ) ∈
Set.image (fun p : (Fin n → Real) × Real => lam • p)
(epigraph (Set.univ : Set (Fin n → Real)) f) ↔
f (lam⁻¹ • x) ≤ ((μ / lam : Real) : EReal)
The infimum of all real coercions in EReal is ⊥.
open scoped Pointwise
lemma sInf_image_real_univ :
sInf ((fun μ : ℝ => (μ : EReal)) '' (Set.univ : Set ℝ)) = (⊥ : EReal)
The infimum over a scaled epigraph fiber equals the scaled value of f.
open scoped Pointwise
lemma sInf_fiber_smul_eq {n : Nat} {f : (Fin n → Real) → EReal} {lam : Real}
(hlam : 0 < lam) (x : Fin n → Real) :
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈
Set.image (fun p : (Fin n → Real) × Real => lam • p)
(epigraph (Set.univ : Set (Fin n → Real)) f) }) =
(lam : EReal) * f (lam⁻¹ • x)
The zero scaling of a nonempty epigraph is the singleton {(0,0)}.
open scoped Pointwise
lemma image_zero_smul_epigraph_eq_singleton {n : Nat} {f : (Fin n → Real) → EReal}
(hne : Set.Nonempty (epigraph (Set.univ : Set (Fin n → Real)) f)) :
Set.image (fun p : (Fin n → Real) × Real => (0 : Real) • p)
(epigraph (Set.univ : Set (Fin n → Real)) f) =
{(0 : (Fin n → Real) × Real)}
Evaluate the zero scalar multiple when the epigraph is nonempty.
open scoped Pointwise
lemma rightScalarMultiple_zero_eval {n : Nat} {f : (Fin n → Real) → EReal}
(hne : Set.Nonempty (epigraph (Set.univ : Set (Fin n → Real)) f)) :
∀ x : Fin n → Real,
rightScalarMultiple f 0 x = (if x = 0 then (0 : EReal) else ⊤)
Text 5.4.3 (i): Let f be convex on ℝ^n. If λ > 0, then for all x, (f λ)(x) = λ f (λ^{-1} x).
open scoped Pointwise
theorem rightScalarMultiple_pos {n : Nat} {f : (Fin n → Real) → EReal} {lam : Real}
(_hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) (hlam : 0 < lam) :
∀ x : Fin n → Real,
rightScalarMultiple f lam x = ((lam : Real) : EReal) * f (lam⁻¹ • x)
Text 5.4.3 (ii): Let f be convex on ℝ^n. If λ = 0 and f is not identically +∞, then for all x, (f 0)(x) = δ(x | 0). (Trivially, if f ≡ +∞ then f 0 = f.)
open scoped Pointwise
theorem rightScalarMultiple_zero_eq_indicator {n : Nat} {f : (Fin n → Real) → EReal}
(_hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hfinite : ∃ x, f x ≠ (⊤ : EReal)) :
rightScalarMultiple f 0 = indicatorFunction ({0} : Set (Fin n → Real))
Text 5.4.4: A function f : ℝ^n → ℝ ∪ {+∞} is positively homogeneous if f (α x) = α f x for all x and all α > 0.
open scoped Pointwise
lemma positivelyHomogeneous_iff {n : Nat} {f : (Fin n → Real) → EReal} :
PositivelyHomogeneous f ↔
∀ x : Fin n → Real, ∀ α : Real, 0 < α → f (α • x) = (α : EReal) * f x
Simplify lam⁻¹ • (lam • x) when lam ≠ 0.
open scoped Pointwise
lemma smul_inv_smul_simplify {n : Nat} {lam : Real} {x : Fin n → Real} (hne : lam ≠ 0) :
lam⁻¹ • (lam • x) = x
If f is positively homogeneous, all positive right scalar multiples equal f.
open scoped Pointwise
lemma rightScalarMultiple_eq_self_of_posHom {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hpos : PositivelyHomogeneous f) :
∀ lam : Real, 0 < lam → rightScalarMultiple f lam = f
If every positive right scalar multiple equals f, then f is positively homogeneous.
open scoped Pointwise
lemma posHom_of_rightScalarMultiple_eq_self {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
(hscale : ∀ lam : Real, 0 < lam → rightScalarMultiple f lam = f) :
PositivelyHomogeneous f
Text 5.4.5 (Characterization via right scalar multiplication): A convex function f is positively homogeneous if and only if f λ = f for every λ > 0, where f λ denotes the right scalar multiple.
open scoped Pointwise
theorem positivelyHomogeneous_iff_rightScalarMultiple_eq {n : Nat}
{f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
PositivelyHomogeneous f ↔
∀ lam : Real, 0 < lam → rightScalarMultiple f lam = f
Text 5.4.6 (Cone generated by an epigraph): Let h : ℝ^n → ℝ ∪ {+∞} be convex. The convex cone generated by epi h is the smallest convex cone F ⊆ ℝ^{n+1} containing epi h. Equivalently, F = cone (epi h) := conv ({0} ∪ ⋃_{λ > 0} λ • (epi h)).
open scoped Pointwise
def convexConeGeneratedEpigraph {n : Nat} (h : (Fin n → Real) → EReal) :
Set ((Fin n → Real) × Real) :=
Set.insert (0 : (Fin n → Real) × Real)
((ConvexCone.hull ℝ (epigraph (Set.univ : Set (Fin n → Real)) h)) :
Set ((Fin n → Real) × Real))
Text 5.4.7 (Positively homogeneous convex function generated by h): Let h : ℝ^n → ℝ ∪ {+∞} be convex and let F = cone (epi h) ⊆ ℝ^{n+1}. Define f x = inf { μ | (x, μ) ∈ F } (as in Theorem 5.3). The function f is called the positively homogeneous convex function generated by h.
open scoped Pointwise
noncomputable def positivelyHomogeneousConvexFunctionGenerated {n : Nat}
(h : (Fin n → Real) → EReal) : (Fin n → Real) → EReal :=
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ convexConeGeneratedEpigraph h })
The generated epigraph is closed under positive scaling.
open scoped Pointwise
lemma smul_mem_convexConeGeneratedEpigraph {n : Nat} {h : (Fin n → Real) → EReal}
{t : Real} (ht : 0 < t) {p : (Fin n → Real) × Real} :
p ∈ convexConeGeneratedEpigraph h → t • p ∈ convexConeGeneratedEpigraph h
The generated epigraph is closed under addition.
open scoped Pointwise
lemma add_mem_convexConeGeneratedEpigraph {n : Nat} {h : (Fin n → Real) → EReal}
{p q : (Fin n → Real) × Real} :
p ∈ convexConeGeneratedEpigraph h →
q ∈ convexConeGeneratedEpigraph h →
p + q ∈ convexConeGeneratedEpigraph h
The generated epigraph forms a convex cone.
open scoped Pointwise
def convexCone_generatedEpigraph {n : Nat} (h : (Fin n → Real) → EReal) :
ConvexCone ℝ ((Fin n → Real) × Real)
Multiplying by a positive real preserves order in EReal.
open scoped Pointwise
lemma ereal_mul_le_mul_of_pos_left_general {t : Real} (ht : 0 < t) {x y : EReal} (h : x ≤ y) :
(t : EReal) * x ≤ (t : EReal) * y
Positive scaling by t and t⁻¹ cancels on EReal.
open scoped Pointwise
lemma ereal_mul_inv_smul {t : Real} (ht : 0 < t) (x : EReal) :
(t : EReal) * ((t⁻¹ : EReal) * x) = x
Scaling a real set scales the infimum of its EReal image.
open scoped Pointwise
lemma sInf_image_real_smul {S : Set ℝ} {t : Real} (ht : 0 < t) :
sInf ((fun μ : ℝ => (μ : EReal)) '' (t • S)) =
(t : EReal) * sInf ((fun μ : ℝ => (μ : EReal)) '' S)
The inf-section of a set closed under positive scaling is positively homogeneous.
open scoped Pointwise
lemma posHom_of_inf_section_of_cone {n : Nat} {F : Set ((Fin n → Real) × Real)}
(hcone : ∀ t : Real, 0 < t →
Set.image (fun p : (Fin n → Real) × Real => t • p) F ⊆ F) :
PositivelyHomogeneous (fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F }))
The epigraph of a convex positively homogeneous function is closed under addition.
open scoped Pointwise
lemma add_mem_epigraph_of_posHom_convex {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hconv : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
{p q : (Fin n → Real) × Real}
(hp : p ∈ epigraph (Set.univ : Set (Fin n → Real)) f)
(hq : q ∈ epigraph (Set.univ : Set (Fin n → Real)) f) :
p + q ∈ epigraph (Set.univ : Set (Fin n → Real)) f
The epigraph of a convex positively homogeneous function is a convex cone.
open scoped Pointwise
def convexCone_epigraph_of_posHom_convex {n : Nat} {f : (Fin n → Real) → EReal}
(hpos : PositivelyHomogeneous f)
(hconv : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
ConvexCone ℝ ((Fin n → Real) × Real)
If epigraph h ⊆ F, then the inf-section of F is dominated by h.
open scoped Pointwise
lemma le_of_epigraph_subset_inf_section {n : Nat} {h : (Fin n → Real) → EReal}
{F : Set ((Fin n → Real) × Real)}
(hF : epigraph (Set.univ : Set (Fin n → Real)) h ⊆ F) :
(fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F })) ≤ h
Minimality of the generated cone inside any epigraph majorant.
open scoped Pointwise
lemma cone_minimality_epigraph_u {n : Nat} {h u : (Fin n → Real) → EReal}
(hu_pos : PositivelyHomogeneous u)
(hu_conv : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) u)
(hu0 : u 0 ≤ 0) (hu_le : u ≤ h) :
convexConeGeneratedEpigraph h ⊆ epigraph (Set.univ : Set (Fin n → Real)) u
Text 5.4.8 (Maximality of the positively homogeneous hull): Let h be convex on ℝ^n, and let f be the positively homogeneous convex function generated by h. Then: (i) epi f is a convex cone in ℝ^{n+1} containing the origin. (ii) f is convex and positively homogeneous, and satisfies f(0) ≤ 0 and f ≤ h. (iii) (Greatest such minorant) If u is any positively homogeneous convex function with u(0) ≤ 0 and u ≤ h, then u ≤ f.
open scoped Pointwise
theorem maximality_posHomogeneousHull {n : Nat} {h : (Fin n → Real) → EReal}
(_hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h) :
let f := positivelyHomogeneousConvexFunctionGenerated h;
(∃ C : ConvexCone ℝ ((Fin n → Real) × Real),
(C : Set ((Fin n → Real) × Real)) =
epigraph (S := (Set.univ : Set (Fin n → Real))) f ∧
(0 : (Fin n → Real) × Real) ∈
epigraph (S := (Set.univ : Set (Fin n → Real))) f)
∧
(ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f ∧
PositivelyHomogeneous f ∧
f 0 ≤ 0 ∧
f ≤ h)
∧
(∀ u : (Fin n → Real) → EReal,
PositivelyHomogeneous u →
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) u →
u 0 ≤ 0 →
u ≤ h →
u ≤ f)
Membership in the generated cone is either zero or a positive scaling of the epigraph, for convex h.
open scoped Pointwise
lemma mem_convexConeGeneratedEpigraph_iff {n : Nat} {h : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h)
{p : (Fin n → Real) × Real} :
p ∈ convexConeGeneratedEpigraph h ↔
p = 0 ∨ ∃ lam : Real, 0 < lam ∧
p ∈ Set.image (fun q : (Fin n → Real) × Real => lam • q)
(epigraph (Set.univ : Set (Fin n → Real)) h)
The λ ≥ 0 right-scalar-multiple values are obtained by inserting the λ = 0 value.
open scoped Pointwise
lemma rightScalarMultiple_set_eq_insert {n : Nat} {h : (Fin n → Real) → EReal}
(x : Fin n → Real) :
{ z : EReal | ∃ lam : Real, 0 ≤ lam ∧ z = rightScalarMultiple h lam x } =
Set.insert (rightScalarMultiple h 0 x)
{ z : EReal | ∃ lam : Real, 0 < lam ∧ z = rightScalarMultiple h lam x }
If h 0 < ⊤, then the infimum of positive right scalar multiples at 0 is ≤ 0.
open scoped Pointwise
lemma sInf_rightScalarMultiple_pos_le_zero {n : Nat} {h : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h)
(h0 : h 0 < (⊤ : EReal)) :
sInf { z : EReal | ∃ lam : Real, 0 < lam ∧ z = rightScalarMultiple h lam 0 } ≤ (0 : EReal)§5 — Functional Operations — Part 4
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Text 5.4.9 (Infimum representation of the positively homogeneous hull): Assume h is not identically +∞ and let f be the positively homogeneous convex function generated by h. Then f x = inf { (h λ)(x) | λ ≥ 0 } for all x. Moreover, λ = 0 may be omitted from the infimum if x ≠ 0 or if h(0) < +∞.
open scoped Pointwise
theorem infimumRepresentation_posHomogeneousHull {n : Nat} {h : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h)
(hfinite : ∃ x, h x ≠ (⊤ : EReal)) :
let f := positivelyHomogeneousConvexFunctionGenerated h;
(∀ x : Fin n → Real,
f x = sInf { z : EReal | ∃ lam : Real, 0 ≤ lam ∧ z = rightScalarMultiple h lam x })
∧
(∀ x : Fin n → Real, (x ≠ 0 ∨ h 0 < (⊤ : EReal)) →
f x = sInf { z : EReal | ∃ lam : Real, 0 < lam ∧ z = rightScalarMultiple h lam x })
The perspective kernel is convex when f is convex.
open scoped Pointwise
lemma convexFunctionOn_perspective_h {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
ConvexFunctionOn (S := (Set.univ : Set (Fin (n + 1) → Real)))
(fun y =>
if y 0 = (1 : Real) then
f (fun i => y i.succ)
else
(⊤ : EReal))
For positive lam, the first coordinate of lam⁻¹ • y equals 1 iff y 0 = lam.
open scoped Pointwise
lemma first_coord_inv_smul_eq_one {n : Nat} {lam : Real} (hlam : 0 < lam)
(y : Fin (n + 1) → Real) : (lam⁻¹ • y) 0 = (1 : Real) ↔ y 0 = lam
Positive right scalar multiples of the perspective kernel simplify.
open scoped Pointwise
lemma rightScalarMultiple_perspective_h_pos {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
{lam : Real} (hlam : 0 < lam) (y : Fin (n + 1) → Real) :
rightScalarMultiple
(fun y => if y 0 = (1 : Real) then f (fun i => y i.succ) else (⊤ : EReal))
lam y =
if y 0 = lam then ((lam : EReal) *
f (lam⁻¹ • (fun i : Fin n => y i.succ))) else (⊤ : EReal)
A positive scalar multiple of a non-⊥ EReal is non-⊥.
open scoped Pointwise
lemma ereal_mul_ne_bot_of_pos' {t : Real} (ht : 0 < t) {x : EReal} (hx : x ≠ (⊥ : EReal)) :
((t : Real) : EReal) * x ≠ (⊥ : EReal)
The perspective kernel has a nonempty epigraph when f is proper.
open scoped Pointwise
lemma nonempty_epigraph_perspective_h {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
Set.Nonempty
(epigraph (Set.univ : Set (Fin (n + 1) → Real))
(fun y => if y 0 = (1 : Real) then f (fun i => y i.succ) else (⊤ : EReal)))
Text 5.4.9.1: Perspective as a positively homogeneous convex function. Let f be a proper convex function on ℝ^n. Define g(λ,x) = (f λ)(x) for λ ≥ 0 (with the closed perspective convention at λ = 0) and g(λ,x) = +∞ for λ < 0. Then g is proper, convex, and positively homogeneous on ℝ^{n+1}; moreover, g coincides with the positively homogeneous convex function generated by h(λ,x) = f(x) when λ = 1 and +∞ otherwise.
open scoped Pointwise
theorem perspective_posHomogeneous_convex {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
let g : (Fin (n + 1) → Real) → EReal :=
fun y =>
if 0 ≤ y 0 then
rightScalarMultiple f (y 0) (fun i => y i.succ)
else
(⊤ : EReal)
let h : (Fin (n + 1) → Real) → EReal :=
fun y =>
if y 0 = (1 : Real) then
f (fun i => y i.succ)
else
(⊤ : EReal)
ProperConvexFunctionOn (S := (Set.univ : Set (Fin (n + 1) → Real))) g ∧
PositivelyHomogeneous g ∧
g = positivelyHomogeneousConvexFunctionGenerated (n := n + 1) h
Text 5.4.9.1: For each fixed x ∈ dom f, the map λ ↦ (f λ)(x) is a proper convex function of λ on [0, ∞).
open scoped Pointwise
theorem properConvexFunctionOn_perspective_param {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
∀ x : Fin n → Real, x ∈ effectiveDomain Set.univ f →
ProperConvexFunctionOn (S := {t : Fin 1 → Real | 0 ≤ t 0})
(fun t => rightScalarMultiple f (t 0) x)
Text 5.4.10 (Gauge of a convex set): Let C ⊆ ℝ^n be a nonempty convex set. The gauge of C is the function gamma(·|C) : ℝ^n → [0,+∞] defined by gamma(x|C) = inf { lambda ≥ 0 | x ∈ lambda C }.
open scoped Pointwise
noncomputable def gaugeOfConvexSet {n : Nat} (C : Set (Fin n → Real)) :
(Fin n → Real) → ℝ :=
fun x => sInf { r : ℝ | 0 ≤ r ∧ x ∈ (fun y => r • y) '' C }
Text 5.4.10: The gauge of a convex set agrees with mathlib's gauge.
open scoped Pointwise
theorem gaugeOfConvexSet_eq_gauge {n : Nat} (C : Set (Fin n → Real)) :
gaugeOfConvexSet C = gauge C
A finite constant function is proper convex on Set.univ.
open scoped Pointwise
lemma properConvexFunctionOn_const {n : Nat} (c : Real) :
ProperConvexFunctionOn (Set.univ : Set (Fin n → Real)) (fun _ => (c : EReal))
The indicator function plus a real constant is convex on Set.univ.
open scoped Pointwise
lemma convexFunctionOn_indicator_add_const {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) (hCconv : Convex ℝ C) (c : Real) :
ConvexFunctionOn (Set.univ : Set (Fin n → Real))
(fun x => indicatorFunction C x + (c : EReal))
The indicator of a scaled image is rewritten by inverse scaling when lam ≠ 0.
open scoped Pointwise
lemma indicatorFunction_image_smul_eq {n : Nat} {C : Set (Fin n → Real)}
{lam : Real} (hlam : lam ≠ 0) (x : Fin n → Real) :
indicatorFunction ((fun y => lam • y) '' C) x =
indicatorFunction C (lam⁻¹ • x)
For positive lam, the right scalar multiple of indicatorFunction C + 1 is explicit.
open scoped Pointwise
lemma rightScalarMultiple_indicator_add_one_pos {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) (hCconv : Convex ℝ C) {lam : Real} (hlam : 0 < lam)
(x : Fin n → Real) :
rightScalarMultiple (fun y => indicatorFunction C y + (1 : EReal)) lam x =
indicatorFunction ((fun y => lam • y) '' C) x + ((lam : Real) : EReal)
For lam = 0, the right scalar multiple of indicatorFunction C + 1 is an indicator.
open scoped Pointwise
lemma rightScalarMultiple_indicator_add_one_zero {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) (hCconv : Convex ℝ C) (x : Fin n → Real) :
rightScalarMultiple (fun y => indicatorFunction C y + (1 : EReal)) 0 x =
indicatorFunction ((fun y => (0 : Real) • y) '' C) x + (0 : EReal)
Nonnegative scalars give the explicit indicator formula.
open scoped Pointwise
lemma rightScalarMultiple_indicator_add_one_nonneg {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) (hCconv : Convex ℝ C) {lam : Real} (hlam : 0 ≤ lam)
(x : Fin n → Real) :
rightScalarMultiple (fun y => indicatorFunction C y + (1 : EReal)) lam x =
indicatorFunction ((fun y => lam • y) '' C) x + ((lam : Real) : EReal)§5 — Functional Operations — Part 5
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
The sInf over right scalar multiples reduces to the scaling set where x ∈ lam • C.
open scoped Pointwise
lemma sInf_rightScalarMultiple_indicator_add_one_eq_sInf_scaling {n : Nat}
{C : Set (Fin n → Real)} (hCne : C.Nonempty) (hCconv : Convex ℝ C) :
∀ x : Fin n → Real,
sInf { z : EReal | ∃ lam : Real, 0 ≤ lam ∧
z = rightScalarMultiple (fun y => indicatorFunction C y + (1 : EReal)) lam x } =
sInf ((fun r : ℝ => (r : EReal)) ''
{ r : ℝ | 0 ≤ r ∧ x ∈ (fun y => r • y) '' C })
The sInf of the EReal-coerced scaling set matches the gauge under absorbency.
open scoped Pointwise
lemma sInf_coe_image_eq_gauge {n : Nat} {C : Set (Fin n → Real)}
(hCabs : ∀ x : Fin n → Real, ∃ lam : Real, 0 ≤ lam ∧ x ∈ (fun y => lam • y) '' C) :
∀ x : Fin n → Real,
sInf ((fun r : ℝ => (r : EReal)) ''
{ r : ℝ | 0 ≤ r ∧ x ∈ (fun y => r • y) '' C }) =
(gaugeOfConvexSet C x : EReal)
The sInf of right scalar multiples of indicatorFunction C + 1 matches the gauge.
open scoped Pointwise
lemma sInf_rightScalarMultiple_indicator_add_one_eq_gauge {n : Nat} {C : Set (Fin n → Real)}
(hCne : C.Nonempty) (hCconv : Convex ℝ C)
(hCabs : ∀ x : Fin n → Real, ∃ lam : Real, 0 ≤ lam ∧ x ∈ (fun y => lam • y) '' C) :
∀ x : Fin n → Real,
sInf { z : EReal | ∃ lam : Real, 0 ≤ lam ∧
z = rightScalarMultiple (fun y => indicatorFunction C y + (1 : EReal)) lam x } =
(gaugeOfConvexSet C x : EReal)
Text 5.4.11 (Gauge as a positively homogeneous hull): Let C ⊆ ℝ^n be nonempty and convex, and assume every x is contained in some nonnegative scaling of C. Define h(x)=δ(x|C)+1. Then for λ ≥ 0, (h λ)(x)=δ(x|λ C)+λ, and the positively homogeneous convex function generated by h equals the gauge: inf { (h λ)(x) | λ ≥ 0 } = inf { λ ≥ 0 | x ∈ λ C } = γ(x|C).
open scoped Pointwise
theorem gauge_posHomogeneousHull_indicator_add_one {n : Nat} {C : Set (Fin n → Real)}
(hCne : Set.Nonempty C) (hCconv : Convex ℝ C)
(hCabs : ∀ x : Fin n → Real, ∃ lam : Real, 0 ≤ lam ∧ x ∈ (fun y => lam • y) '' C) :
let h : (Fin n → Real) → EReal := fun x => indicatorFunction C x + (1 : EReal)
(∀ lam : Real, 0 ≤ lam → ∀ x : Fin n → Real,
rightScalarMultiple h lam x =
indicatorFunction ((fun y => lam • y) '' C) x + ((lam : Real) : EReal))
∧
(∀ x : Fin n → Real,
sInf { z : EReal | ∃ lam : Real, 0 ≤ lam ∧ z = rightScalarMultiple h lam x } =
(gaugeOfConvexSet C x : EReal))
Text 5.5.0: The support function delta*(· | C) of a set C in R^n is convex.
open scoped Pointwise
lemma convexOn_supportFunction {n : Nat} (C : Set (Fin n → Real))
(hCbd : ∀ x : Fin n → Real,
BddAbove { r : ℝ | ∃ y ∈ C, r = dotProduct x y }) :
ConvexOn ℝ (Set.univ : Set (Fin n → Real)) (supportFunction C)
Epigraphs of convex functions on univ are convex.
open scoped Pointwise
lemma convex_epigraph_of_convexFunctionOn {n : Nat}
{f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
Convex ℝ (epigraph (S := (Set.univ : Set (Fin n → Real))) f)
Intersections of epigraphs of convex functions on univ are convex.
open scoped Pointwise
lemma convex_iInter_epigraph {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal}
(hf : ∀ i, ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
Convex ℝ (⋂ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i))
The epigraph of a pointwise supremum equals the intersection of epigraphs.
open scoped Pointwise
lemma epigraph_iSup_eq_iInter_univ {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal} :
epigraph (S := (Set.univ : Set (Fin n → Real)))
(fun x => iSup (fun i => f i x)) =
⋂ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)
Theorem 5.5: The pointwise supremum of an arbitrary collection of convex functions is convex.
open scoped Pointwise
theorem convexFunctionOn_iSup {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal}
(hf : ∀ i, ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => iSup (fun i => f i x))§5 — Functional Operations — Part 6
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Coordinate projections are convex on ℝ^n.
lemma convexFunctionOn_coord {n : Nat} (j : Fin n) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => (x j : EReal))
Text 5.5.0.1: The function f which assigns to each x = (xi_1, ..., xi_n) the greatest of the components xi_j of x is convex.
lemma convexFunctionOn_maxComponent {n : Nat} :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x => iSup (fun j : Fin n => (x j : EReal)))
Pulling out a positive scalar from a finite supremum in EReal.
lemma iSup_mul_of_pos {n : Nat} (a : Fin n → EReal) {t : Real} (ht : 0 < t) :
(⨆ j, (t : EReal) * a j) = (t : EReal) * ⨆ j, a j
Rewrite the max-component after scaling as EReal multiplication.
lemma maxComponent_smul_rewrite {n : Nat} (x : Fin n → Real) (t : Real) :
(⨆ j, ((t • x) j : EReal)) = ⨆ j, (t : EReal) * (x j : EReal)
Text 5.5.0.2: The function f which assigns to each x = (xi_1, ..., xi_n) the greatest of the components xi_j of x is positively homogeneous.
lemma positivelyHomogeneous_maxComponent {n : Nat} :
PositivelyHomogeneous
(fun x : Fin n → Real => iSup (fun j : Fin n => (x j : EReal)))
Components of a vector form a bounded-above set.
lemma bddAbove_components {n : Nat} (x : Fin n → ℝ) :
BddAbove { r : ℝ | ∃ j : Fin n, r = x j }
The standard basis vector lies in the simplex.
lemma simplex_stdBasis_mem {n : Nat} (j : Fin n) :
(∀ i, 0 ≤ ((Pi.single j (1 : ℝ)) : Fin n → ℝ) i) ∧
(Finset.univ.sum (fun i => ((Pi.single j (1 : ℝ)) : Fin n → ℝ) i) = 1)
A convex combination of components is bounded by their supremum.
lemma dotProduct_le_sSup_components_of_simplex {n : Nat} (x y : Fin n → ℝ)
(hy0 : ∀ j, 0 ≤ y j) (hysum : Finset.univ.sum (fun j => y j) = 1) :
dotProduct x y ≤ sSup { r : ℝ | ∃ j : Fin n, r = x j }
Each component is bounded by the support function of the simplex.
lemma component_le_supportFunction_simplex {n : Nat} (x : Fin n → ℝ) (j : Fin n) :
x j ≤
supportFunction
{ y : Fin n → Real |
(∀ j, 0 ≤ y j) ∧ (Finset.univ.sum (fun j => y j) = 1) } x
Text 5.5.0.3: The function f which assigns to each x = (xi_1, ..., xi_n) the greatest of the components xi_j of x is the support function of the simplex C = { y = (eta_1, ..., eta_n) | eta_j ≥ 0, eta_1 + ... + eta_n = 1 }.
lemma supportFunction_simplex_eq_maxComponent {n : Nat} :
let C : Set (Fin n → Real) :=
{ y : Fin n → Real | (∀ j, 0 ≤ y j) ∧ (Finset.univ.sum (fun j => y j) = 1) }
supportFunction C = fun x => sSup { r : ℝ | ∃ j : Fin n, r = x j }
Absolute values of components form a bounded-above set.
lemma bddAbove_abs_components {n : Nat} (x : Fin n → ℝ) :
BddAbove { r : ℝ | ∃ j : Fin n, r = |x j| }
Componentwise absolute value bound for convex combinations.
lemma abs_component_le_convexCombo {n : Nat} (x y : Fin n → ℝ) {a b : ℝ}
(ha : 0 ≤ a) (hb : 0 ≤ b) (j : Fin n) :
The set of absolute component values is nonempty in positive dimension.
lemma abs_components_nonempty_succ {n : Nat} (x : Fin (Nat.succ n) → ℝ) :
Set.Nonempty { r : ℝ | ∃ j : Fin (Nat.succ n), r = |x j| }
Dot product bound for vectors in the l1-ball.
lemma dotProduct_le_sSup_abs_components_of_l1Ball {n : Nat} (x y : Fin n → ℝ)
(hy : Finset.univ.sum (fun j => |y j|) ≤ 1) :
dotProduct x y ≤ sSup { r : ℝ | ∃ j : Fin n, r = |x j| }
A single-coordinate vector with bounded absolute value lies in the l1-ball.
lemma l1Ball_single_mem {n : Nat} (j : Fin n) (s : ℝ) (hs : |s| ≤ 1) :
(Pi.single j s : Fin n → ℝ) ∈
{ y : Fin n → ℝ | Finset.univ.sum (fun i => |y i|) ≤ 1 }
Each absolute component is bounded by the support function of the l1-ball.
lemma abs_component_le_supportFunction_l1Ball {n : Nat} (x : Fin n → ℝ) (j : Fin n) :
Text 5.5.0.4: The function k(x) = max { |xi_j| | j = 1, ..., n } is convex in ℝ^n.
lemma convexOn_maxAbsComponent {n : Nat} :
ConvexOn ℝ (Set.univ : Set (Fin n → Real))
(fun x => sSup { r : ℝ | ∃ j : Fin n, r = |x j| })
Text 5.5.0.5: The function k(x) = max { |xi_j| | j = 1, ..., n } is the support function of the convex set D = { y = (eta_1, ..., eta_n) | |eta_1| + ... + |eta_n| ≤ 1 }.
lemma supportFunction_l1Ball_eq_maxAbsComponent {n : Nat} :
let D : Set (Fin n → Real) :=
{ y : Fin n → Real | Finset.univ.sum (fun j => |y j|) ≤ 1 }
supportFunction D = fun x => sSup { r : ℝ | ∃ j : Fin n, r = |x j| }
Membership in the cube is equivalent to an absolute-value bound.
lemma cube_mem_iff_abs_le_one {n : Nat} {x : Fin n → ℝ} :
(x ∈ { x : Fin n → ℝ | ∀ j, -1 ≤ x j ∧ x j ≤ 1 }) ↔ ∀ j, |x j| ≤ 1
If all components of x are bounded by t > 0, then x lies in the scaled cube.
lemma mem_scaling_cube_of_abs_le {n : Nat} {x : Fin n → ℝ} {t : ℝ}
(ht : 0 < t) (hxt : ∀ j, |x j| ≤ t) :
x ∈ (fun y => t • y) '' { x : Fin n → ℝ | ∀ j, -1 ≤ x j ∧ x j ≤ 1 }
Membership in a scaled cube bounds each component in absolute value.
lemma abs_le_of_mem_scaling_cube {n : Nat} {x : Fin n → ℝ} {t : ℝ} (ht : 0 ≤ t)
(hx : x ∈ (fun y => t • y) '' { x : Fin n → ℝ | ∀ j, -1 ≤ x j ∧ x j ≤ 1 }) :
∀ j, |x j| ≤ t
Text 5.5.0.6: The function k(x) = max { |xi_j| | j = 1, ..., n } is the gauge of the n-dimensional cube E = { x = (xi_1, ..., xi_n) | -1 ≤ xi_j ≤ 1, j = 1, ..., n }.
lemma gaugeOfCube_eq_maxAbsComponent {n : Nat} :
let E : Set (Fin n → Real) :=
{ x : Fin n → Real | ∀ j, -1 ≤ x j ∧ x j ≤ 1 }
gaugeOfConvexSet E = fun x => sSup { r : ℝ | ∃ j : Fin n, r = |x j| }
Text 5.5.1: For a function g, define f x = inf { μ | (x, μ) ∈ conv (epi g) }. Then f is called the convex hull of g, and is denoted f = conv(g).
noncomputable def convexHullFunction {n : Nat} (g : (Fin n → Real) → EReal) :
(Fin n → Real) → EReal :=
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈
convexHull Real (epigraph (S := (Set.univ : Set (Fin n → Real))) g) })
The convex hull of an epigraph is convex.
lemma convex_convexHull_epigraph {n : Nat} (g : (Fin n → Real) → EReal) :
Convex ℝ (convexHull ℝ (epigraph (S := (Set.univ : Set (Fin n → Real))) g))
Rewrite the convex hull function as an EReal inf-section.
lemma convexHullFunction_eq_inf_section {n : Nat} (g : (Fin n → Real) → EReal) :
convexHullFunction g =
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈ convexHull ℝ (epigraph (S := (Set.univ : Set (Fin n → Real))) g) })
Text 5.5.2: If f = conv(g) is the convex hull of g, then f is a convex function.
theorem convexFunctionOn_convexHullFunction {n : Nat} (g : (Fin n → Real) → EReal) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (convexHullFunction g)
If h ≤ g, then epi g ⊆ epi h.
lemma epigraph_subset_epigraph_of_le {n : Nat} {h g : (Fin n → Real) → EReal}
(h_le_g : h ≤ g) :
epigraph (S := (Set.univ : Set (Fin n → Real))) g ⊆
epigraph (S := (Set.univ : Set (Fin n → Real))) h
Convex hull of epi g lies in epi h when h is convex and h ≤ g.
lemma convexHull_epigraph_subset_of_convex {n : Nat} {h g : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h)
(h_le_g : h ≤ g) :
convexHull ℝ (epigraph (S := (Set.univ : Set (Fin n → Real))) g) ⊆
epigraph (S := (Set.univ : Set (Fin n → Real))) h
Inclusion in an epigraph gives a pointwise lower bound on the inf-section.
lemma le_inf_section_of_subset_epigraph {n : Nat} {h : (Fin n → Real) → EReal}
{F : Set ((Fin n → Real) × Real)}
(hF : F ⊆ epigraph (S := (Set.univ : Set (Fin n → Real))) h) :
h ≤ fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ | (x, μ) ∈ F })
Text 5.5.3: f = conv(g) is the greatest convex function majorized by g.
theorem convexHullFunction_greatest_convex_minorant {n : Nat} (g : (Fin n → Real) → EReal) :
let f := convexHullFunction g;
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f ∧
f ≤ g ∧
∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
h ≤ g →
h ≤ f
The first projection of a finite sum of pairs is the sum of first projections.
lemma fst_sum {ι : Type*} {α β : Type*} [AddCommMonoid α] [AddCommMonoid β]
(s : Finset ι) (f : ι → α × β) :
(s.sum f).1 = s.sum (fun i => (f i).1)
The second projection of a finite sum of pairs is the sum of second projections.
lemma snd_sum {ι : Type*} {α β : Type*} [AddCommMonoid α] [AddCommMonoid β]
(s : Finset ι) (f : ι → α × β) :
(s.sum f).2 = s.sum (fun i => (f i).2)
Membership in the convex hull of an epigraph is a finite convex combination.
lemma mem_convexHull_epigraph_iff_fin_combo {n : Nat} {g : (Fin n → Real) → EReal}
{x : Fin n → Real} {μ : Real} :
(x, μ) ∈ convexHull ℝ (epigraph (S := (Set.univ : Set (Fin n → Real))) g) ↔
∃ (m : Nat) (lam : Fin m → Real) (x' : Fin m → (Fin n → Real))
(μ' : Fin m → Real),
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
(Finset.univ.sum (fun i => lam i • x' i) = x) ∧
(Finset.univ.sum (fun i => lam i * μ' i) = μ) ∧
(∀ i, g (x' i) ≤ (μ' i : EReal))
Compare finite EReal sums using pointwise bounds and nonnegative weights.
lemma sum_ereal_mul_le_sum_of_le {n m : Nat} {g : (Fin n → Real) → EReal}
(lam : Fin m → Real) (x' : Fin m → (Fin n → Real)) (μ' : Fin m → Real)
(h0 : ∀ i, 0 ≤ lam i) (hμ : ∀ i, g (x' i) ≤ (μ' i : EReal)) :
Finset.univ.sum (fun i => ((lam i : Real) : EReal) * g (x' i)) ≤
Finset.univ.sum (fun i => ((lam i : Real) : EReal) * (μ' i : EReal))
Coercion from ℝ to EReal commutes with finite sums.
lemma ereal_coe_sum {ι : Type*} (s : Finset ι) (f : ι → ℝ) :
(s.sum (fun i => (f i : EReal))) = ((s.sum f : ℝ) : EReal)
A finite sum of EReal terms is not ⊥ if each term is not ⊥.
lemma sum_ne_bot_of_ne_bot {ι : Type*} (s : Finset ι) (f : ι → EReal)
(h : ∀ i ∈ s, f i ≠ ⊥) : s.sum f ≠ ⊥§5 — Functional Operations — Part 7
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Text 5.5.4: conv(g)(x) = inf { λ_1 g(x_1) + ... + λ_m g(x_m) | λ_1 x_1 + ... + λ_m x_m = x }, where the infimum is taken over all convex combinations of points of ℝ^n, assuming g never takes the value -∞.
theorem convexHullFunction_eq_sInf_convexCombination {n : Nat}
{g : (Fin n → Real) → EReal} (h_not_bot : ∀ x, g x ≠ (⊥ : EReal)) :
∀ x : Fin n → Real,
convexHullFunction g x =
sInf { z : EReal |
∃ (m : Nat) (lam : Fin m → Real) (x' : Fin m → (Fin n → Real)),
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
(Finset.univ.sum (fun i => lam i • x' i) = x) ∧
z = Finset.univ.sum (fun i => ((lam i : Real) : EReal) * g (x' i)) }
Text 5.5.5: The convex hull of an arbitrary collection of functions {f_i | i ∈ I} on ℝ^n is denoted conv {f_i | i ∈ I}. It is the function obtained via Theorem 5.3 from the convex hull of the union of the epigraphs of the f_i.
noncomputable def convexHullFunctionFamily {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) : (Fin n → Real) → EReal :=
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) })§5 — Functional Operations — Part 8
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Each epigraph sits inside the convex hull of the union of epigraphs.
lemma epigraph_subset_convexHull_union {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) (i : ι) :
epigraph (S := (Set.univ : Set (Fin n → Real))) (f i) ⊆
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i))
If a convex function lies below each member, then the convex hull of the union of their epigraphs lies in its epigraph.
lemma convexHull_union_subset_epigraph_of_le {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal} {h : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h)
(h_le_f : ∀ i, h ≤ f i) :
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) ⊆
epigraph (S := (Set.univ : Set (Fin n → Real))) h
The EReal infimum of a coerced real set matches the coerced real infimum under nonemptiness and bounded-below hypotheses.
lemma sInf_coe_image_eq_sInf_real {A : Set ℝ} (hne : A.Nonempty) (hbdd : BddBelow A) :
sInf ((fun μ : ℝ => (μ : EReal)) '' A) = ((sInf A : ℝ) : EReal)
Membership in the convex hull of a union of epigraphs gives a finite convex combination of epigraph points with explicit indices.
lemma mem_convexHull_union_epigraph_iff_fin_combo {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal} {x : Fin n → Real} {μ : Real} :
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) ↔
∃ (m : Nat) (idx : Fin m → ι) (lam : Fin m → Real) (x' : Fin m → (Fin n → Real))
(μ' : Fin m → Real),
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
(Finset.univ.sum (fun i => lam i • x' i) = x) ∧
(Finset.univ.sum (fun i => lam i * μ' i) = μ) ∧
(∀ i, f (idx i) (x' i) ≤ (μ' i : EReal))
From properness, there exists a point where the value is not ⊤.
lemma exists_point_ne_top_of_proper {n : Nat} {f : (Fin n → Real) → EReal}
(hproper : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
∃ x, f x ≠ ⊤
Merge a finite convex combination indexed by Fin m into a Finset-indexed form.
lemma merge_epigraph_combo_finset {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
{m : Nat} {idx : Fin m → ι} {lam : Fin m → Real}
{x' : Fin m → (Fin n → Real)} {μ' : Fin m → Real} {x : Fin n → Real} {μ : Real}
(h0 : ∀ i, 0 ≤ lam i)
(hsum1 : Finset.univ.sum (fun i => lam i) = 1)
(hsumx : Finset.univ.sum (fun i => lam i • x' i) = x)
(hsumμ : Finset.univ.sum (fun i => lam i * μ' i) = μ)
(hle : ∀ i, f (idx i) (x' i) ≤ (μ' i : EReal)) :
∃ (s : Finset ι) (lam' : ι → Real) (x'' : ι → (Fin n → Real)) (μ'' : ι → Real),
(∀ i, 0 ≤ lam' i) ∧
(∀ i, i ∉ s → lam' i = 0) ∧
(s.sum (fun i => lam' i) = 1) ∧
(s.sum (fun i => lam' i • x'' i) = x) ∧
(s.sum (fun i => lam' i * μ'' i) = μ) ∧
(∀ i, f i (x'' i) ≤ (μ'' i : EReal))
Finset-indexed convex combinations give points in the convex hull of the union of epigraphs.
lemma mem_convexHull_union_epigraph_of_finset_combo {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal} {x : Fin n → Real} {s : Finset ι}
{lam : ι → Real} {x' : ι → (Fin n → Real)} {μ' : ι → Real}
(h0 : ∀ i, 0 ≤ lam i)
(hsum1 : s.sum (fun i => lam i) = 1)
(hsumx : s.sum (fun i => lam i • x' i) = x)
(hle : ∀ i, f i (x' i) ≤ (μ' i : EReal)) :
(x, s.sum (fun i => lam i * μ' i)) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i))
The convex-hull function family is the EReal inf-section for the convex hull of the union of epigraphs.
lemma convexHullFunctionFamily_eq_inf_section_ereal {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) :
convexHullFunctionFamily f =
fun x =>
sInf ((fun μ : ℝ => (μ : EReal)) '' { μ : ℝ |
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) })
The convex-hull function family is the greatest convex minorant.
lemma convexHullFunctionFamily_greatest_convex_minorant_of_nonempty_bddBelow {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) :
let g := convexHullFunctionFamily f;
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) g ∧
(∀ i, g ≤ f i) ∧
∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
(∀ i, h ≤ f i) →
h ≤ g
If some member of the family is finite at x, then the fiber over x in the convex hull of the union of epigraphs is nonempty.
lemma fiber_nonempty_convexHull_union_of_exists_ne_top {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) {x : Fin n → Real}
(h : ∃ i, f i x ≠ ⊤) :
Set.Nonempty
{ μ : ℝ |
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) }
For each x, either some f i x is finite (yielding a nonempty fiber), or all values are ⊤.
lemma fiber_nonempty_convexHull_union_or_all_top {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) (x : Fin n → Real) :
Set.Nonempty
{ μ : ℝ |
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) }
∨ (∀ i, f i x = ⊤)
If some member takes the value ⊥ at x, then the fiber is unbounded below.
lemma not_bddBelow_fiber_convexHull_union_of_exists_bot {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) {x : Fin n → Real}
(h : ∃ i, f i x = ⊥) :
¬ BddBelow
{ μ : ℝ |
(x, μ) ∈
convexHull ℝ (⋃ i, epigraph (S := (Set.univ : Set (Fin n → Real))) (f i)) }
Text 5.5.6: conv { f_i | i ∈ I } is the greatest convex function f (not necessarily proper) on R^n such that f(x) ≤ f_i(x) for every x ∈ R^n and every i ∈ I.
theorem convexHullFunctionFamily_greatest_convex_minorant {n : Nat} {ι : Sort _}
(f : ι → (Fin n → Real) → EReal) :
let g := convexHullFunctionFamily f;
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) g ∧
(∀ i, g ≤ f i) ∧
∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
(∀ i, h ≤ f i) →
h ≤ g
Theorem 5.6: Let {f_i | i ∈ I} be a collection of proper convex functions on R^n, and let f be the convex hull of the collection. Then f(x) = inf { ∑_{i∈I} λ_i f_i(x_i) | ∑_{i∈I} λ_i x_i = x }, where the infimum is taken over all representations of x as a convex combination of points x_i with only finitely many nonzero coefficients λ_i. (The formula is also valid if one restricts x_i to lie in dom f_i.)
theorem convexHullFunctionFamily_eq_sInf_convexCombination {n : Nat} {ι : Sort _}
{f : ι → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
∀ x : Fin n → Real,
convexHullFunctionFamily f x =
sInf { z : EReal |
∃ (s : Finset ι) (lam : ι → Real) (x' : ι → (Fin n → Real)),
(∀ i, 0 ≤ lam i) ∧
(∀ i, i ∉ s → lam i = 0) ∧
(s.sum (fun i => lam i) = 1) ∧
(s.sum (fun i => lam i • x' i) = x) ∧
z = s.sum (fun i => ((lam i : Real) : EReal) * f i (x' i)) }
The singleton indicator plus a constant equals the constant at the point.
lemma indicator_add_const_at_point {n : Nat} (a : Fin n → Real) (c : Real) :
indicatorFunction ({a} : Set (Fin n → Real)) a + (c : EReal) = (c : EReal)
A bound at a implies a global bound by the singleton indicator plus a constant.
lemma le_indicator_add_const_of_le_at {n : Nat} {h : (Fin n → Real) → EReal}
(a : Fin n → Real) (c : Real) (ha : h a ≤ (c : EReal)) :
h ≤ fun x => indicatorFunction ({a} : Set (Fin n → Real)) x + (c : EReal)
The singleton indicator plus a constant is a proper convex function on Set.univ.
lemma properConvexFunctionOn_indicator_add_const_singleton {n : Nat}
(a : Fin n → Real) (c : Real) :
ProperConvexFunctionOn (Set.univ : Set (Fin n → Real))
(fun x => indicatorFunction ({a} : Set (Fin n → Real)) x + (c : EReal))
A finite sum is ⊤ if one term is ⊤ and all terms are not ⊥.
lemma sum_eq_top_of_term_top {ι : Type*} (s : Finset ι) (f : ι → EReal) {i : ι}
(hi : i ∈ s) (htop : f i = ⊤) (hbot : ∀ j ∈ s, f j ≠ ⊥) :
s.sum f = ⊤§5 — Functional Operations — Part 9
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
The sInf formula for indicator-plus-constant functions reduces to coefficients of alpha.
lemma sInf_convexCombination_indicator_eq {n : Nat} {ι : Sort _}
(a : ι → Fin n → Real) (alpha : ι → Real) (x : Fin n → Real) :
sInf { z : EReal |
∃ (s : Finset ι) (lam : ι → Real) (x' : ι → (Fin n → Real)),
(∀ i, 0 ≤ lam i) ∧
(∀ i, i ∉ s → lam i = 0) ∧
(s.sum (fun i => lam i) = 1) ∧
(s.sum (fun i => lam i • x' i) = x) ∧
z = s.sum (fun i => ((lam i : Real) : EReal) *
(indicatorFunction ({a i} : Set (Fin n → Real)) (x' i) + (alpha i : EReal))) }
=
sInf { z : EReal |
∃ (s : Finset ι) (lam : ι → Real),
(∀ i, 0 ≤ lam i) ∧
(∀ i, i ∉ s → lam i = 0) ∧
(s.sum (fun i => lam i) = 1) ∧
(s.sum (fun i => lam i • a i) = x) ∧
z = s.sum (fun i => ((lam i : Real) : EReal) * (alpha i : EReal)) }
Text 5.6.1: Suppose f_i(x) = δ(x | a_i) + alpha_i, so f_i(x) = alpha_i when x = a_i and f_i(x) = +∞ otherwise. Let f be the convex hull of {f_i}. Then f is the greatest convex function with f(a_i) ≤ alpha_i for all i, and f(x) = inf { Σ_i lambda_i alpha_i | Σ_i lambda_i a_i = x }, where the infimum ranges over convex combinations with only finitely many nonzero coefficients.
theorem convexHullFunctionFamily_indicator_add_const {n : Nat} {ι : Sort _}
(a : ι → Fin n → Real) (alpha : ι → Real) :
let f : (Fin n → Real) → EReal :=
convexHullFunctionFamily
(fun i x =>
indicatorFunction ({a i} : Set (Fin n → Real)) x + (alpha i : EReal));
(ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f ∧
(∀ i, f (a i) ≤ (alpha i : EReal)) ∧
∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
(∀ i, h (a i) ≤ (alpha i : EReal)) →
h ≤ f)
∧
(∀ x : Fin n → Real,
f x =
sInf { z : EReal |
∃ (s : Finset ι) (lam : ι → Real),
(∀ i, 0 ≤ lam i) ∧
(∀ i, i ∉ s → lam i = 0) ∧
(s.sum (fun i => lam i) = 1) ∧
(s.sum (fun i => lam i • a i) = x) ∧
z = s.sum (fun i => ((lam i : Real) : EReal) * (alpha i : EReal)) })
Specialize the convex-combination formula to Fin m by using Finset.univ.
lemma convexHullFunctionFamily_eq_sInf_convexCombination_univ {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
∀ x : Fin n → Real,
convexHullFunctionFamily f x =
sInf { z : EReal |
∃ (lam : Fin m → Real) (x' : Fin m → (Fin n → Real)),
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
(Finset.univ.sum (fun i => lam i • x' i) = x) ∧
z = Finset.univ.sum (fun i => ((lam i : Real) : EReal) * f i (x' i)) }
Right scalar multiple at a scaled point for a nonnegative coefficient.
lemma rightScalarMultiple_smul_eq {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal} {lam : Fin m → Real}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
{i : Fin m} {x : Fin n → Real} (hlam : 0 ≤ lam i) :
rightScalarMultiple (f i) (lam i) (lam i • x) =
((lam i : Real) : EReal) * f i x
Change of variables for infimal convolution of right scalar multiples.
lemma infimalConvolutionFamily_rightScalarMultiple_eq_sInf {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal} {lam : Fin m → Real}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
(hlam : ∀ i, 0 ≤ lam i) :
∀ x : Fin n → Real,
infimalConvolutionFamily (fun i => rightScalarMultiple (f i) (lam i)) x =
sInf { z : EReal |
∃ x' : Fin m → (Fin n → Real),
(Finset.univ.sum (fun i => lam i • x' i) = x) ∧
z = Finset.univ.sum (fun i => ((lam i : Real) : EReal) * f i (x' i)) }
Text 5.6.2: Assume I = {1, ..., m} and f_1, ..., f_m are proper convex functions. Let f = conv {f_1, ..., f_m}. Then f(x) = inf { (f_1 λ_1 □ ... □ f_m λ_m)(x) | λ_i ≥ 0, Σ_i λ_i = 1 }, where f_i λ_i denotes the right scalar multiple and □ is infimal convolution.
theorem convexHullFunctionFamily_eq_sInf_infimalConvolution_rightScalarMultiple
{n m : Nat} {f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
∀ x : Fin n → Real,
convexHullFunctionFamily f x =
sInf { z : EReal |
∃ lam : Fin m → Real,
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
z = infimalConvolutionFamily (fun i => rightScalarMultiple (f i) (lam i)) x }§5 — Functional Operations — Part 10
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Precomposition with a linear map preserves convexity on Set.univ.
lemma convexFunctionOn_precomp_linearMap {n m : Nat}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
∀ g : (Fin m → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin m → Real))) g →
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (fun x => g (A x))
Infimum over affine fibers of a linear map preserves convexity on Set.univ.
lemma convexFunctionOn_inf_fiber_linearMap {n m : Nat}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
ConvexFunctionOn (S := (Set.univ : Set (Fin m → Real)))
(fun y => sInf { z : EReal | ∃ x : Fin n → Real, A x = y ∧ z = h x })
Theorem 5.7: Let A be a linear transformation from R^n to R^m. Then, for each convex function g on R^m, the function gA defined by (gA)(x) = g(Ax) is convex on R^n. For each convex function h on R^n, the function Ah defined by (Ah)(y) = inf { h(x) | A x = y } is convex on R^m.
theorem convexFunctionOn_linearMap_precomp_and_inf {n m : Nat}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real)) :
(∀ g : (Fin m → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin m → Real))) g →
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (fun x => g (A x)))
∧
(∀ h : (Fin n → Real) → EReal,
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h →
ConvexFunctionOn (S := (Set.univ : Set (Fin m → Real)))
(fun y => sInf { z : EReal | ∃ x : Fin n → Real, A x = y ∧ z = h x }))
Text 5.7.1: The function Ah in Theorem 5.7 is called the image of h under A.
noncomputable def imageUnderLinearMap {n m : Nat}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real))
(h : (Fin n → Real) → EReal) : (Fin m → Real) → EReal :=
fun y => sInf { z : EReal | ∃ x : Fin n → Real, A x = y ∧ z = h x }
Text 5.7.1: The function gA in Theorem 5.7 is called the inverse image of g under A.
def inverseImageUnderLinearMap {n m : Nat}
(A : (Fin n → Real) →ₗ[Real] (Fin m → Real))
(g : (Fin m → Real) → EReal) : (Fin n → Real) → EReal :=
fun x => g (A x)
The coordinate projection onto the first m components as a linear map.
def projectionLinearMap {n m : Nat} (hmn : m ≤ n) :
(Fin n → Real) →ₗ[Real] (Fin m → Real)
Coordinate-wise characterization of the projection fiber equation.
lemma projectionLinearMap_eq_iff {n m : Nat} (hmn : m ≤ n)
(x : Fin n → Real) (y : Fin m → Real) :
projectionLinearMap hmn x = y ↔
∀ i : Fin m, x ⟨i.1, lt_of_lt_of_le i.2 hmn⟩ = y i
Text 5.7.2: Let A be the projection `x = (xi_1, ..., xi_m, xi_{m+1}, ..., xi_n) ↦ (xi_1, ..., xi_m). Then (Ah)(xi_1, ..., xi_m) = inf_{xi_{m+1}, ..., xi_n} h(xi_1, ..., xi_n). This is convex in y = (xi_1, ..., xi_m)whenh` is convex.
theorem convexFunctionOn_projection_inf {n m : Nat} (hmn : m ≤ n)
{h : (Fin n → Real) → EReal}
(hh : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) h) :
ConvexFunctionOn (S := (Set.univ : Set (Fin m → Real)))
(fun y =>
sInf { z : EReal |
∃ x : Fin n → Real,
(∀ i : Fin m, x ⟨i.1, lt_of_lt_of_le i.2 hmn⟩ = y i) ∧
z = h x })
For a linear equivalence, the fiber over y is a singleton.
lemma exists_eq_of_linearEquiv_fiber {n m : Nat}
(A : (Fin n → Real) ≃ₗ[Real] (Fin m → Real))
(h : (Fin n → Real) → EReal) :
∀ (y : Fin m → Real) (z : EReal),
(∃ x : Fin n → Real, A x = y ∧ z = h x) ↔ z = h (A.symm y)
Text 5.7.3: Let A be a linear transformation from R^n to R^m. When A is non-singular (so n = m and A^{-1} exists), for a convex function h on R^n, Ah = hA^{-1}.
theorem imageUnderLinearMap_eq_inverseImage_under_symm {n m : Nat}
(A : (Fin n → Real) ≃ₗ[Real] (Fin m → Real))
{h : (Fin n → Real) → EReal} :
imageUnderLinearMap A.toLinearMap h =
inverseImageUnderLinearMap A.symm.toLinearMap h
Text 5.7.4 (Partial infimal convolution): Let n = m + p and write x = (y, z) with y ∈ ℝ^m and z ∈ ℝ^p. For proper convex f, g : ℝ^m × ℝ^p → (-∞, +∞], the partial infimal convolution of f and g with respect to the z-variable is the function h(y, z) = inf_{u ∈ ℝ^p} { f(y, z - u) + g(y, u) }.
noncomputable def partialInfimalConvolutionZ {m p : Nat}
(f g : (Fin m → Real) × (Fin p → Real) → EReal) :
(Fin m → Real) × (Fin p → Real) → EReal :=
fun yz =>
sInf { r : EReal | ∃ u : Fin p → Real, r = f (yz.1, yz.2 - u) + g (yz.1, u) }
Right scalar multiple at 1 returns the original function.
lemma rightScalarMultiple_one_eq {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f) :
∀ x : Fin n → Real, rightScalarMultiple f (1 : Real) x = f x
Split a lower bound on f1 x + f2 x into two pieces.
lemma exists_mu1_mu2_of_ge_sum {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2)
{x : Fin n → Real} {μ : EReal} (hle : f1 x + f2 x ≤ μ) :
∃ μ1 μ2 : EReal, μ = μ1 + μ2 ∧ f1 x ≤ μ1 ∧ f2 x ≤ μ2
Membership in F is equivalent to the sum inequality.
lemma mem_F_iff_ge_sum {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, μ = μ1 + μ2 ∧
(lam, x, μ1) ∈ K1 ∧ (lam, x, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F ↔ f1 x + f2 x ≤ μ
The infimum of the upper set {μ | a ≤ μ} is a.
lemma sInf_Ici_eq_self {a : EReal} : sInf { μ : EReal | a ≤ μ } = a
Text 5.8.0.1: Let f1, f2 be proper convex functions on ℝ^n. Define K1 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f1 λ)(x) } and K2 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f2 λ)(x) }. Let K = { (λ, x, μ) | ∃ μ1 μ2, μ = μ1 + μ2, (λ, x, μ1) ∈ K1, (λ, x, μ2) ∈ K2 }, F = { (x, μ) | (1, x, μ) ∈ K }, and f x = inf { μ | (x, μ) ∈ F }. Then f = f1 + f2.
theorem sum_properConvex_eq_inf_of_K {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, μ = μ1 + μ2 ∧
(lam, x, μ1) ∈ K1 ∧ (lam, x, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
let f : (Fin n → Real) → EReal :=
fun x => sInf { μ : EReal | (x, μ) ∈ F }
f = fun x => f1 x + f2 x
Exact sums lie in F.
lemma mem_F_of_exact_sum {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam, x1, μ1) ∈ K1 ∧ (lam, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x x1 x2 : Fin n → Real} {μ : EReal},
x1 + x2 = x → μ = f1 x1 + f2 x2 → (x, μ) ∈ F
Membership in F yields a split with a lower bound on μ.
lemma exists_sum_le_of_mem_F {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam, x1, μ1) ∈ K1 ∧ (lam, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F →
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧ f1 x1 + f2 x2 ≤ μ
The sInf defining F matches the infimal convolution set pointwise.
lemma sInf_F_eq_sInf_infimal_pointwise {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam, x1, μ1) ∈ K1 ∧ (lam, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ x : Fin n → Real,
sInf { μ : EReal | (x, μ) ∈ F } =
sInf { z : EReal |
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧ z = f1 x1 + f2 x2 }
Text 5.8.0.2: Let f1, f2 be proper convex functions on ℝ^n. Define K1 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f1 λ)(x) } and K2 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f2 λ)(x) }. Let `K = { (λ, x, μ) | ∃ μ1 μ2 x1 x2, μ = μ1 + μ2, x = x1 + x2, (λ, x1, μ1) ∈ K1, (λ, x2, μ2) ∈ K2 }`, F = { (x, μ) | (1, x, μ) ∈ K }, and f x = inf { μ | (x, μ) ∈ F }. Then f = f1 □ f2.
theorem infimalConvolution_eq_inf_of_K {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam, x1, μ1) ∈ K1 ∧ (lam, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
let f : (Fin n → Real) → EReal :=
fun x => sInf { μ : EReal | (x, μ) ∈ F }
f = infimalConvolution f1 f2
Unpack membership in F for the pairwise convex hull construction.
lemma mem_F_iff_exists_pair {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
lam = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam1, x1, μ1) ∈ K1 ∧ (lam2, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F ↔
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
(1 : ℝ) = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(0 ≤ lam1 ∧ rightScalarMultiple f1 lam1 x1 ≤ μ1) ∧
(0 ≤ lam2 ∧ rightScalarMultiple f2 lam2 x2 ≤ μ2)
Membership in F yields a weighted split with a lower bound on μ.
lemma exists_sum_le_of_mem_F_pair {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
lam = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam1, x1, μ1) ∈ K1 ∧ (lam2, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F →
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧ lam1 + lam2 = 1 ∧
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧
rightScalarMultiple f1 lam1 x1 + rightScalarMultiple f2 lam2 x2 ≤ μ
Exact weighted sums belong to F.
lemma mem_F_of_exact_sum_pair {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
lam = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam1, x1, μ1) ∈ K1 ∧ (lam2, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x x1 x2 : Fin n → Real} {lam1 lam2 : ℝ},
0 ≤ lam1 → 0 ≤ lam2 → lam1 + lam2 = 1 → x1 + x2 = x →
(x, rightScalarMultiple f1 lam1 x1 + rightScalarMultiple f2 lam2 x2) ∈ F
The sInf defining F matches the pairwise rightScalarMultiple infimum.
lemma sInf_F_eq_sInf_rightScalarMultiple_pair {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
lam = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam1, x1, μ1) ∈ K1 ∧ (lam2, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ x : Fin n → Real,
sInf { μ : EReal | (x, μ) ∈ F } =
sInf { z : EReal |
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧ lam1 + lam2 = 1 ∧
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧
z = rightScalarMultiple f1 lam1 x1 + rightScalarMultiple f2 lam2 x2 }
The pairwise rightScalarMultiple infimum matches the Fin 2 family form.
lemma sInf_pair_eq_sInf_infimalConvolutionFamily {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
∀ x : Fin n → Real,
sInf { z : EReal |
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧ lam1 + lam2 = 1 ∧
∃ x1 x2 : Fin n → Real, x1 + x2 = x ∧
z = rightScalarMultiple f1 lam1 x1 + rightScalarMultiple f2 lam2 x2 } =
sInf { z : EReal |
∃ lam : Fin 2 → Real,
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = 1) ∧
z = infimalConvolutionFamily
(fun i => rightScalarMultiple (if i = 0 then f1 else f2) (lam i)) x }
Text 5.8.0.3: Let f1, f2 be proper convex functions on ℝ^n. Define K1 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f1 λ)(x) } and K2 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f2 λ)(x) }. Let `K = { (λ, x, μ) | ∃ λ1, λ2 ≥ 0, ∃ μ1, μ2, x1, x2, λ = λ1 + λ2, μ = μ1 + μ2, x = x1 + x2, (λ1, x1, μ1) ∈ K1, (λ2, x2, μ2) ∈ K2 }`, F = { (x, μ) | (1, x, μ) ∈ K }, and f x = inf { μ | (x, μ) ∈ F }. Then f = conv{f1, f2}.
theorem convexHullFunctionPair_eq_inf_of_K {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
∃ lam1 lam2 : ℝ, 0 ≤ lam1 ∧ 0 ≤ lam2 ∧
∃ μ1 μ2 : EReal, ∃ x1 x2 : Fin n → Real,
lam = lam1 + lam2 ∧ μ = μ1 + μ2 ∧ x = x1 + x2 ∧
(lam1, x1, μ1) ∈ K1 ∧ (lam2, x2, μ2) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
let f : (Fin n → Real) → EReal :=
fun x => sInf { μ : EReal | (x, μ) ∈ F }
f = convexHullFunctionFamily (fun i : Fin 2 => if i = 0 then f1 else f2)
Membership in F is equivalent to simultaneous lower bounds for f1 and f2.
lemma mem_F_iff_ge_both {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
(lam, x, μ) ∈ K1 ∧ (lam, x, μ) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F ↔ f1 x ≤ μ ∧ f2 x ≤ μ
Membership in F is equivalent to a max lower bound.
lemma mem_F_iff_ge_max {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
(lam, x, μ) ∈ K1 ∧ (lam, x, μ) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
∀ {x : Fin n → Real} {μ : EReal}, (x, μ) ∈ F ↔ max (f1 x) (f2 x) ≤ μ
The infimum of the upper set for the max is the max.
lemma sInf_ge_max_eq {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
∀ x : Fin n → Real,
sInf { μ : EReal | max (f1 x) (f2 x) ≤ μ } = max (f1 x) (f2 x)
Text 5.8.0.4: Let f1, f2 be proper convex functions on ℝ^n. Define K1 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f1 λ)(x) } and K2 = { (λ, x, μ) | λ ≥ 0, μ ≥ (f2 λ)(x) }. Let K = { (λ, x, μ) | (λ, x, μ) ∈ K1, (λ, x, μ) ∈ K2 }, F = { (x, μ) | (1, x, μ) ∈ K }, and f x = inf { μ | (x, μ) ∈ F }. Then f = max{f1, f2}.
theorem max_properConvex_eq_inf_of_K {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
(hf1 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f1)
(hf2 : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f2) :
let K1 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f1 lam x }
let K2 : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
0 ≤ lam ∧ μ ≥ rightScalarMultiple f2 lam x }
let K : Set (ℝ × (Fin n → Real) × EReal) :=
{ p | let lam := p.1; let x := p.2.1; let μ := p.2.2;
(lam, x, μ) ∈ K1 ∧ (lam, x, μ) ∈ K2 }
let F : Set ((Fin n → Real) × EReal) :=
{ p | ((1 : ℝ), p.1, p.2) ∈ K }
let f : (Fin n → Real) → EReal :=
fun x => sInf { μ : EReal | (x, μ) ∈ F }
f = fun x => max (f1 x) (f2 x)
Sum of pointwise convex combinations equals the convex combination of sums.
lemma sum_components_convex_combo {n m : Nat}
(x' y' : Fin m → (Fin n → Real)) (t : Real) :
Finset.univ.sum (fun i => (1 - t) • x' i + t • y' i) =
(1 - t) • Finset.univ.sum (fun i => x' i) +
t • Finset.univ.sum (fun i => y' i)
On a nonempty finite index, iSup preserves strict upper bounds.
lemma iSup_lt_of_forall_lt_fin {m : Nat} {a : Fin m → EReal} {r : EReal}
(hm : 0 < m) (h : ∀ i, a i < r) : iSup a < r§5 — Functional Operations — Part 11
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
Theorem 5.8.1: Let f_1, ..., f_m be proper convex functions on ℝ^n. Then f(x) = inf { max { f_1(x_1), ..., f_m(x_m) } | x_1 + ... + x_m = x } is convex.
theorem convexFunctionOn_inf_iSup_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x =>
sInf { z : EReal |
∃ x' : Fin m → (Fin n → Real),
(Finset.univ.sum (fun i => x' i) = x) ∧
z = iSup (fun i : Fin m => f i (x' i)) })§5 — Functional Operations — Part 12
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
The simplex of nonnegative weights summing to 1.
def simplexSet (m : Nat) : Set (Fin m → Real) :=
{ lam | (∀ i, 0 ≤ lam i) ∧ Finset.univ.sum (fun i => lam i) = (1 : Real) }
The simplex is convex.
lemma convex_simplexSet {m : Nat} : Convex ℝ (simplexSet m)
Projection onto the x coordinates (first n) in Fin (n+m).
def projXLinearMap {n m : Nat} : (Fin (n + m) → Real) →ₗ[Real] (Fin n → Real)
Projection onto the λ coordinates (last m) in Fin (n+m).
def projLamLinearMap {n m : Nat} : (Fin (n + m) → Real) →ₗ[Real] (Fin m → Real)
Linear map selecting the ith λ coordinate and all x coordinates.
def lamXLinearMap {n m : Nat} (i : Fin m) :
(Fin (n + m) → Real) →ₗ[Real] (Fin (n + 1) → Real)
Perspective convexity after selecting the ith λ coordinate.
lemma convexFunctionOn_perspective_coord {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
(i : Fin m) :
ConvexFunctionOn (S := (Set.univ : Set (Fin (n + m) → Real)))
(fun x =>
if 0 ≤ x (Fin.natAdd n i) then
rightScalarMultiple (f i) (x (Fin.natAdd n i)) (fun k => x (Fin.castAdd m k))
else
(⊤ : EReal))
Indicator of the simplex, precomposed with the λ projection, is convex.
lemma convexFunctionOn_indicator_simplex_precomp {n m : Nat} :
ConvexFunctionOn (S := (Set.univ : Set (Fin (n + m) → Real)))
(fun x => indicatorFunction (simplexSet m) (projLamLinearMap (n := n) (m := m) x))
Non-⊥ is preserved by finite sums.
lemma finset_sum_ne_bot {α : Type*} [DecidableEq α] (s : Finset α) (f : α → EReal)
(h : ∀ a ∈ s, f a ≠ (⊥ : EReal)) : s.sum f ≠ (⊥ : EReal)
Theorem 5.8.2: Let f_1, ..., f_m be proper convex functions on ℝ^n. Then the function g(x) = inf { (f_1 λ_1)(x) + ... + (f_m λ_m)(x) | λ_i ≥ 0, λ_1 + ... + λ_m = 1 } is convex.
theorem convexFunctionOn_inf_sum_rightScalarMultiple_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x =>
sInf { z : EReal |
∃ lam : Fin m → Real,
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = (1 : Real)) ∧
z = Finset.univ.sum (fun i => rightScalarMultiple (f i) (lam i) x) })
The pointwise supremum of the perspective-coordinate functions is convex.
lemma convexFunctionOn_gsup {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin (n + m) → Real)))
(fun x =>
iSup (fun i : Fin m =>
if 0 ≤ x (Fin.natAdd n i) then
rightScalarMultiple (f i) (x (Fin.natAdd n i)) (fun k => x (Fin.castAdd m k))
else
(⊤ : EReal)))
The pointwise supremum of the perspective-coordinate functions is never ⊥ when m > 0.
lemma gsup_ne_bot {n m : Nat} {f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
(hm : 0 < m) :
∀ x : Fin (n + m) → Real,
(iSup (fun i : Fin m =>
if 0 ≤ x (Fin.natAdd n i) then
rightScalarMultiple (f i) (x (Fin.natAdd n i)) (fun k => x (Fin.castAdd m k))
else
(⊤ : EReal))) ≠ (⊥ : EReal)
Adding the simplex indicator to the supremum perspective term is convex.
lemma convexFunctionOn_gind_add_gsup {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i))
(hm : 0 < m) :
ConvexFunctionOn (S := (Set.univ : Set (Fin (n + m) → Real)))
(fun x =>
indicatorFunction (simplexSet m) (projLamLinearMap (n := n) (m := m) x) +
iSup (fun i : Fin m =>
if 0 ≤ x (Fin.natAdd n i) then
rightScalarMultiple (f i) (x (Fin.natAdd n i)) (fun k => x (Fin.castAdd m k))
else
(⊤ : EReal)))
Theorem 5.8.3: Let f_1, ..., f_m be proper convex functions on ℝ^n. Then h(x) = inf { max { (f_1 λ_1)(x), ..., (f_m λ_m)(x) } | λ_i ≥ 0, λ_1 + ... + λ_m = 1 } is convex.
theorem convexFunctionOn_inf_iSup_rightScalarMultiple_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x =>
sInf { z : EReal |
∃ lam : Fin m → Real,
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = (1 : Real)) ∧
z = iSup (fun i : Fin m => rightScalarMultiple (f i) (lam i) x) })
Convex combinations preserve the simplex constraints.
lemma lam_combo_in_simplex {m : Nat} {lamx lamy : Fin m → Real} {t : Real}
(hx : lamx ∈ simplexSet m) (hy : lamy ∈ simplexSet m)
(ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
(fun i => (1 - t) * lamx i + t * lamy i) ∈ simplexSet m
Strict inequality for scaled values along convex combinations.
lemma mul_f_strict_lt_convex_combo {n : Nat} {f : (Fin n → Real) → EReal}
(hf : ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) f)
{x y : Fin n → Real} {lamx lamy : Real} {α β : Real} {t : Real}
(hx : rightScalarMultiple f lamx x < (α : EReal))
(hy : rightScalarMultiple f lamy y < (β : EReal))
(ht0 : 0 < t) (ht1 : t < 1)
(hlamx : 0 ≤ lamx) (hlamy : 0 ≤ lamy) :
rightScalarMultiple f ((1 - t) * lamx + t * lamy) ((1 - t) • x + t • y) <
((1 - t : Real) : EReal) * (α : EReal) + ((t : Real) : EReal) * (β : EReal)
Theorem 5.8.4: Let f_1, ..., f_m be proper convex functions on ℝ^n. Then the function k defined by k(x) = inf { max { λ_1 f_1(x_1), ..., λ_m f_m(x_m) } } is convex, with the infimum taken over λ_i ≥ 0, ∑ λ_i = 1, and x_1 + ... + x_m = x.
theorem convexFunctionOn_inf_iSup_weighted_of_proper {n m : Nat}
{f : Fin m → (Fin n → Real) → EReal}
(hf : ∀ i, ProperConvexFunctionOn (S := (Set.univ : Set (Fin n → Real))) (f i)) :
ConvexFunctionOn (S := (Set.univ : Set (Fin n → Real)))
(fun x =>
sInf { z : EReal |
∃ (lam : Fin m → Real) (x' : Fin m → (Fin n → Real)),
(∀ i, 0 ≤ lam i) ∧
(Finset.univ.sum (fun i => lam i) = (1 : Real)) ∧
(Finset.univ.sum (fun i => x' i) = x) ∧
z = iSup (fun i : Fin m => rightScalarMultiple (f i) (lam i) (x' i)) })§5 — Functional Operations — Part 13
Lean authors: Zichen Wang, Wanli Ma, Yifan Bai, Zaiwen Wen.
The max-value set used in the infimum is nonempty.
lemma inf_max_set_nonempty {n : Nat} {f1 f2 : (Fin n → Real) → EReal} (x : Fin n → Real) :
Set.Nonempty { z : EReal | ∃ y, z = max (f1 (x - y)) (f2 y) }
If the infimum is below α, then the point lies in the Minkowski sum of sublevel sets.
lemma mem_add_of_fx_lt {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
{α : EReal} {x : Fin n → Real}
(hx :
sInf { z : EReal | ∃ y, z = max (f1 (x - y)) (f2 y) } < α) :
x ∈ Set.image2 (fun a b => a + b)
{ a : Fin n → Real | f1 a < α }
{ b : Fin n → Real | f2 b < α }
If x is a sum of sublevel points, then the infimum is below α.
lemma fx_lt_of_mem_add {n : Nat} {f1 f2 : (Fin n → Real) → EReal}
{α : EReal} {x : Fin n → Real}
(hx :
x ∈ Set.image2 (fun a b => a + b)
{ a : Fin n → Real | f1 a < α }
{ b : Fin n → Real | f2 b < α }) :
sInf { z : EReal | ∃ y, z = max (f1 (x - y)) (f2 y) } < α
Text 5.8.5: Let f1, f2 be proper convex functions on ℝ^n and define f x = inf_y max { f1 (x - y), f2 y }. Then, for any α, {x | f x < α} = {x | f1 x < α} + {x | f2 x < α} (set sum).
theorem sublevelSet_inf_iSup_eq_add {n : Nat} {f1 f2 : (Fin n → Real) → EReal} :
let f : (Fin n → Real) → EReal :=
fun x =>
sInf { z : EReal | ∃ y : Fin n → Real, z = max (f1 (x - y)) (f2 y) }
∀ α : EReal,
{ x : Fin n → Real | f x < α } =
Set.image2 (fun x y => x + y)
{ x : Fin n → Real | f1 x < α }
{ y : Fin n → Real | f2 y < α }