Documentation

ConvexAnalysis.Subgradient

Subgradients and the subdifferential in a real inner product space #

Subgradients of an extended valued function f : H → EReal on a real inner product space, paired by the inner product, the subdifferential ∂f x, and the normal cone N_C x = ∂ι_C x, with Fermat's rule, scaling, and the monotonicity of ∂f.

Main definitions #

Main statements #

The existence of subgradients is in ConvexAnalysis.SubgradientExistence, the sum rule and the optimality condition 0 ∈ ∂f x + N_C x in ConvexAnalysis.SumRule.

Implementation notes #

HasSubgradientAt is a structure that records that f x is finite, so ∂f x = ∅ whenever f x = ±∞, as in BC, Proposition 16.4 for proper f. The open Mathlib PR #45868 does the same for subgradients along a bilinear pairing: there the structure is HasSubgradientWithinAt and HasSubgradientAt is its case s = univ. We pair with the inner product and have no Within variant.

References #

Tags #

subgradient, subdifferential, Fermat's rule, normal cone, indicator function, monotone operator

structure ConvexAnalysis.HasSubgradientAt {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (f : H → EReal) (u x : H) :

u is a subgradient of f at x BC, Definition 16.1: the value f x is finite and the affine function y ↦ f x + ⟪y - x, u⟫ lies below f.

  • mem_effectiveDomain : x ∈ effectiveDomain f

    The value at the base point is less than ⊤.

  • bot_lt : ⊥ < f x

    The value at the base point is greater than ⊥.

  • le (y : H) : f x + ↑(inner ℝ (y - x) u) ≤ f y

    The affine minorant.

Instances For
    theorem ConvexAnalysis.hasSubgradientAt_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (f : H → EReal) (u x : H) :
    HasSubgradientAt f u x ↔ x ∈ effectiveDomain f ∧ ⊥ < f x ∧ ∀ (y : H), f x + ↑(inner ℝ (y - x) u) ≤ f y

    u is a subgradient of f at x iff f x is finite and f x + ⟪y - x, u⟫ ≤ f y for every y.

    The subdifferential ∂f x: the set of subgradients of f at x.

    Equations
    Instances For
      @[simp]

      Membership in the subdifferential.

      theorem ConvexAnalysis.HasSubgradientAt.exists_coe {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} (h : HasSubgradientAt f u x) :
      ∃ (r : ℝ), f x = ↑r

      At a point with a subgradient, the value of f is a real number.

      theorem ConvexAnalysis.hasSubgradientAt_iff_of_eq_coe {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} {r : ℝ} (hr : f x = ↑r) :
      HasSubgradientAt f u x ↔ ∀ (y : H), ↑(r + inner ℝ (y - x) u) ≤ f y

      The subgradient inequality when f x is the real number r.

      @[simp]
      theorem ConvexAnalysis.hasSubgradientAt_coe_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {u x : H} {f : H → ℝ} :
      HasSubgradientAt (fun (y : H) => ↑(f y)) u x ↔ ∀ (y : H), f x + inner ℝ (y - x) u ≤ f y

      Subgradients of a real valued function.

      A function with a subgradient somewhere is proper: the affine minorant keeps it above ⊥.

      ∂f x is empty where f x = ⊤.

      ∂f x is empty where f x = ⊥.

      theorem ConvexAnalysis.IsProper.hasSubgradientAt_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} (hf : IsProper f) :
      HasSubgradientAt f u x ↔ ∀ (y : H), f x + ↑(inner ℝ (y - x) u) ≤ f y

      For a proper f, a subgradient is an affine minorant of f that touches f at x.

      @[simp]

      Zero is a subgradient at x iff f x is finite and x minimizes f.

      Fermat's rule BC, Theorem 16.3: a point minimizes a proper function f iff 0 is a subgradient of f there.

      theorem ConvexAnalysis.hasSubgradientAt_const {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (c : ℝ) (x : H) :
      HasSubgradientAt (fun (x : H) => ↑c) 0 x

      0 is a subgradient of a constant function.

      @[simp]
      theorem ConvexAnalysis.subdifferential_const {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (c : ℝ) (x : H) :
      subdifferential (fun (x : H) => ↑c) x = {0}

      The subdifferential of a constant function is {0}.

      @[simp]

      The subdifferential of the zero function is {0}.

      theorem ConvexAnalysis.hasSubgradientAt_add_const_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} (c : ℝ) :
      HasSubgradientAt (fun (y : H) => f y + ↑c) u x ↔ HasSubgradientAt f u x

      Adding a real constant does not change the subgradients.

      @[simp]
      theorem ConvexAnalysis.subdifferential_add_const {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (f : H → EReal) (c : ℝ) (x : H) :
      subdifferential (fun (y : H) => f y + ↑c) x = subdifferential f x

      ∂(f + c) x = ∂f x for a real constant c, for every f.

      theorem ConvexAnalysis.hasSubgradientAt_add_inner_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {a u x : H} :
      HasSubgradientAt (fun (y : H) => f y + ↑(inner ℝ a y)) u x ↔ HasSubgradientAt f (u - a) x

      The tilt rule for one subgradient: u is a subgradient of f + ⟪a, ·⟫ at x iff u - a is a subgradient of f at x, for every f.

      theorem ConvexAnalysis.subdifferential_add_inner {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (f : H → EReal) (a x : H) :
      subdifferential (fun (y : H) => f y + ↑(inner ℝ a y)) x = subdifferential f x + {a}

      The tilt rule ∂(f + ⟪a, ·⟫) x = ∂f x + a, for every f.

      theorem ConvexAnalysis.subdifferential_comp_add_right {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (f : H → EReal) (b z : H) :
      subdifferential (fun (y : H) => f (y + b)) z = subdifferential f (z + b)

      Translation: the subgradients of y ↦ f (y + b) at z are those of f at z + b.

      theorem ConvexAnalysis.hasSubgradientAt_const_mul_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} {c : ℝ} (hc : 0 < c) :
      HasSubgradientAt (fun (y : H) => ↑c * f y) (c • u) x ↔ HasSubgradientAt f u x

      Scaling: for c > 0, c • u is a subgradient of c * f at x iff u is a subgradient of f at x.

      theorem ConvexAnalysis.HasSubgradientAt.const_mul {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u x : H} (h : HasSubgradientAt f u x) {c : ℝ} (hc : 0 ≤ c) :
      HasSubgradientAt (fun (y : H) => ↑c * f y) (c • u) x

      For c ≥ 0, c • u is a subgradient of c * f if u is a subgradient of f. At c = 0 the multiple is the zero function, as 0 * ⊤ = 0 * ⊥ = 0 in EReal.

      theorem ConvexAnalysis.mem_subdifferential_const_mul_iff {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {v x : H} {c : ℝ} (hc : 0 < c) :
      v ∈ subdifferential (fun (y : H) => ↑c * f y) x ↔ c⁻¹ • v ∈ subdifferential f x

      For c > 0, v is a subgradient of c * f iff c⁻¹ • v is a subgradient of f; the form used for proximal points of c * f.

      theorem ConvexAnalysis.subdifferential_const_mul {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {c : ℝ} (hc : 0 < c) (f : H → EReal) (x : H) :
      subdifferential (fun (y : H) => ↑c * f y) x = c • subdifferential f x

      Scaling: ∂(c f) x = c • ∂f x for c > 0 BC, Proposition 16.6 (there for proper f). The multiple is y ↦ (c : EReal) * f y, since EReal has no scalar multiplication by reals. The equality fails at c = 0: for f ≡ ⊤ the multiple is 0, with ∂0 x = {0}, while 0 • ∂f x = ∅.

      theorem ConvexAnalysis.smul_subset_subdifferential_const_mul {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {c : ℝ} (hc : 0 ≤ c) (f : H → EReal) (x : H) :
      c • subdifferential f x ⊆ subdifferential (fun (y : H) => ↑c * f y) x

      The inclusion c • ∂f x ⊆ ∂(c f) x holds for c ≥ 0, as needed for Lagrange multipliers λᵢ ≥ 0.

      theorem ConvexAnalysis.convex_setOf_forall_coe_add_inner_le {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (c : ℝ) (b : H → EReal) (x : H) :
      Convex ℝ {u : H | ∀ (y : H), ↑(c + inner ℝ (y - x) u) ≤ b y}

      The set of u with c + ⟪y - x, u⟫ ≤ b y for every y (c : ℝ, b : H → EReal) is convex: it is an intersection of half-spaces. Subdifferentials and ε-subdifferentials are such sets.

      theorem ConvexAnalysis.isClosed_setOf_forall_coe_add_inner_le {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (c : ℝ) (b : H → EReal) (x : H) :
      IsClosed {u : H | ∀ (y : H), ↑(c + inner ℝ (y - x) u) ≤ b y}

      The set of u with c + ⟪y - x, u⟫ ≤ b y for every y (c : ℝ, b : H → EReal) is closed: it is an intersection of closed half-spaces.

      theorem ConvexAnalysis.subdifferential_eq_setOf_of_eq_coe {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {x : H} {r : ℝ} (hr : f x = ↑r) :
      subdifferential f x = {u : H | ∀ (y : H), ↑(r + inner ℝ (y - x) u) ≤ f y}

      Where f x = r, the subdifferential is the set of u with r + ⟪y - x, u⟫ ≤ f y for all y.

      The subdifferential is convex.

      The subdifferential is closed.

      theorem ConvexAnalysis.inner_sub_sub_nonneg_of_mem_subdifferential {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f : H → EReal} {u v x y : H} (hu : u ∈ subdifferential f x) (hv : v ∈ subdifferential f y) :
      0 ≤ inner ℝ (x - y) (u - v)

      The subdifferential is a monotone operator BC, Example 20.3: ⟪x - y, u - v⟫ ≥ 0 for u ∈ ∂f x and v ∈ ∂f y.

      theorem ConvexAnalysis.HasSubgradientAt.add {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f g : H → EReal} {u v x : H} (hf : HasSubgradientAt f u x) (hg : HasSubgradientAt g v x) :
      HasSubgradientAt (f + g) (u + v) x

      The sum of subgradients is a subgradient of the sum. The converse needs a constraint qualification; see ConvexAnalysis.subdifferential_add.

      The easy inclusion of the sum rule, for any f and g: ∂f x + ∂g x ⊆ ∂(f + g) x.

      theorem ConvexAnalysis.isMinOn_add_of_zero_mem_subdifferential_add {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {f g : H → EReal} {x : H} (h : 0 ∈ subdifferential f x + subdifferential g x) :
      IsMinOn (fun (w : H) => f w + g w) Set.univ x

      If 0 ∈ ∂f x + ∂g x, then x minimizes f + g, for any f and g (the easy inclusion ConvexAnalysis.subset_subdifferential_add and Fermat's rule).

      The normal cone of C at x: empty if x ∉ C, and otherwise the vectors u with ⟪y - x, u⟫ ≤ 0 for all y ∈ C BC, Definition 6.38 (there for convex C).

      Equations
      Instances For
        @[simp]
        theorem ConvexAnalysis.mem_normalCone {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {u x : H} {C : Set H} :
        u ∈ normalCone C x ↔ x ∈ C ∧ ∀ y ∈ C, inner ℝ (y - x) u ≤ 0

        Membership in the normal cone: x ∈ C and ⟪y - x, u⟫ ≤ 0 for all y ∈ C.

        theorem ConvexAnalysis.normalCone_of_notMem {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {x : H} {C : Set H} (hx : x ∉ C) :

        The normal cone at a point outside C is empty.

        theorem ConvexAnalysis.zero_mem_normalCone {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {x : H} {C : Set H} (hx : x ∈ C) :

        0 lies in the normal cone at every point of C.

        theorem ConvexAnalysis.smul_mem_normalCone {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {u x : H} {C : Set H} (hu : u ∈ normalCone C x) {c : ℝ} (hc : 0 ≤ c) :

        The normal cone is closed under multiplication by c ≥ 0.

        theorem ConvexAnalysis.add_mem_normalCone {H : Type u_1} [NormedAddCommGroup H] [InnerProductSpace ℝ H] {u v x : H} {C : Set H} (hu : u ∈ normalCone C x) (hv : v ∈ normalCone C x) :
        u + v ∈ normalCone C x

        The normal cone is closed under addition.

        The subdifferential of the indicator function is the normal cone BC, Example 16.13.

        Sufficiency of the optimality condition: if u ∈ ∂f x and -u ∈ N_C x, then x minimizes f on C. No convexity or continuity is needed.

        The normal cone is convex.

        The normal cone is closed.