theorem
proved
weighted_log_average
show as:
view math explainer →
open explainer
Read the cached plain-language explainer.
open lean source
IndisputableMonolith.Foundation.VariationalDynamics on GitHub at line 137.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
formal source
134 rfl
135
136/-- Weighted average of the logs equals `log_charge / N`. -/
137private theorem weighted_log_average {N : ℕ} (hN : 0 < N) (c : Configuration N) :
138 (∑ i ∈ (Finset.univ : Finset (Fin N)), (1 / (N : ℝ)) * Real.log (c.entries i)) =
139 log_charge c / N := by
140 unfold log_charge
141 rw [← Finset.mul_sum]
142 ring
143
144/-- Weighted average of `Jlog(log x_i)` equals `total_defect / N`. -/
145private theorem weighted_Jlog_average {N : ℕ} (c : Configuration N) :
146 (∑ i ∈ (Finset.univ : Finset (Fin N)), (1 / (N : ℝ)) * Jlog (Real.log (c.entries i))) =
147 (1 / (N : ℝ)) * total_defect c := by
148 calc
149 (∑ i ∈ (Finset.univ : Finset (Fin N)), (1 / (N : ℝ)) * Jlog (Real.log (c.entries i)))
150 = ∑ i ∈ (Finset.univ : Finset (Fin N)), (1 / (N : ℝ)) * defect (c.entries i) := by
151 apply Finset.sum_congr rfl
152 intro i _
153 unfold Jlog defect J Jcost
154 rw [Real.exp_log (c.entries_pos i)]
155 _ = (1 / (N : ℝ)) * total_defect c := by
156 unfold total_defect
157 rw [← Finset.mul_sum]
158
159/-- Jensen lower bound: fixed log-charge implies a defect lower bound. -/
160private theorem total_defect_lower_bound {N : ℕ} (hN : 0 < N) (c : Configuration N) :
161 (N : ℝ) * Jlog (log_charge c / N) ≤ total_defect c := by
162 have hN_pos : (0 : ℝ) < N := Nat.cast_pos.mpr hN
163 have hw_nonneg : ∀ i ∈ (Finset.univ : Finset (Fin N)), 0 ≤ (1 / (N : ℝ)) := by
164 intro _ _
165 positivity
166 have hw_sum : ∑ i ∈ (Finset.univ : Finset (Fin N)), (1 / (N : ℝ)) = 1 := by
167 rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]