Ch. 4 preamble and §§4.1, 4.5, pp. 297–305 — Bregman divergence, mirror maps, ρ-strong convexity and β-smoothness w.r.t. ‖·‖, Bregman projection, mirror prox
DefinitionConvexOptAlg_MirrorProx_DefsThis module fixes the objects of Chapter 4 that mirror prox uses. Throughout, is a finite-dimensional real vector space carrying an arbitrary norm (the book's with a fixed norm). Gradients are linear functionals on : is the value of the functional at , and the dual norm is the operator norm of .
- Bregman divergence. For with gradient map ,
- Mirror map. Let be a convex open set. A function is a mirror map on if (i) is strictly convex on and differentiable at every point of ; (ii) its gradient takes all possible values: every linear functional equals for some ; (iii) its gradient diverges on the boundary: as inside , for every boundary point of .
- Strong convexity w.r.t. . is -strongly convex on a set if
- Smoothness w.r.t. . is -smooth on if it has a gradient at every (relative to ) and for all .
- Bregman projection. is a Bregman projection of onto , i.e. , if and for every .
- Mirror prox. Sequences form a run of mirror prox with step size if and, for every , and
The algorithm first makes a mirror descent step from to , then a second step, again from , with the gradient evaluated at . These are the objects of Lemma 4.1 and Theorem 4.4 of the book.
Formalization Note The gradient of is an explicit map Φ' with values in the continuous linear functionals E →L[ℝ] ℝ, and HasFDerivAt Φ (Φ' x) x for ; the gradient of is an explicit map f' with HasFDerivWithinAt f (f' x) X x for (the book's is a function on ). Property (iii) is stated as a limit along at each frontier point. The projection and the run are relations: every argmin choice is allowed, no choice function is used. The run does not fix beyond ; theorems that need assume it. The index is unused. The conditions and are hypotheses of each theorem.
import Mathlib
namespace ConvexOptAlg.MirrorProx
open Filter Topology
/-- The Bregman divergence (Bubeck, arXiv:1405.4980v2, Ch. 4 preamble, p. 297):
`D_Φ(x, y) = Φ(x) − Φ(y) − ∇Φ(y)⊤(x − y)`. The gradient `∇Φ(y)` is the continuous linear functional
`Φ' y : E →L[ℝ] ℝ`, and `∇Φ(y)⊤v` is its value `Φ' y v`. -/
def bregman {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(Φ : E → ℝ) (Φ' : E → E →L[ℝ] ℝ) (x y : E) : ℝ :=
Φ x - Φ y - Φ' y (x - y)
/-- `Φ` is a mirror map on the convex open set `D` with gradient map `Φ'`
(§4.1, p. 298): `D` is open and convex, and
(i) `Φ` is strictly convex on `D` and differentiable at every point of `D`, with derivative `Φ' x`;
(ii) the gradient takes all possible values, `∇Φ(D) = (ℝⁿ)*`: every continuous linear functional
is `Φ' y` for some `y ∈ D`;
(iii) the gradient diverges on the boundary of `D`: for every `z ∈ ∂D`,
`‖∇Φ(x)‖ → +∞` as `x → z` inside `D` (the norm of `∇Φ(x)` is the dual (operator) norm).
The set conditions `X ⊆ closure D` and `X ∩ D ≠ ∅` of §4.1 are separate hypotheses of each theorem. -/
def IsMirrorMap {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(D : Set E) (Φ : E → ℝ) (Φ' : E → E →L[ℝ] ℝ) : Prop :=
IsOpen D ∧ Convex ℝ D ∧ StrictConvexOn ℝ D Φ ∧
(∀ x ∈ D, HasFDerivAt Φ (Φ' x) x) ∧
(∀ φ : E →L[ℝ] ℝ, ∃ y ∈ D, Φ' y = φ) ∧
(∀ z ∈ frontier D, Tendsto (fun x => ‖Φ' x‖) (𝓝[D] z) atTop)
/-- `Φ` is `ρ`-strongly convex on the set `S` w.r.t. `‖·‖`, with gradient map `Φ'`
(Ch. 4 preamble (iii), p. 297, for a differentiable function, whose only subgradient is the
gradient): `Φ(x) − Φ(y) ≤ ∇Φ(x)⊤(x − y) − (ρ/2)‖x − y‖²` for all `x, y ∈ S`.
It is used with `S = X ∩ D`. -/
def IsStronglyConvexWRT {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(S : Set E) (Φ : E → ℝ) (Φ' : E → E →L[ℝ] ℝ) (ρ : ℝ) : Prop :=
∀ x ∈ S, ∀ y ∈ S, Φ x - Φ y ≤ Φ' x (x - y) - ρ / 2 * ‖x - y‖ ^ 2
/-- `f` is `β`-smooth on `X` w.r.t. `‖·‖`, with gradient map `f'` (Ch. 4 preamble (ii), p. 297):
`f' x` is the derivative of `f` at `x` within `X` for every `x ∈ X`, and
`‖∇f(x) − ∇f(y)‖∗ ≤ β‖x − y‖` for all `x, y ∈ X`, the dual norm `‖·‖∗` being the operator norm
on `E →L[ℝ] ℝ`. -/
def IsSmoothWRT {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(X : Set E) (f : E → ℝ) (f' : E → E →L[ℝ] ℝ) (β : ℝ) : Prop :=
(∀ x ∈ X, HasFDerivWithinAt f (f' x) X x) ∧
∀ x ∈ X, ∀ y ∈ X, ‖f' x - f' y‖ ≤ β * ‖x - y‖
/-- `z` is a Bregman projection of `y` onto `X ∩ D`: `z ∈ X ∩ D` and `z` minimizes
`w ↦ D_Φ(w, y)` over `X ∩ D` (§4.1, p. 298: `Π^Φ_X(y) = argmin_{x ∈ X ∩ D} D_Φ(x, y)`). -/
def IsBregmanProj {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(X D : Set E) (Φ : E → ℝ) (Φ' : E → E →L[ℝ] ℝ) (y z : E) : Prop :=
z ∈ X ∩ D ∧ ∀ w ∈ X ∩ D, bregman Φ Φ' z y ≤ bregman Φ Φ' w y
/-- The sequences `(x_t, y_t, y'_t, x'_t)` form a run of mirror prox with step size `η`
(§4.5, p. 305): `x₁ ∈ X ∩ D`, and for every `t ≥ 1`
* `y'_{t+1} ∈ D` and `∇Φ(y'_{t+1}) = ∇Φ(x_t) − η∇f(x_t)`;
* `y_{t+1} ∈ argmin_{x ∈ X ∩ D} D_Φ(x, y'_{t+1})`;
* `x'_{t+1} ∈ D` and `∇Φ(x'_{t+1}) = ∇Φ(x_t) − η∇f(y_{t+1})`;
* `x_{t+1} ∈ argmin_{x ∈ X ∩ D} D_Φ(x, x'_{t+1})`.
The gradients `∇f` are given by the map `f'`. Index `0` is unused. The choice of `x₁` is not
fixed here; theorems that need `x₁ ∈ argmin_{X ∩ D} Φ` assume it. -/
def IsMirrorProxRun {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
(X D : Set E) (Φ : E → ℝ) (Φ' : E → E →L[ℝ] ℝ) (f' : E → E →L[ℝ] ℝ) (η : ℝ)
(x y y' x' : ℕ → E) : Prop :=
x 1 ∈ X ∩ D ∧
∀ t : ℕ, 1 ≤ t →
y' (t + 1) ∈ D ∧ Φ' (y' (t + 1)) = Φ' (x t) - η • f' (x t) ∧
IsBregmanProj X D Φ Φ' (y' (t + 1)) (y (t + 1)) ∧
x' (t + 1) ∈ D ∧ Φ' (x' (t + 1)) = Φ' (x t) - η • f' (y (t + 1)) ∧
IsBregmanProj X D Φ Φ' (x' (t + 1)) (x (t + 1))
end ConvexOptAlg.MirrorProx