subadditive_gen_variance_concaveOn
Inner 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 and any u, q ↦ E_p[g(q/p)(u - E_q u)²] is concave on the open probability simplex.
Statement
theorem subadditive_gen_variance_concaveOn {X : Type*} [Fintype X] (gw g1 g2 : ℝ → ℝ) (hd1 : ∀ a > 0, HasDerivAt gw (g1 a) a) (hd2 : ∀ a > 0, HasDerivAt g1 (g2 a) a) (hg2 : ∀ a > 0, g2 a < 0) (η ℓ : ℝ) (hb : ∀ a > 0, gw a + 2 * (g1 a - η) ^ 2 / (-g2 a) ≤ 2 * η + (a - 1) * ℓ) (pX u : X → ℝ) (hpX : ∀ x, 0 < pX x) (hsX : ∑ x, pX x = 1) : ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} (subadditive_gen_variance gw pX u)
- Source
- arXiv:2610.21231 (On the subadditivity of mutual f-information), Appendix B, proof of Lemma 4
- Verified
- 24 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 3
- 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…
- hasDerivAt_comp_affine_at_zeroIf g has derivative g' at c, then t ↦ g(c + t d) has derivative g' d at 0.
- Used by 1
- mutual_f_theta_concaveOn_of_weight_boundLemma 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…
The proof, explained
The proof establishes concavity of the generalized variance functional on the open probability simplex by showing that its second directional derivative D₂(s, k) along any tangent perturbation k (with ∑ k(x) = 0) is nonpositive. After computing the first and second directional derivatives using the calculus rules, each summand of D₂(s, k) is viewed as a quadratic in the perturbation components with negative leading coefficient g2 < 0. Completing the square and applying the assumed differential inequality bounds each summand by an affine expression whose sum over all simplex coordinates cancels out to zero.
Define candidate directional derivatives D₁ and D₂.
Enables classical logic and defines D₁(s, k) and D₂(s, k) as the explicit algebraic expressions for the first and second directional derivatives of the generalized variance functional along a perturbation direction k.
classical let D1 : (X → ℝ) → (X → ℝ) → ℝ := fun s k => ∑ x, pX x * (g1 (s x / pX x) * (k x / pX x) * (u x - ∑ x', s x' * u x') ^ 2 + gw (s x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x'))) let D2 : (X → ℝ) → (X → ℝ) → ℝ := fun s k => ∑ x, pX x * (g2 (s x / pX x) * (k x / pX x) * (k x / pX x) * (u x - ∑ x', s x' * u x') ^ 2 + g1 (s x / pX x) * (k x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x')) + (g1 (s x / pX x) * (k x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x')) + gw (s x / pX x) * (2 * -(∑ x', k x' * u x') * -(∑ x', k x' * u x'))))
The expectation of u and the density ratios vary affinely along any perturbation line s + t • k.
Expands the definitions of pointwise addition and scalar multiplication to show that the expectation ∑ (s + t • k) * u decomposes as ∑ s * u + t * ∑ k * u (hlin), and the density ratio (s + t • k)(x) / pX(x) decomposes as s(x) / pX(x) + t * (k(x) / pX(x)) (harg).
uses
Pi.add_apply,Pi.smul_apply,smul_eq_mul,add_mul,Finset.sum_add_distrib,Finset.mul_sum,mul_assochave hlin : ∀ (s k : X → ℝ) (t : ℝ), ∑ x', (s + t • k) x' * u x' = ∑ x', s x' * u x' + t * ∑ x', k x' * u x' := by intro s k t simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, add_mul, Finset.sum_add_distrib, Finset.mul_sum, mul_assoc] have harg : ∀ (s k : X → ℝ) (t : ℝ) (x : X), (s + t • k) x / pX x = s x / pX x + t * (k x / pX x) := by intro s k t x simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring
Concavity on the open simplex reduces to verifying the first two directional derivatives and showing D₂(s, k) ≤ 0 for tangent perturbations.
Applies `prob_simplex_concaveOn_of_hasDerivAt2`, which states that concavity on the open simplex follows if the restriction of the functional to lines s + t • k has first derivative D₁, second derivative D₂, and D₂(s, k) ≤ 0 for all directions k tangent to the simplex (satisfying ∑ k(x) = 0).
uses
prob_simplex_concaveOn_of_hasDerivAt2apply prob_simplex_concaveOn_of_hasDerivAt2 (subadditive_gen_variance gw pX u) D1 D2The first directional derivative of the generalized variance functional along k is D₁(s, k).
Rewrites the functional along s + t • k using the affine expansion lemmas. Each summand is differentiated at t = 0 by combining the sum rule (`HasDerivAt.fun_sum`), the chain rule for affine composition (`hasDerivAt_comp_affine_at_zero`), the identity derivative (`hasDerivAt_id'`), and standard product and power rules.
uses
div_pos,HasDerivAt.fun_sum,hasDerivAt_comp_affine_at_zero,hasDerivAt_id'· intro s hs _ k _ have hpos : ∀ x, 0 < s x / pX x := fun x => div_pos (hs x) (hpX x) have hfun : (fun t : ℝ => subadditive_gen_variance gw pX u (s + t • k)) = fun t : ℝ => ∑ x, pX x * gw (s x / pX x + t * (k x / pX x)) * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) ^ 2 := by funext t; simp only [subadditive_gen_variance, hlin, harg] rw [hfun] refine HasDerivAt.fun_sum (fun x _ => ?_) have hG := hasDerivAt_comp_affine_at_zero gw _ _ (k x / pX x) (hd1 _ (hpos x)) have hD : HasDerivAt (fun t : ℝ => u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) (-(∑ x', k x' * u x')) 0 := by simpa using (((hasDerivAt_id' (0:ℝ)).mul_const (∑ x', k x' * u x')).const_add (∑ x', s x' * u x')).const_sub (u x) have := ((hG.const_mul (pX x)).fun_mul (hD.fun_pow 2)) exact this.congr_deriv (by norm_num <;> ring)
The second directional derivative of the generalized variance functional along k is D₂(s, k).
Differentiates t ↦ D₁(s + t • k, k) at t = 0 term by term, applying the derivatives of gw and g1 (hypotheses hd1 and hd2) through affine composition and the product rule, matching D₂(s, k).
uses
div_pos,HasDerivAt.fun_sum,hasDerivAt_comp_affine_at_zero,hasDerivAt_id'· intro s hs _ k _ have hpos : ∀ x, 0 < s x / pX x := fun x => div_pos (hs x) (hpX x) have hfun : (fun t : ℝ => D1 (s + t • k) k) = fun t : ℝ => ∑ x, pX x * (g1 (s x / pX x + t * (k x / pX x)) * (k x / pX x) * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) ^ 2 + gw (s x / pX x + t * (k x / pX x)) * (2 * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) * -(∑ x', k x' * u x'))) := by funext t; simp only [D1, hlin, harg] rw [hfun] refine HasDerivAt.fun_sum (fun x _ => ?_) have hG := hasDerivAt_comp_affine_at_zero gw _ _ (k x / pX x) (hd1 _ (hpos x)) have hG1 := hasDerivAt_comp_affine_at_zero g1 _ _ (k x / pX x) (hd2 _ (hpos x)) have hD : HasDerivAt (fun t : ℝ => u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) (-(∑ x', k x' * u x')) 0 := by simpa using (((hasDerivAt_id' (0:ℝ)).mul_const (∑ x', k x' * u x')).const_add (∑ x', s x' * u x')).const_sub (u x) have := (((hG1.mul_const (k x / pX x)).fun_mul (hD.fun_pow 2)).add (hG.fun_mul ((hD.const_mul 2).mul_const (-(∑ x', k x' * u x'))))).const_mul (pX x) exact this.congr_deriv (by norm_num <;> ring)
Each summand of D₂(s, k) is bounded by an affine expression in pX, s, and k.
For each x, let a = s(x) / pX(x), b = k(x) / pX(x), d = u(x) - m, and κ = ∑ k(x') * u(x'). The summand divided by pX(x) is quadratic in b * d with negative leading coefficient g2(a) < 0. Completing the square bounds this quadratic by 4 * κ² * (g1(a) - η)² / (-g2(a)) minus a linear shift in η. Applying the assumed differential inequality hb and multiplying by pX(x) > 0 yields the pointwise upper bound 4 * η * κ² * pX(x) + 2 * κ² * ℓ * s(x) - 2 * κ² * ℓ * pX(x) - 4 * η * κ * (k(x) * u(x)) + 4 * η * κ * m * k(x).
uses
div_pos,div_nonneg,sq_nonneg,mul_le_mul_of_nonneg_left· intro s hs hs1 k hk set m := ∑ x', s x' * u x' with hm set κ := ∑ x', k x' * u x' with hκ have hterm : ∀ x, pX x * (g2 (s x / pX x) * (k x / pX x) * (k x / pX x) * (u x - m) ^ 2 + g1 (s x / pX x) * (k x / pX x) * (2 * (u x - m) * -κ) + (g1 (s x / pX x) * (k x / pX x) * (2 * (u x - m) * -κ) + gw (s x / pX x) * (2 * -κ * -κ))) ≤ 4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * s x - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * (k x * u x) + 4 * η * κ * m * k x := by intro x have hp := hpX x have ha : 0 < s x / pX x := div_pos (hs x) hp set a := s x / pX x with hadef set b := k x / pX x with hbdef set d := u x - m with hd set Gv2 := g2 a set Gv1 := g1 a set Gv := gw a have hG2 : Gv2 < 0 := hg2 a ha have hq : 0 ≤ 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) - ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * (Gv1 - η)) := by have : 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) - ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * (Gv1 - η)) = ((b * d) * Gv2 - 2 * κ * (Gv1 - η)) ^ 2 / (-Gv2) := by have h1 : Gv2 ≠ 0 := hG2.ne have h2 : -Gv2 ≠ 0 := by linarith field_simp; ring rw [this]; exact div_nonneg (sq_nonneg _) (by linarith) have hbb := hb a ha have hR : 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) = 2 * κ ^ 2 * (2 * (Gv1 - η) ^ 2 / (-Gv2)) := by ring have hT : (b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * Gv1 + 2 * κ ^ 2 * Gv ≤ 2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) - 4 * (b * d) * κ * η := by have h2 : 2 * κ ^ 2 * (Gv + 2 * (Gv1 - η) ^ 2 / (-Gv2)) ≤ 2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) := mul_le_mul_of_nonneg_left hbb (by positivity) nlinarith [hq, hR, h2] have hpb : pX x * b = k x := by rw [hbdef]; field_simp have hpa : pX x * a = s x := by rw [hadef]; field_simp have := mul_le_mul_of_nonneg_left hT hp.le have e1 : pX x * (Gv2 * b * b * d ^ 2 + Gv1 * b * (2 * d * -κ) + (Gv1 * b * (2 * d * -κ) + Gv * (2 * -κ * -κ))) = pX x * ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * Gv1 + 2 * κ ^ 2 * Gv) := by ring have e2 : pX x * (2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) - 4 * (b * d) * κ * η) = 4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * (pX x * a) - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * ((pX x * b) * d) := by ring rw [e1] rw [e2, hpb, hpa] at this rw [hd] at this linarith
Summing the pointwise bounds over x shows D₂(s, k) ≤ 0.
Summing the pointwise upper bounds over x using `Finset.sum_le_sum` and distributing the sum, the terms involve ∑ pX(x) = 1, ∑ s(x) = 1, ∑ k(x) * u(x) = κ, and ∑ k(x) = 0. These evaluations reduce the total sum to 4 * η * κ² + 2 * κ² * ℓ - 2 * κ² * ℓ - 4 * η * κ² + 0 = 0, proving D₂(s, k) ≤ 0.
uses
Finset.sum_le_sum,Finset.sum_add_distrib,Finset.sum_sub_distrib,Finset.mul_sumcalc D2 s k ≤ ∑ x, (4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * s x - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * (k x * u x) + 4 * η * κ * m * k x) := Finset.sum_le_sum (fun x _ => hterm x) _ = 4 * η * κ ^ 2 * ∑ x, pX x + 2 * κ ^ 2 * ℓ * ∑ x, s x - 2 * κ ^ 2 * ℓ * ∑ x, pX x - 4 * η * κ * κ + 4 * η * κ * m * ∑ x, k x := by simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, hκ] _ = 0 := by rw [hsX, hs1, hk]; ring
add_mul- Right distributivity of multiplication over addition: (a + b) * c = a * c + b * c
div_pos- The quotient of two strictly positive real numbers is strictly positive
div_nonneg- The quotient of two non-negative real numbers is non-negative
Finset.sum_add_distrib- Finite summation distributes over addition: ∑ (f + g) = ∑ f + ∑ g
Finset.sum_sub_distrib- Finite summation distributes over subtraction: ∑ (f - g) = ∑ f - ∑ g
Finset.mul_sum- Constants factor out of finite sums: a * ∑ f = ∑ (a * f)
Finset.sum_le_sum- If f(x) ≤ g(x) for all elements in a finite set, then ∑ f(x) ≤ ∑ g(x)
HasDerivAt.fun_sum- The derivative of a finite sum of differentiable functions is the sum of their derivatives
hasDerivAt_comp_affine_at_zero- If g has derivative g'(c) at c, then t ↦ g(c + t * d) has derivative g'(c) * d at t = 0
hasDerivAt_id'- The identity function has derivative 1 everywhere
mul_assoc- Multiplication is associative: (a * b) * c = a * (b * c)
mul_le_mul_of_nonneg_left- Multiplying an inequality by a non-negative factor preserves the inequality
Pi.add_apply- Pointwise addition of functions: (f + g)(x) = f(x) + g(x)
Pi.smul_apply- Pointwise scalar multiplication of functions: (a • f)(x) = a • f(x)
prob_simplex_concaveOn_of_hasDerivAt2- A functional on the open probability simplex is concave if its directional second derivative along any tangent direction (summing to zero) exists and is nonpositive
smul_eq_mul- Scalar multiplication of real numbers agrees with standard multiplication: a • b = a * b
sq_nonneg- The square of any real number is non-negative: a^2 ≥ 0
- Linear and nonlinear real arithmetic automation (`linarith`, `nlinarith`, `ring`, `field_simp`) handles the algebraic manipulations of completing the square and the cancellation of the sum.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem subadditive_gen_variance_concaveOn {X : Type*} [Fintype X] (gw g1 g2 : ℝ → ℝ) (hd1 : ∀ a > 0, HasDerivAt gw (g1 a) a) (hd2 : ∀ a > 0, HasDerivAt g1 (g2 a) a) (hg2 : ∀ a > 0, g2 a < 0) (η ℓ : ℝ) (hb : ∀ a > 0, gw a + 2 * (g1 a - η) ^ 2 / (-g2 a) ≤ 2 * η + (a - 1) * ℓ) (pX u : X → ℝ) (hpX : ∀ x, 0 < pX x) (hsX : ∑ x, pX x = 1) : ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} (subadditive_gen_variance gw pX u) := by classical let D1 : (X → ℝ) → (X → ℝ) → ℝ := fun s k => ∑ x, pX x * (g1 (s x / pX x) * (k x / pX x) * (u x - ∑ x', s x' * u x') ^ 2 + gw (s x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x'))) let D2 : (X → ℝ) → (X → ℝ) → ℝ := fun s k => ∑ x, pX x * (g2 (s x / pX x) * (k x / pX x) * (k x / pX x) * (u x - ∑ x', s x' * u x') ^ 2 + g1 (s x / pX x) * (k x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x')) + (g1 (s x / pX x) * (k x / pX x) * (2 * (u x - ∑ x', s x' * u x') * -(∑ x', k x' * u x')) + gw (s x / pX x) * (2 * -(∑ x', k x' * u x') * -(∑ x', k x' * u x')))) have hlin : ∀ (s k : X → ℝ) (t : ℝ), ∑ x', (s + t • k) x' * u x' = ∑ x', s x' * u x' + t * ∑ x', k x' * u x' := by intro s k t simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul, add_mul, Finset.sum_add_distrib, Finset.mul_sum, mul_assoc] have harg : ∀ (s k : X → ℝ) (t : ℝ) (x : X), (s + t • k) x / pX x = s x / pX x + t * (k x / pX x) := by intro s k t x simp only [Pi.add_apply, Pi.smul_apply, smul_eq_mul]; ring apply prob_simplex_concaveOn_of_hasDerivAt2 (subadditive_gen_variance gw pX u) D1 D2 · intro s hs _ k _ have hpos : ∀ x, 0 < s x / pX x := fun x => div_pos (hs x) (hpX x) have hfun : (fun t : ℝ => subadditive_gen_variance gw pX u (s + t • k)) = fun t : ℝ => ∑ x, pX x * gw (s x / pX x + t * (k x / pX x)) * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) ^ 2 := by funext t; simp only [subadditive_gen_variance, hlin, harg] rw [hfun] refine HasDerivAt.fun_sum (fun x _ => ?_) have hG := hasDerivAt_comp_affine_at_zero gw _ _ (k x / pX x) (hd1 _ (hpos x)) have hD : HasDerivAt (fun t : ℝ => u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) (-(∑ x', k x' * u x')) 0 := by simpa using (((hasDerivAt_id' (0:ℝ)).mul_const (∑ x', k x' * u x')).const_add (∑ x', s x' * u x')).const_sub (u x) have := ((hG.const_mul (pX x)).fun_mul (hD.fun_pow 2)) exact this.congr_deriv (by norm_num <;> ring) · intro s hs _ k _ have hpos : ∀ x, 0 < s x / pX x := fun x => div_pos (hs x) (hpX x) have hfun : (fun t : ℝ => D1 (s + t • k) k) = fun t : ℝ => ∑ x, pX x * (g1 (s x / pX x + t * (k x / pX x)) * (k x / pX x) * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) ^ 2 + gw (s x / pX x + t * (k x / pX x)) * (2 * (u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) * -(∑ x', k x' * u x'))) := by funext t; simp only [D1, hlin, harg] rw [hfun] refine HasDerivAt.fun_sum (fun x _ => ?_) have hG := hasDerivAt_comp_affine_at_zero gw _ _ (k x / pX x) (hd1 _ (hpos x)) have hG1 := hasDerivAt_comp_affine_at_zero g1 _ _ (k x / pX x) (hd2 _ (hpos x)) have hD : HasDerivAt (fun t : ℝ => u x - (∑ x', s x' * u x' + t * ∑ x', k x' * u x')) (-(∑ x', k x' * u x')) 0 := by simpa using (((hasDerivAt_id' (0:ℝ)).mul_const (∑ x', k x' * u x')).const_add (∑ x', s x' * u x')).const_sub (u x) have := (((hG1.mul_const (k x / pX x)).fun_mul (hD.fun_pow 2)).add (hG.fun_mul ((hD.const_mul 2).mul_const (-(∑ x', k x' * u x'))))).const_mul (pX x) exact this.congr_deriv (by norm_num <;> ring) · intro s hs hs1 k hk set m := ∑ x', s x' * u x' with hm set κ := ∑ x', k x' * u x' with hκ have hterm : ∀ x, pX x * (g2 (s x / pX x) * (k x / pX x) * (k x / pX x) * (u x - m) ^ 2 + g1 (s x / pX x) * (k x / pX x) * (2 * (u x - m) * -κ) + (g1 (s x / pX x) * (k x / pX x) * (2 * (u x - m) * -κ) + gw (s x / pX x) * (2 * -κ * -κ))) ≤ 4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * s x - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * (k x * u x) + 4 * η * κ * m * k x := by intro x have hp := hpX x have ha : 0 < s x / pX x := div_pos (hs x) hp set a := s x / pX x with hadef set b := k x / pX x with hbdef set d := u x - m with hd set Gv2 := g2 a set Gv1 := g1 a set Gv := gw a have hG2 : Gv2 < 0 := hg2 a ha have hq : 0 ≤ 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) - ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * (Gv1 - η)) := by have : 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) - ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * (Gv1 - η)) = ((b * d) * Gv2 - 2 * κ * (Gv1 - η)) ^ 2 / (-Gv2) := by have h1 : Gv2 ≠ 0 := hG2.ne have h2 : -Gv2 ≠ 0 := by linarith field_simp; ring rw [this]; exact div_nonneg (sq_nonneg _) (by linarith) have hbb := hb a ha have hR : 4 * κ ^ 2 * (Gv1 - η) ^ 2 / (-Gv2) = 2 * κ ^ 2 * (2 * (Gv1 - η) ^ 2 / (-Gv2)) := by ring have hT : (b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * Gv1 + 2 * κ ^ 2 * Gv ≤ 2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) - 4 * (b * d) * κ * η := by have h2 : 2 * κ ^ 2 * (Gv + 2 * (Gv1 - η) ^ 2 / (-Gv2)) ≤ 2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) := mul_le_mul_of_nonneg_left hbb (by positivity) nlinarith [hq, hR, h2] have hpb : pX x * b = k x := by rw [hbdef]; field_simp have hpa : pX x * a = s x := by rw [hadef]; field_simp have := mul_le_mul_of_nonneg_left hT hp.le have e1 : pX x * (Gv2 * b * b * d ^ 2 + Gv1 * b * (2 * d * -κ) + (Gv1 * b * (2 * d * -κ) + Gv * (2 * -κ * -κ))) = pX x * ((b * d) ^ 2 * Gv2 - 4 * (b * d) * κ * Gv1 + 2 * κ ^ 2 * Gv) := by ring have e2 : pX x * (2 * κ ^ 2 * (2 * η + (a - 1) * ℓ) - 4 * (b * d) * κ * η) = 4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * (pX x * a) - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * ((pX x * b) * d) := by ring rw [e1] rw [e2, hpb, hpa] at this rw [hd] at this linarith calc D2 s k ≤ ∑ x, (4 * η * κ ^ 2 * pX x + 2 * κ ^ 2 * ℓ * s x - 2 * κ ^ 2 * ℓ * pX x - 4 * η * κ * (k x * u x) + 4 * η * κ * m * k x) := Finset.sum_le_sum (fun x _ => hterm x) _ = 4 * η * κ ^ 2 * ∑ x, pX x + 2 * κ ^ 2 * ℓ * ∑ x, s x - 2 * κ ^ 2 * ℓ * ∑ x, pX x - 4 * η * κ * κ + 4 * η * κ * m * ∑ x, k x := by simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, hκ] _ = 0 := by rw [hsX, hs1, hk]; ring