Pratik Patil

CurvatureEstimate.lean

1module2public import SubentropyCertificates.QuadraticCurve3public import SubentropyCertificates.ClassicalStrict4public import Mathlib.Analysis.Convex.Deriv5import Mathlib.Algebra.Order.Chebyshev67/-! Directional curvature of the reciprocal determinant on the simplex.8The trace-zero constraint gives the dimension-dependent improvement. -/9@[expose] public section10noncomputable section11set_option autoImplicit false12open Set13open scoped BigOperators14namespace SubentropyCertificates.StrongConcavity15open SubentropyCertificates.ClassicalCurve16variable {D : Type*} [Fintype D]1718def energy (h : D → ℝ) := ∑ i, h i^219def fraction (d : ℕ) : ℝ := ((d:ℝ)-1)/d20def rate (d : ℕ) : ℝ := 1+2*fraction d21def mu (d : ℕ) : ℝ := d/(3*(d:ℝ)-2)22def laplace (t : ℝ) (p : D → ℝ) := Real.exp (-(∑ i, Real.log (1+t*p i)))2324theorem inv_rate {d : ℕ} (hd : 2 ≤ d) : (rate d)⁻¹ = mu d := by25  have h : 2 ≤ (d:ℝ) := by exact_mod_cast hd26  unfold rate fraction mu27  field_simp28  ring2930theorem rate_pos {d : ℕ} (hd : 2 ≤ d) : 0 < rate d := by31  have h : 2 ≤ (d:ℝ) := by exact_mod_cast hd32  have hpos : 0 ≤ fraction d := div_nonneg (by linarith) (by positivity)33  unfold rate; linarith3435theorem mu_ge_third {d : ℕ} (hd : 2 ≤ d) : 1/3 ≤ mu d := by36  have h : 2 ≤ (d:ℝ) := by exact_mod_cast hd37  apply (le_div_iff₀ (show 0 < 3*(d:ℝ)-2 by linarith)).mpr38  linarith3940theorem variance_coefficient_ge_sixth {d : ℕ} (hd : 2 ≤ d) : 1/6 ≤ mu d/2 := by41  linarith [mu_ge_third hd]4243/-- Converting a Jensen gap into a squared deviation in Proposition 12. -/44theorem inverse_variance_coefficient {d : ℕ} (hd : 2 ≤ d) :45    (mu d/2)⁻¹ = 6-4/(d:ℝ) := by46  have h : 2 ≤ (d:ℝ) := by exact_mod_cast hd47  have h₁ : (d:ℝ) ≠ 0 := by linarith48  have h₂ : 3*(d:ℝ)-2 ≠ 0 := by linarith49  unfold mu50  field_simp51  ring5253theorem coordinate_energy (hd : 2 ≤ Fintype.card D) {h : D → ℝ} (hh : ∑ i, h i=0) (i : D) :54    h i^2 ≤ fraction (Fintype.card D)*energy h := by55  classical56  let S := Finset.univ.erase i57  have hc : (S.card:ℝ) = (Fintype.card D:ℝ)-1 := by58    simp [S,Finset.card_erase_of_mem,Nat.cast_sub (show 1 ≤ Fintype.card D by omega)]59  have ht : ∑ j ∈ S, h j = -h i := by60    have he := Finset.sum_erase_add (s := Finset.univ) h (Finset.mem_univ i)61    linarith [hh]62  have he : ∑ j ∈ S, h j^2 = energy h - h i^2 := by63    have e := Finset.sum_erase_add (s := Finset.univ) (fun j => h j^2) (Finset.mem_univ i)64    unfold energy; linarith65  have hcauchy := sq_sum_le_card_mul_sum_sq (s := S) (f := h)66  rw [hc,ht,he] at hcauchy67  have hd' : 2 ≤ (Fintype.card D:ℝ) := by exact_mod_cast hd68  unfold fraction69  rw [div_mul_eq_mul_div]70  apply (le_div_iff₀ (show 0 < (Fintype.card D:ℝ) by linarith)).mpr71  nlinarith only [hcauchy]7273private theorem laplace_lower {t : ℝ} (ht : 0 ≤ t) {p : D → ℝ} (hp : p ∈ probabilitySimplex D) :74    Real.exp (-t) ≤ laplace t p := by75  apply Real.exp_le_exp.mpr76  have hi (i : D) : Real.log (1+t*p i) ≤ t*p i := by77    linarith [Real.log_le_sub_one_of_pos (show 0 < 1+t*p i by78      have := hp.1 i; positivity)]79  have h := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hi i)80  rw [← Finset.mul_sum,hp.2,mul_one] at h81  linarith8283private theorem coordinate_factor {x : ℝ} (hx : 0 ≤ x) :84    Real.exp (-(2*x)) ≤ 1/(1+x)^2 := by85  rw [show -(2*x) = -(x+x) by ring,Real.exp_neg,Real.exp_add,one_div]86  apply inv_anti₀ (by positivity)87  rw [← sq]88  exact pow_le_pow_left₀ (by positivity) (by linarith [Real.add_one_le_exp x]) 28990/-- A lower bound for the part of the second derivative containing the91sum of squares. The omitted square of the log derivative is nonnegative. -/92theorem laplace_curvature_lower (hd : 2 ≤ Fintype.card D) {t : ℝ} (ht : 0 ≤ t)93    {p h : D → ℝ} (hp : p ∈ probabilitySimplex D) (hh : ∑ i, h i=0) :94    t^2 * Real.exp (-(rate (Fintype.card D)*t)) * energy h ≤95      laplace t p * (∑ i, (t*h i/(1+t*p i))^2) := by96  let c := fraction (Fintype.card D)97  let a := energy h98  have hmean : ∑ i, p i*h i^2 ≤ c*a := by99    calc _ ≤ ∑ i, p i*(c*a) := Finset.sum_le_sum fun i _ =>100                mul_le_mul_of_nonneg_left (coordinate_energy hd hh i) (hp.1 i)101         _ = _ := by rw [← Finset.sum_mul,hp.2,one_mul]102  have htan (i : D) : Real.exp (-(2*t*c))*(1+2*t*(c-p i)) ≤ Real.exp (-(2*(t*p i))) := by103    rw [show -(2*(t*p i)) = -(2*t*c)+2*t*(c-p i) by ring,Real.exp_add]104    apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _)105    linarith [Real.add_one_le_exp (2*t*(c-p i))]106  have hi (i : D) : Real.exp (-(2*t*c))*(h i^2 + 2*t*(c*h i^2-p i*h i^2)) ≤107      h i^2/(1+t*p i)^2 := by108    have hx := (htan i).trans (coordinate_factor (mul_nonneg ht (hp.1 i)))109    calc _ = h i^2*(Real.exp (-(2*t*c))*(1+2*t*(c-p i))) := by ring110         _ ≤ _ := by simpa only [mul_one_div] using mul_le_mul_of_nonneg_left hx (sq_nonneg _)111  have hsum := Finset.sum_le_sum (s := Finset.univ) (fun i _ => hi i)112  simp only [← Finset.mul_sum,Finset.sum_add_distrib,Finset.sum_sub_distrib] at hsum113  have hw : Real.exp (-(2*t*c))*a ≤ ∑ i, h i^2/(1+t*p i)^2 := by114    apply le_trans _ hsum115    apply mul_le_mul_of_nonneg_left _ (Real.exp_nonneg _)116    change a ≤ a + 2*t*(c*a - ∑ i, p i*h i^2)117    exact le_add_of_nonneg_right (mul_nonneg (by positivity) (sub_nonneg.mpr hmean))118  have hscale : t^2*(Real.exp (-(2*t*c))*a) ≤ ∑ i, (t*h i/(1+t*p i))^2 := by119    calc _ ≤ t^2*(∑ i, h i^2/(1+t*p i)^2) := mul_le_mul_of_nonneg_left hw (sq_nonneg t)120         _ = _ := by121           rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro i _122           rw [div_pow,mul_pow,mul_div_assoc]123  have hprod := mul_le_mul (laplace_lower ht hp) hscale124    (show 0 ≤ t^2*(Real.exp (-(2*t*c))*a) by dsimp [a,energy]; positivity) (Real.exp_nonneg _)125  apply le_trans _ hprod126  rw [show -(rate (Fintype.card D)*t) = -t + -(2*t*c) by dsimp [rate,c]; ring,Real.exp_add]127  exact le_of_eq (by dsimp [a]; ring)128129end SubentropyCertificates.StrongConcavity

Axioms used

Choose a statement to see which axioms its proof uses.