Offline · exact source
Exact Lean source

YoungMultinomialLocalEntropy

formalization/Cloning/YoungMultinomialLocalEntropy.lean

Source hash: ca1657c542596c874bbe04e6738027dd2a4b119622795b83e55de5a46c83426a

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Mathlib.Analysis.SpecialFunctions.Log.Deriv
2import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
3 
4/-!
5# Uniform entropy remainder in multinomial central windows
6 
7The remainder is bounded explicitly from the power-series remainder for the
8logarithm. In particular, no central or local limit theorem is assumed.
9-/
10 
11noncomputable section
12open scoped BigOperators Topology
13open Filter
14namespace Cloning.YoungMultinomial
15 
16/-- The third-order remainder of the elementary entropy function. -/
17def entropyRemainder (u : ℝ) : ℝ :=
18  (1 + u) * Real.log (1 + u) - u - u ^ 2 / 2
19 
20/-- A numerical third-order bound valid throughout a fixed neighborhood. -/
21theorem abs_entropyRemainder_le {u : ℝ} (hu : |u| ≤ 1 / 2) :
22    |entropyRemainder u| ≤ 4 * |u| ^ 3 := by
23  have hu1 : |-u| < 1 := by rw [abs_neg]; linarith
24  have hlog := Real.abs_log_sub_add_sum_range_le hu1 2
25  norm_num [Finset.sum_range_succ] at hlog
26  have hlog' : |Real.log (1 + u) - u + u ^ 2 / 2| ≤ 2 * |u| ^ 3 := by
27    have hd : 0 < 1 - |u| := by linarith
28    have ht : |u| ^ 3 / (1 - |u|) ≤ 2 * |u| ^ 3 := by
29      rw [div_le_iff₀ hd]
30      nlinarith [pow_nonneg (abs_nonneg u) 3]
31    convert hlog.trans ht using 1 <;> congr 1 <;> ring
32  have hab : |1 + u| ≤ 3 / 2 := by
33    exact (abs_add_le 1 u).trans (by simpa using (show 1 + |u| ≤ 3 / 2 by linarith))
34  have hid : entropyRemainder u =
35      (1 + u) * (Real.log (1 + u) - u + u ^ 2 / 2) - u ^ 3 / 2 := by
36    unfold entropyRemainder
37    ring
38  rw [hid]
39  calc
40    _ ≤ |(1 + u) * (Real.log (1 + u) - u + u ^ 2 / 2)| + |u ^ 3 / 2| :=
41      abs_sub _ _
42    _ = |1 + u| * |Real.log (1 + u) - u + u ^ 2 / 2| + |u| ^ 3 / 2 := by
43      rw [abs_mul, abs_div, abs_pow]
44      norm_num
45    _ ≤ (3 / 2) * (2 * |u| ^ 3) + |u| ^ 3 / 2 := by gcongr
46    _ ≤ 4 * |u| ^ 3 := by nlinarith [pow_nonneg (abs_nonneg u) 3]
47 
48/-- Coordinate entropy after removing its linear and quadratic terms. -/
49def coordinateRemainder (p δ : ℝ) : ℝ :=
50  (p + δ) * Real.log ((p + δ) / p) - δ - δ ^ 2 / (2 * p)
51 
52theorem coordinateRemainder_eq {p : ℝ} (hp : p ≠ 0) (δ : ℝ) :
53    coordinateRemainder p δ = p * entropyRemainder (δ / p) := by
54  have h : (p + δ) / p = 1 + δ / p := by field_simp
55  rw [coordinateRemainder, entropyRemainder, h]
56  field_simp
57 
58/-- Explicit entropy remainder, uniform as the positive reference coordinate
59varies away from zero. -/
60theorem abs_coordinateRemainder_le {p δ : ℝ} (hp : 0 < p)
61    (hδ : |δ| ≤ p / 2) :
62    |coordinateRemainder p δ| ≤ 4 * |δ| ^ 3 / p ^ 2 := by
63  have hu : |δ / p| ≤ 1 / 2 := by
64    rw [abs_div, abs_of_pos hp, div_le_iff₀ hp]
65    linarith
66  rw [coordinateRemainder_eq hp.ne', abs_mul, abs_of_pos hp]
67  calc
68    _ ≤ p * (4 * |δ / p| ^ 3) := mul_le_mul_of_nonneg_left
69      (abs_entropyRemainder_le hu) hp.le
70    _ = _ := by rw [abs_div, abs_of_pos hp]; field_simp
71 
72/-- The scaled multinomial entropy exponent differs from its Gaussian
73quadratic exponent by an explicit `N⁻¹ᐟ²` bound. -/
74theorem central_entropy_bound {ι : Type*} [Fintype ι]
75    (p x : ι → ℝ) (n a R : ℝ) (hn : 0 < n) (ha : 0 < a) (hR : 0 ≤ R)
76    (hp : ∀ i, a ≤ p i) (hx : ∀ i, |x i| ≤ R)
77    (hsmall : R / Real.sqrt n ≤ a / 2) (hzero : ∑ i, x i = 0) :
78    |n * (∑ i, (p i + x i / Real.sqrt n) *
79        Real.log ((p i + x i / Real.sqrt n) / p i)) -
80      (∑ i, (x i) ^ 2 / (2 * p i))| ≤
81      4 * Fintype.card ι * R ^ 3 / (a ^ 2 * Real.sqrt n) := by
82  have hs : 0 < Real.sqrt n := Real.sqrt_pos.mpr hn
83  have hs2 : Real.sqrt n ^ 2 = n := Real.sq_sqrt hn.le
84  have hp0 i : 0 < p i := ha.trans_le (hp i)
85  have hb i : |x i / Real.sqrt n| ≤ p i / 2 := by
86    rw [abs_div, abs_of_pos hs]
87    exact (div_le_div_of_nonneg_right (hx i) hs.le).trans
88      (hsmall.trans (div_le_div_of_nonneg_right (hp i) (by norm_num)))
89  have hquad : n * (∑ i, (x i / Real.sqrt n) ^ 2 / (2 * p i)) =
90      ∑ i, (x i) ^ 2 / (2 * p i) := by
91    rw [Finset.mul_sum]
92    apply Finset.sum_congr rfl
93    intro i _
94    rw [div_pow, hs2]
95    field_simp
96  have heq : n * (∑ i, (p i + x i / Real.sqrt n) *
97        Real.log ((p i + x i / Real.sqrt n) / p i)) -
98      (∑ i, (x i) ^ 2 / (2 * p i)) =
99      n * ∑ i, coordinateRemainder (p i) (x i / Real.sqrt n) := by
100    simp only [coordinateRemainder, Finset.sum_sub_distrib, div_eq_mul_inv, ← Finset.sum_mul, hzero,
101      zero_mul, sub_zero, mul_sub]
102    simpa only [div_eq_mul_inv] using congrArg
103      (fun z ↦ n * (∑ i, (p i + x i / Real.sqrt n) *
104        Real.log ((p i + x i / Real.sqrt n) / p i)) - z) hquad.symm
105  rw [heq, abs_mul, abs_of_pos hn]
106  calc
107    _ ≤ n * ∑ i, |coordinateRemainder (p i) (x i / Real.sqrt n)| := by
108      gcongr
109      exact Finset.abs_sum_le_sum_abs _ _
110    _ ≤ n * ∑ _i : ι, 4 * R ^ 3 / (a ^ 2 * Real.sqrt n ^ 3) := by
111      gcongr with i
112      refine (abs_coordinateRemainder_le (hp0 i) (hb i)).trans ?_
113      rw [abs_div, abs_of_pos hs, div_pow]
114      calc
115        4 * (|x i| ^ 3 / Real.sqrt n ^ 3) / p i ^ 2 ≤
116            4 * (R ^ 3 / Real.sqrt n ^ 3) / a ^ 2 := by gcongr; exact hx i; exact hp i
117        _ = _ := by ring
118    _ = _ := by
119      simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]
120      field_simp
121      rw [hs2]
122      ring
123 
124end Cloning.YoungMultinomial