import OAI.Analysis.FreeEntropy.MatrixFlow namespace OAI universe u1 u2 noncomputable section open MeasureTheory Set namespace FiniteEntropySeparation variable {ι : Type u1} [Fintype ι] theorem smoothedSecond_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K : ℝ} (hs : 0 smoothedDensity μ s x*‖x‖^2) := by have hi := (smoothedPolynomial_integrable μ hs hK hμ 1).sub (smoothedDensity_integrable μ hs) convert hi using 1 funext x simp only [pow_one,Pi.sub_apply] ring theorem normalCross_integrable (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K : ℝ} (hs : 0 smoothedDensity μ s x*Real.log (normalKernel v x)) := by have he x : smoothedDensity μ s x*Real.log (normalKernel v x)= smoothedDensity μ s x*(-(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*v))- (smoothedDensity μ s x*‖x‖^2)/(2*v) := by rw [normalKernel,Real.log_exp]; ring simp only [he] exact ((smoothedDensity_integrable μ hs).mul_const _).sub ((smoothedSecond_integrable μ hs hK hμ).div_const _) theorem normalCross_integral (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K : ℝ} (hs : 0 ENNReal.ofReal (f x))) E).toReal=∫x in E,f x ∂ν := by rw [withDensity_apply _ hE,← ofReal_integral_eq_lintegral_ofReal hf.integrableOn (ae_of_all _ hf0), ENNReal.toReal_ofReal (integral_nonneg hf0)] theorem classicalEntropy_event_gaussian (μ : Measure (EuclideanSpace ℝ ι)) [IsProbabilityMeasure μ] {s K v z : ℝ} (hs : 0 ENNReal.ofReal (smoothedDensity μ s x))) E) (hβ : normalLaw v E≤ENNReal.ofReal (Real.exp (-z))) : classicalEntropy μ s≤(Fintype.card ι:ℝ)/2*Real.log (2*Real.pi*v)+ (∫x,smoothedDensity μ s x*‖x‖^2)/(2*v)-z/2+Real.log 2 := by have hfi := smoothedDensity_integrable μ hs have hgi := normalKernel_integrable (ι := ι) hv have hfm : (volume.withDensity (fun x => ENNReal.ofReal (smoothedDensity μ s x))) univ=1 := by rw [withDensity_apply _ MeasurableSet.univ,setLIntegral_univ, ← ofReal_integral_eq_lintegral_ofReal hfi (ae_of_all _ (fun x => (smoothedDensity_pos μ hs x).le)),smoothedDensity_integral μ hs] simp have hfE : (volume.withDensity (fun x => ENNReal.ofReal (smoothedDensity μ s x))) E≠⊤ := ne_top_of_le_ne_top (by simp) ((measure_mono (subset_univ E)).trans_eq hfm) have ha := (ENNReal.ofReal_le_iff_le_toReal hfE).mp hα rw [density_event_toReal volume _ hfi (fun x => (smoothedDensity_pos μ hs x).le) E hE] at ha have hb := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) hβ rw [normalLaw,density_event_toReal volume _ hgi (fun x => (normalKernel_pos v x).le) E hE, ENNReal.toReal_ofReal (Real.exp_pos _).le] at hb have he := entropy_event_bound volume (smoothedDensity μ s) (normalKernel v) (smoothedDensity_pos μ hs) (normalKernel_pos v) hfi hgi (smoothedEntropy_integrable μ hs hK hμ) (normalCross_integrable μ hs hK hμ v) (smoothedDensity_integral μ hs) (normalKernel_integral hv) E hE hz ha hb rwa [normalCross_integral μ hs hK hμ v] at he variable {n d : ℕ} theorem integral_heatLaw_totalSecond (hd : 0