AFTD Auto-Formalizing Theoretical Domains

mutual_f_theta_concaveOn_of_weight_bound

theoremverified

Lemma 4 of arXiv:2610.21231: under the assumptions of Theorem 1 (g = x² f'' with g'' < 0 and g + 2(g' - η)²/(-g'') ≤ 2η + (x-1)ℓ), for full-support p_X and p_{Y|X}, r_X ↦ Θ_{p_X,p_{Y|X}}(r_X) is concave on the open probability simplex.

Statement

theorem mutual_f_theta_concaveOn_of_weight_bound {X Y : Type*} [Fintype X] [Fintype Y]
    (f : ℝ → ℝ) (hf1 : f 1 = 0) (hconv : ConvexOn ℝ (Set.Ioi 0) f)
    (hsmooth : ContDiffOn ℝ 4 f (Set.Ioi 0))
    (hg2 : ∀ x > 0, deriv (deriv (subadditive_f_weight f)) x < 0)
    (hbound : ∃ η ℓ : ℝ, 0 < η ∧ ∀ x > 0,
      subadditive_f_weight f x + 2 * (deriv (subadditive_f_weight f) x - η) ^ 2 /
        (-deriv (deriv (subadditive_f_weight f)) x) ≤ 2 * η + (x - 1) * ℓ)
    (pX : X → ℝ) (PY : X → Y → ℝ) (hpX : ∀ x, 0 < pX x) (hsX : ∑ x, pX x = 1)
    (hPY : ∀ x y, 0 < PY x y) (hsY : ∀ x, ∑ y, PY x y = 1) :
    ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} (mutual_f_theta f pX PY)
Source
arXiv:2610.21231 (On the subadditivity of mutual f-information), Appendix B, Lemma 4
Verified
24 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 9
  • mutual_f_thetaThe function Θ_{p_X,p_{Y|X}}(r_X) of eq. (14)/(19) of arXiv:2610.21231: Σ_y r_Y(y) D_f(r_{X|y} ‖ p_X) - D_f(r_X ‖ p_X), with r_{YX} = r_X…
  • subadditive_f_weightThe weight g(x) = x² f''(x) attached to a generator f in Theorem 1 of arXiv:2610.21231 (f'' is the iterated derivative deriv (deriv f)).
  • subadditive_gen_varianceThe generalized variance functional L_{u,p}(q) = E_p[g(q/p) (u - E_q u)²] of eq. (22) of arXiv:2610.21231.
  • prob_simplex_concaveOn_of_hasDerivAt2A function on the open probability simplex {r : ∀x, 0 < r x, Σ r = 1} is concave if, at every point r of it and in every direction v with…
  • perspective_affine_hasDerivAt_zeroFor Q0 > 0, the perspective t ↦ (Q0 + t Q1) f((C0 + t C1)/(Q0 + t Q1)) has derivative Q1 f(C0/Q0) + (C1 Q0 - C0 Q1) f'(C0/Q0)/Q0 at 0.
  • hasDerivAt_comp_affine_at_zeroIf g has derivative g' at c, then t ↦ g(c + t d) has derivative g' d at 0.
  • perspective_affine_deriv_hasDerivAt_zeroFor Q0 > 0, the first derivative of the affine perspective along t has derivative (C1 Q0 - C0 Q1)² f''(C0/Q0)/Q0³ at 0: the perspective's…
  • subadditive_gen_variance_concaveOnInner step of Lemma 4 of arXiv:2610.21231: if g'' < 0 on (0, ∞) and g + 2(g' - η)²/(-g'') ≤ 2η + (x - 1)ℓ there, then for full-support p_X…
  • subadditive_f_weight_hasDerivAt_factsIf f is C⁴ on (0, ∞), then at every x > 0, f, f', g = x² f'' and g' have derivatives f', f'', g', g'' at x.
Used by 1

The proof, explained

The proof establishes concavity of r ↦ Θ(r) on the open probability simplex via the second directional derivative criterion along zero-sum tangent vectors v. By explicit differentiation of the perspective and affine components of Θ, the second directional derivative D₂(r, v) is shown to equal ∑ᵧ Q(y) V(ry) - V(r), where ry is the posterior distribution given output y, Q is the output marginal distribution, and V is a generalized variance functional. Under the given subadditivity differential inequality on the weight function g = x² f'', V is concave on the simplex, so Jensen's inequality implies ∑ᵧ Q(y) V(ry) ≤ V(∑ᵧ Q(y) ry) = V(r), ensuring D₂(r, v) ≤ 0.

  1. The generalized variance functional is concave on the probability simplex under the weight bound hypothesis.

    We unpack the parameters η, ℓ from the weight bound assumption hb, establish differentiability of f and gw(x) = x² f''(x) using subadditive_f_weight_hasDerivAt_facts, and apply subadditive_gen_variance_concaveOn to obtain that the generalized variance functional q ↦ subadditive_gen_variance gw pX u q is concave on the open probability simplex for any test vector u.

    lines 11–19

    uses subadditive_f_weight_hasDerivAt_facts, subadditive_gen_variance_concaveOn

      classical
      obtain ⟨η, ℓ, _, hb⟩ := hbound
      have hfacts := subadditive_f_weight_hasDerivAt_facts f hsmooth
      set f1 := deriv f
      set f2 := deriv (deriv f)
      set gw := subadditive_f_weight f
      have hgdef : ∀ a, gw a = a ^ 2 * f2 a := fun a => rfl
      have hcc := subadditive_gen_variance_concaveOn (X := X) gw (deriv gw) (deriv (deriv gw))
        (fun a ha => (hfacts a ha).2.2.1) (fun a ha => (hfacts a ha).2.2.2) hg2 η ℓ hb
  2. The directional derivative candidates D₁ and D₂ are defined, and the output marginal Q(y) is strictly positive on the simplex.

    We define D₁ and D₂ representing the first and second directional derivatives along perturbation v. We verify the linearity identity hlin for the perturbed marginal ∑ₓ' (r + t • v)(x') PY(x', y) = Q(y) + t W(y), and establish that Q(y) > 0 whenever r is in the open simplex because X is nonempty (hs : ∑ r = 1) and all terms in the sum are strictly positive.

    lines 20–42

    uses Finset.sum_add_distrib, Finset.mul_sum, not_nonempty_iff, Finset.sum_pos, mul_pos, Finset.mem_univ

      let D1 : (X → ℝ) → (X → ℝ) → ℝ := fun r v =>
        ∑ y, ∑ x, pX x * ((∑ x', v x' * PY x' y) * f (r x * PY x y / pX x / ∑ x', r x' * PY x' y) +
          (v x * PY x y / pX x * (∑ x', r x' * PY x' y) - r x * PY x y / pX x * (∑ x', v x' * PY x' y)) *
            f1 (r x * PY x y / pX x / ∑ x', r x' * PY x' y) / (∑ x', r x' * PY x' y)) -
        ∑ x, pX x * (f1 (r x / pX x) * (v x / pX x))
      let D2 : (X → ℝ) → (X → ℝ) → ℝ := fun r v =>
        ∑ y, ∑ x, pX x * ((v x * PY x y / pX x * (∑ x', r x' * PY x' y) -
            r x * PY x y / pX x * (∑ x', v x' * PY x' y)) ^ 2 *
            f2 (r x * PY x y / pX x / ∑ x', r x' * PY x' y) / (∑ x', r x' * PY x' y) ^ 3) -
        ∑ x, pX x * (f2 (r x / pX x) * (v x / pX x) * (v x / pX x))
      have hlin : ∀ (r v : X → ℝ) (t : ℝ) (y : Y),
          ∑ x', (r + t • v) x' * PY x' y = ∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y := by
        intro r v t y
        simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, add_mul, Finset.sum_add_distrib,
          Finset.mul_sum, mul_assoc]
      have hQpos : ∀ r : X → ℝ, (∀ x, 0 < r x) → ∑ x, r x = 1 → ∀ y, 0 < ∑ x', r x' * PY x' y := by
        intro r hr hs y
        have hX : Nonempty X := by
          by_contra h
          rw [not_nonempty_iff] at h
          simp at hs
        exact Finset.sum_pos (fun x _ => mul_pos (hr x) (hPY x y))
          ⟨Classical.arbitrary X, Finset.mem_univ _⟩
  3. Concavity of Θ on the open probability simplex reduces to verifying its first and second directional derivatives and showing D₂(r, v) ≤ 0 for zero-sum directions v.

    We invoke prob_simplex_concaveOn_of_hasDerivAt2, which reduces concavity on the open simplex to three obligations: checking that D₁(r, v) is the first directional derivative of Θ at r along v, that D₂(r, v) is the directional derivative of D₁(·, v) at r along v, and that D₂(r, v) ≤ 0 for all zero-sum perturbation directions v.

    line 43

    uses prob_simplex_concaveOn_of_hasDerivAt2

      apply prob_simplex_concaveOn_of_hasDerivAt2 (mutual_f_theta f pX PY) D1 D2
  4. The first directional derivative of t ↦ Θ(r + t • v) at t = 0 equals D₁(r, v).

    We expand the path t ↦ Θ(r + t • v) into perspective and affine terms using hlin and algebraic rearrangement. We then differentiate term-by-term using HasDerivAt.fun_sub, HasDerivAt.fun_sum, perspective_affine_hasDerivAt_zero for the perspective summands, and hasDerivAt_comp_affine_at_zero for the affine summands.

    lines 44–71

    uses Finset.sum_congr, HasDerivAt.fun_sub, HasDerivAt.fun_sum, div_pos, mul_pos, perspective_affine_hasDerivAt_zero, HasDerivAt.const_mul, hasDerivAt_comp_affine_at_zero

      · intro r hr hs v _
        have hfun : (fun t : ℝ => mutual_f_theta f pX PY (r + t • v)) = fun t : ℝ =>
            ∑ y, ∑ x, pX x * ((∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) *
              f ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /
                (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y))) -
            ∑ x, pX x * f (r x / pX x + t * (v x / pX x)) := by
          funext t
          simp only [mutual_f_theta, hlin]
          congr 1
          · refine Finset.sum_congr rfl (fun y _ => ?_)
            rw [Finset.mul_sum]
            refine Finset.sum_congr rfl (fun x _ => ?_)
            simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]
            rw [show (r x + t * v x) * PY x y / (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) /
                pX x = (r x * PY x y / pX x + t * (v x * PY x y / pX x)) /
                (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) by ring]
            ring
          · refine Finset.sum_congr rfl (fun x _ => ?_)
            simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]
            rw [show (r x + t * v x) / pX x = r x / pX x + t * (v x / pX x) by ring]
        rw [hfun]
        refine HasDerivAt.fun_sub (HasDerivAt.fun_sum (fun y _ => HasDerivAt.fun_sum (fun x _ => ?_)))
          (HasDerivAt.fun_sum (fun x _ => ?_))
        · have hu : 0 < r x * PY x y / pX x / ∑ x', r x' * PY x' y :=
            div_pos (div_pos (mul_pos (hr x) (hPY x y)) (hpX x)) (hQpos r hr hs y)
          exact (perspective_affine_hasDerivAt_zero f f1 _ (∑ x', v x' * PY x' y) _ (v x * PY x y / pX x) (hQpos r hr hs y) (hfacts _ hu).1).const_mul (pX x)
        · exact (hasDerivAt_comp_affine_at_zero f _ _ (v x / pX x)
            (hfacts _ (div_pos (hr x) (hpX x))).1).const_mul (pX x)
  5. The second directional derivative of t ↦ D₁(r + t • v, v) at t = 0 equals D₂(r, v).

    We express the map t ↦ D₁(r + t • v, v) algebraically and differentiate at t = 0. Using perspective_affine_deriv_hasDerivAt_zero for the first-derivative perspective terms and hasDerivAt_comp_affine_at_zero with HasDerivAt.mul_const for the affine terms, we find that the derivative matches D₂(r, v).

    lines 72–98

    uses HasDerivAt.fun_sub, HasDerivAt.fun_sum, div_pos, mul_pos, perspective_affine_deriv_hasDerivAt_zero, HasDerivAt.const_mul, hasDerivAt_comp_affine_at_zero, HasDerivAt.mul_const

      · intro r hr hs v _
        have hfun : (fun t : ℝ => D1 (r + t • v) v) = fun t : ℝ =>
            ∑ y, ∑ x, pX x * ((∑ x', v x' * PY x' y) *
              f ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /
                (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) +
              (v x * PY x y / pX x * (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) -
                (r x * PY x y / pX x + t * (v x * PY x y / pX x)) * (∑ x', v x' * PY x' y)) *
              f1 ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /
                (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) /
              (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) -
            ∑ x, pX x * (f1 (r x / pX x + t * (v x / pX x)) * (v x / pX x)) := by
          funext t
          have e1 : ∀ x y, (r + t • v) x * PY x y / pX x =
              r x * PY x y / pX x + t * (v x * PY x y / pX x) := by
            intro x y; simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring
          have e2 : ∀ x, (r + t • v) x / pX x = r x / pX x + t * (v x / pX x) := by
            intro x; simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring
          simp only [D1, hlin, e1, e2]
        rw [hfun]
        refine HasDerivAt.fun_sub (HasDerivAt.fun_sum (fun y _ => HasDerivAt.fun_sum (fun x _ => ?_)))
          (HasDerivAt.fun_sum (fun x _ => ?_))
        · have hu : 0 < r x * PY x y / pX x / ∑ x', r x' * PY x' y :=
            div_pos (div_pos (mul_pos (hr x) (hPY x y)) (hpX x)) (hQpos r hr hs y)
          exact (perspective_affine_deriv_hasDerivAt_zero f f1 f2 _ (∑ x', v x' * PY x' y) _ (v x * PY x y / pX x) (hQpos r hr hs y) (hfacts _ hu).1
            (hfacts _ hu).2.1).const_mul (pX x)
        · exact ((hasDerivAt_comp_affine_at_zero f1 _ _ (v x / pX x)
            (hfacts _ (div_pos (hr x) (hpX x))).2.1).mul_const (v x / pX x)).const_mul (pX x)
  6. The posterior distributions ry(·) lie in the simplex, average to r, and satisfy Jensen's inequality for the generalized variance functional.

    Let Q(y) = ∑ₓ' r(x') PY(x', y), W(y) = ∑ₓ' v(x') PY(x', y), and β(x) = v(x) / r(x). We define the posterior distributions ry(x) = r(x) PY(x, y) / Q(y), check that each ry is in the simplex, and observe that ∑ᵧ Q(y) = 1 and ∑ᵧ Q(y) ry = r. By concavity of the generalized variance functional V(q) = subadditive_gen_variance gw pX β q, Jensen's inequality (ConcaveOn.le_map_sum) gives ∑ᵧ Q(y) V(ry) ≤ V(r). We also compute the posterior expectation ∑ₓ' ry(x') β(x') = W(y) / Q(y) and the prior expectation ∑ₓ' r(x') β(x') = ∑ v = 0.

    lines 99–136

    uses div_pos, mul_pos, Finset.sum_div, div_self, Finset.sum_comm, mul_one, mul_div_cancel₀, ConcaveOn.le_map_sum, Finset.sum_congr

      · intro r hr hs v hv
        set Q : Y → ℝ := fun y => ∑ x', r x' * PY x' y with hQ
        set W : Y → ℝ := fun y => ∑ x', v x' * PY x' y with hW
        set β : X → ℝ := fun x => v x / r x with hβ
        set ry : Y → X → ℝ := fun y x => r x * PY x y / Q y with hry
        have hQp : ∀ y, 0 < Q y := hQpos r hr hs
        have hmem : ∀ y ∈ (Finset.univ : Finset Y),
            ry y ∈ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} := by
          intro y _
          refine ⟨fun x => div_pos (mul_pos (hr x) (hPY x y)) (hQp y), ?_⟩
          simp only [hry, ← Finset.sum_div]
          exact div_self (hQp y).ne'
        have hsQ : ∑ y, Q y = 1 := by
          simp only [hQ]; rw [Finset.sum_comm]
          simp only [← Finset.mul_sum, hsY, mul_one, hs]
        have hsum : ∑ y, Q y • ry y = r := by
          funext x
          simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, hry]
          have : ∀ y, Q y * (r x * PY x y / Q y) = r x * PY x y := fun y =>
            mul_div_cancel₀ _ (hQp y).ne'
          simp only [this, ← Finset.mul_sum, hsY, mul_one]
        have hj := (hcc pX β hpX hsX).le_map_sum (t := Finset.univ) (w := Q) (p := ry)
          (fun y _ => (hQp y).le) hsQ hmem
        rw [hsum] at hj
        simp only [smul_eq_mul] at hj
        have hmy : ∀ y, ∑ x', ry y x' * β x' = W y / Q y := by
          intro y
          simp only [hry, hβ, hW]
          rw [Finset.sum_div]
          refine Finset.sum_congr rfl (fun x _ => ?_)
          have := (hr x).ne'
          field_simp
        have hm0 : ∑ x', r x' * β x' = 0 := by
          simp only [hβ]
          rw [← hv]
          refine Finset.sum_congr rfl (fun x _ => ?_)
          have := (hr x).ne'
          field_simp
  7. The second directional derivative D₂(r, v) equals the nonpositive Jensen gap ∑ᵧ Q(y) V(ry) - V(r) ≤ 0.

    By expanding definitions and clearing denominators using the posterior and prior expectations of β, we establish the algebraic identity D₂(r, v) = ∑ᵧ Q(y) V(ry) - V(r). Since Jensen's inequality established that ∑ᵧ Q(y) V(ry) ≤ V(r), linear arithmetic immediately yields D₂(r, v) ≤ 0, closing the final goal.

    lines 137–157

    uses Finset.sum_congr, Finset.mul_sum

        have hD2 : D2 r v = ∑ y, Q y * subadditive_gen_variance gw pX β (ry y) - subadditive_gen_variance gw pX β r := by
          simp only [D2, subadditive_gen_variance, hmy, hm0]
          congr 1
          · refine Finset.sum_congr rfl (fun y _ => ?_)
            rw [Finset.mul_sum]
            refine Finset.sum_congr rfl (fun x _ => ?_)
            simp only [hry, hgdef, hQ, hW, hβ]
            have hp := (hpX x).ne'
            have hq : (∑ x', r x' * PY x' y) ≠ 0 := (hQpos r hr hs y).ne'
            have hrx := (hr x).ne'
            rw [show r x * PY x y / (∑ x', r x' * PY x' y) / pX x =
              r x * PY x y / pX x / (∑ x', r x' * PY x' y) by ring]
            field_simp
          · refine Finset.sum_congr rfl (fun x _ => ?_)
            simp only [hgdef, hβ]
            have hp := (hpX x).ne'
            have hrx := (hr x).ne'
            field_simp
            ring
        rw [hD2]
        linarith
ConcaveOn.le_map_sum
Jensen's inequality for concave functions: a concave function evaluated at a convex combination is bounded below by the convex combination of the function values.
Finset.sum_add_distrib
Distributivity of finite sums: summing a pointwise sum of two functions equals the sum of their individual sums.
Finset.sum_comm
Swapping the order of two finite summations preserves the sum.
Finset.sum_congr
Two finite sums are equal if their index sets and summands agree pointwise.
Finset.sum_div
Dividing a finite sum by a scalar equals summing each term divided by that scalar.
Finset.mul_sum
Multiplication by a constant distributes over a finite sum.
Finset.sum_pos
A finite sum of strictly positive numbers over a nonempty finite set is strictly positive.
Finset.mem_univ
Every element of a finite type belongs to the universal finset univ.
HasDerivAt.fun_sub
The derivative of the difference of two functions is the difference of their derivatives.
HasDerivAt.fun_sum
The derivative of a finite sum of differentiable functions is the sum of their derivatives.
HasDerivAt.const_mul
The derivative of a constant times a function is the constant times the derivative of the function.
HasDerivAt.mul_const
The derivative of a function multiplied by a constant scalar is the derivative multiplied by that scalar.
div_pos
The quotient of two strictly positive real numbers is strictly positive.
div_self
Any nonzero number divided by itself is 1.
hasDerivAt_comp_affine_at_zero
The derivative of the affine composition t ↦ g(c + t * d) at t = 0 is g'(c) * d.
mul_div_cancel₀
Multiplying a nonzero denominator by a fraction with that denominator cancels the denominator.
mul_one
Multiplying any number by 1 preserves the number.
mul_pos
The product of two strictly positive real numbers is strictly positive.
not_nonempty_iff
A type is not nonempty if and only if it is empty.
perspective_affine_hasDerivAt_zero
The derivative of the perspective-affine composite t ↦ (Q₀ + t Q₁) * f((C₀ + t C₁) / (Q₀ + t Q₁)) at t = 0 is Q₁ * f(C₀ / Q₀) + (C₁ Q₀ - C₀ Q₁) * f'(C₀ / Q₀) / Q₀.
perspective_affine_deriv_hasDerivAt_zero
The derivative of the first derivative of the perspective-affine composite at t = 0 is (C₁ Q₀ - C₀ Q₁)² * f''(C₀ / Q₀) / Q₀³.
prob_simplex_concaveOn_of_hasDerivAt2
A function on the open probability simplex is concave if its first and second directional derivatives exist along zero-sum perturbation directions, and the second directional derivative is everywhere nonpositive.
subadditive_f_weight_hasDerivAt_facts
For a C⁴ function f on (0, ∞), f, f', gw, and gw' are differentiable at every positive point, where gw(x) = x² f''(x).
subadditive_gen_variance_concaveOn
Under the subadditivity differential inequality for the weight function gw, the generalized variance functional q ↦ ∑ₓ pX(x) gw(q(x) / pX(x)) (u(x) - ∑ₓ' q(x') u(x'))² is concave on the open probability simplex for any vector u.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem mutual_f_theta_concaveOn_of_weight_bound {X Y : Type*} [Fintype X] [Fintype Y]    (f : ℝ → ℝ) (hf1 : f 1 = 0) (hconv : ConvexOn ℝ (Set.Ioi 0) f)    (hsmooth : ContDiffOn ℝ 4 f (Set.Ioi 0))    (hg2 : ∀ x > 0, deriv (deriv (subadditive_f_weight f)) x < 0)    (hbound : ∃ η ℓ : ℝ, 0 < η ∧ ∀ x > 0,      subadditive_f_weight f x + 2 * (deriv (subadditive_f_weight f) x - η) ^ 2 /        (-deriv (deriv (subadditive_f_weight f)) x) ≤ 2 * η + (x - 1) * ℓ)    (pX : X → ℝ) (PY : X → Y → ℝ) (hpX : ∀ x, 0 < pX x) (hsX : ∑ x, pX x = 1)    (hPY : ∀ x y, 0 < PY x y) (hsY : ∀ x, ∑ y, PY x y = 1) :    ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} (mutual_f_theta f pX PY) := by  classical  obtain ⟨η, ℓ, _, hb⟩ := hbound  have hfacts := subadditive_f_weight_hasDerivAt_facts f hsmooth  set f1 := deriv f  set f2 := deriv (deriv f)  set gw := subadditive_f_weight f  have hgdef : ∀ a, gw a = a ^ 2 * f2 a := fun a => rfl  have hcc := subadditive_gen_variance_concaveOn (X := X) gw (deriv gw) (deriv (deriv gw))    (fun a ha => (hfacts a ha).2.2.1) (fun a ha => (hfacts a ha).2.2.2) hg2 η ℓ hb  let D1 : (X → ℝ) → (X → ℝ) → ℝ := fun r v =>    ∑ y, ∑ x, pX x * ((∑ x', v x' * PY x' y) * f (r x * PY x y / pX x / ∑ x', r x' * PY x' y) +      (v x * PY x y / pX x * (∑ x', r x' * PY x' y) - r x * PY x y / pX x * (∑ x', v x' * PY x' y)) *        f1 (r x * PY x y / pX x / ∑ x', r x' * PY x' y) / (∑ x', r x' * PY x' y)) -    ∑ x, pX x * (f1 (r x / pX x) * (v x / pX x))  let D2 : (X → ℝ) → (X → ℝ) → ℝ := fun r v =>    ∑ y, ∑ x, pX x * ((v x * PY x y / pX x * (∑ x', r x' * PY x' y) -        r x * PY x y / pX x * (∑ x', v x' * PY x' y)) ^ 2 *        f2 (r x * PY x y / pX x / ∑ x', r x' * PY x' y) / (∑ x', r x' * PY x' y) ^ 3) -    ∑ x, pX x * (f2 (r x / pX x) * (v x / pX x) * (v x / pX x))  have hlin : ∀ (r v : X → ℝ) (t : ℝ) (y : Y),      ∑ x', (r + t • v) x' * PY x' y = ∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y := by    intro r v t y    simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, add_mul, Finset.sum_add_distrib,      Finset.mul_sum, mul_assoc]  have hQpos : ∀ r : X → ℝ, (∀ x, 0 < r x) → ∑ x, r x = 1 → ∀ y, 0 < ∑ x', r x' * PY x' y := by    intro r hr hs y    have hX : Nonempty X := by      by_contra h      rw [not_nonempty_iff] at h      simp at hs    exact Finset.sum_pos (fun x _ => mul_pos (hr x) (hPY x y))      ⟨Classical.arbitrary X, Finset.mem_univ _⟩  apply prob_simplex_concaveOn_of_hasDerivAt2 (mutual_f_theta f pX PY) D1 D2  · intro r hr hs v _    have hfun : (fun t : ℝ => mutual_f_theta f pX PY (r + t • v)) = fun t : ℝ =>        ∑ y, ∑ x, pX x * ((∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) *          f ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /            (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y))) -        ∑ x, pX x * f (r x / pX x + t * (v x / pX x)) := by      funext t      simp only [mutual_f_theta, hlin]      congr 1      · refine Finset.sum_congr rfl (fun y _ => ?_)        rw [Finset.mul_sum]        refine Finset.sum_congr rfl (fun x _ => ?_)        simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]        rw [show (r x + t * v x) * PY x y / (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) /            pX x = (r x * PY x y / pX x + t * (v x * PY x y / pX x)) /            (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) by ring]        ring      · refine Finset.sum_congr rfl (fun x _ => ?_)        simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]        rw [show (r x + t * v x) / pX x = r x / pX x + t * (v x / pX x) by ring]    rw [hfun]    refine HasDerivAt.fun_sub (HasDerivAt.fun_sum (fun y _ => HasDerivAt.fun_sum (fun x _ => ?_)))      (HasDerivAt.fun_sum (fun x _ => ?_))    · have hu : 0 < r x * PY x y / pX x / ∑ x', r x' * PY x' y :=        div_pos (div_pos (mul_pos (hr x) (hPY x y)) (hpX x)) (hQpos r hr hs y)      exact (perspective_affine_hasDerivAt_zero f f1 _ (∑ x', v x' * PY x' y) _ (v x * PY x y / pX x) (hQpos r hr hs y) (hfacts _ hu).1).const_mul (pX x)    · exact (hasDerivAt_comp_affine_at_zero f _ _ (v x / pX x)        (hfacts _ (div_pos (hr x) (hpX x))).1).const_mul (pX x)  · intro r hr hs v _    have hfun : (fun t : ℝ => D1 (r + t • v) v) = fun t : ℝ =>        ∑ y, ∑ x, pX x * ((∑ x', v x' * PY x' y) *          f ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /            (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) +          (v x * PY x y / pX x * (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y) -            (r x * PY x y / pX x + t * (v x * PY x y / pX x)) * (∑ x', v x' * PY x' y)) *          f1 ((r x * PY x y / pX x + t * (v x * PY x y / pX x)) /            (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) /          (∑ x', r x' * PY x' y + t * ∑ x', v x' * PY x' y)) -        ∑ x, pX x * (f1 (r x / pX x + t * (v x / pX x)) * (v x / pX x)) := by      funext t      have e1 : ∀ x y, (r + t • v) x * PY x y / pX x =          r x * PY x y / pX x + t * (v x * PY x y / pX x) := by        intro x y; simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring      have e2 : ∀ x, (r + t • v) x / pX x = r x / pX x + t * (v x / pX x) := by        intro x; simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring      simp only [D1, hlin, e1, e2]    rw [hfun]    refine HasDerivAt.fun_sub (HasDerivAt.fun_sum (fun y _ => HasDerivAt.fun_sum (fun x _ => ?_)))      (HasDerivAt.fun_sum (fun x _ => ?_))    · have hu : 0 < r x * PY x y / pX x / ∑ x', r x' * PY x' y :=        div_pos (div_pos (mul_pos (hr x) (hPY x y)) (hpX x)) (hQpos r hr hs y)      exact (perspective_affine_deriv_hasDerivAt_zero f f1 f2 _ (∑ x', v x' * PY x' y) _ (v x * PY x y / pX x) (hQpos r hr hs y) (hfacts _ hu).1        (hfacts _ hu).2.1).const_mul (pX x)    · exact ((hasDerivAt_comp_affine_at_zero f1 _ _ (v x / pX x)        (hfacts _ (div_pos (hr x) (hpX x))).2.1).mul_const (v x / pX x)).const_mul (pX x)  · intro r hr hs v hv    set Q : Y → ℝ := fun y => ∑ x', r x' * PY x' y with hQ    set W : Y → ℝ := fun y => ∑ x', v x' * PY x' y with hW    set β : X → ℝ := fun x => v x / r x with hβ    set ry : Y → X → ℝ := fun y x => r x * PY x y / Q y with hry    have hQp : ∀ y, 0 < Q y := hQpos r hr hs    have hmem : ∀ y ∈ (Finset.univ : Finset Y),        ry y ∈ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} := by      intro y _      refine ⟨fun x => div_pos (mul_pos (hr x) (hPY x y)) (hQp y), ?_⟩      simp only [hry, ← Finset.sum_div]      exact div_self (hQp y).ne'    have hsQ : ∑ y, Q y = 1 := by      simp only [hQ]; rw [Finset.sum_comm]      simp only [← Finset.mul_sum, hsY, mul_one, hs]    have hsum : ∑ y, Q y • ry y = r := by      funext x      simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, hry]      have : ∀ y, Q y * (r x * PY x y / Q y) = r x * PY x y := fun y =>        mul_div_cancel₀ _ (hQp y).ne'      simp only [this, ← Finset.mul_sum, hsY, mul_one]    have hj := (hcc pX β hpX hsX).le_map_sum (t := Finset.univ) (w := Q) (p := ry)      (fun y _ => (hQp y).le) hsQ hmem    rw [hsum] at hj    simp only [smul_eq_mul] at hj    have hmy : ∀ y, ∑ x', ry y x' * β x' = W y / Q y := by      intro y      simp only [hry, hβ, hW]      rw [Finset.sum_div]      refine Finset.sum_congr rfl (fun x _ => ?_)      have := (hr x).ne'      field_simp    have hm0 : ∑ x', r x' * β x' = 0 := by      simp only [hβ]      rw [← hv]      refine Finset.sum_congr rfl (fun x _ => ?_)      have := (hr x).ne'      field_simp    have hD2 : D2 r v = ∑ y, Q y * subadditive_gen_variance gw pX β (ry y) - subadditive_gen_variance gw pX β r := by      simp only [D2, subadditive_gen_variance, hmy, hm0]      congr 1      · refine Finset.sum_congr rfl (fun y _ => ?_)        rw [Finset.mul_sum]        refine Finset.sum_congr rfl (fun x _ => ?_)        simp only [hry, hgdef, hQ, hW, hβ]        have hp := (hpX x).ne'        have hq : (∑ x', r x' * PY x' y) ≠ 0 := (hQpos r hr hs y).ne'        have hrx := (hr x).ne'        rw [show r x * PY x y / (∑ x', r x' * PY x' y) / pX x =          r x * PY x y / pX x / (∑ x', r x' * PY x' y) by ring]        field_simp      · refine Finset.sum_congr rfl (fun x _ => ?_)        simp only [hgdef, hβ]        have hp := (hpX x).ne'        have hrx := (hr x).ne'        field_simp        ring    rw [hD2]    linarith
See it in the graphDiscuss this resultChallenge it