Buckets:
| import Mathlib | |
| import OAI.Analysis.CoulombRadii.Variational.SignAverage | |
| namespace OAI | |
| section | |
| section | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology ContDiff Classical | |
| noncomputable section | |
| namespace NeutralAtom | |
| open scoped ENNReal Convolution | |
| open scoped BigOperators | |
| theorem setIntegral_abs_pow_le {Ω : Type*} [MeasurableSpace Ω] | |
| (μ : Measure Ω) [IsFiniteMeasure μ] (f : Ω → ℝ) (s : Set Ω) | |
| (hp : 0 < μ.real s) (hf : Integrable f μ) | |
| (q : ℕ) (hq : 0 < q) (hfq : Integrable (fun x => |f x|^q) μ) : | |
| (∫ x in s, |f x| ∂μ)^q ≤ (μ.real s)^(q-1) * (∫ x, |f x|^q ∂μ) := by | |
| have h0 : μ s ≠ 0 := by | |
| intro h | |
| simp [Measure.real, h] at hp | |
| have hj := (convexOn_pow q).map_set_average_le | |
| (continuous_id.pow q).continuousOn isClosed_Ici h0 (measure_ne_top μ s) | |
| (Filter.Eventually.of_forall (fun x => abs_nonneg (f x))) | |
| hf.abs.integrableOn hfq.integrableOn | |
| simp only [average_eq, Measure.real, Measure.restrict_apply MeasurableSet.univ, | |
| Set.univ_inter, smul_eq_mul, ← div_eq_inv_mul, div_pow] at hj | |
| change (∫ x in s, |f x| ∂μ)^q / (μ.real s)^q ≤ | |
| (∫ x in s, |f x|^q ∂μ) / μ.real s at hj | |
| have hj' := (div_le_div_iff₀ (pow_pos hp q) hp).mp hj | |
| have hpow : (μ.real s)^q = (μ.real s)^(q-1) * μ.real s := by | |
| rw [← pow_succ] | |
| congr 1 | |
| omega | |
| rw [hpow] at hj' | |
| have hj'' : (∫ x in s, |f x| ∂μ)^q ≤ | |
| (μ.real s)^(q-1) * (∫ x in s, |f x|^q ∂μ) := | |
| (mul_le_mul_iff_left₀ hp).mp (by nlinarith [hj']) | |
| exact hj''.trans (mul_le_mul_of_nonneg_left | |
| (integral_mono_measure μ.restrict_le_self | |
| (Filter.Eventually.of_forall fun x => pow_nonneg (abs_nonneg (f x)) q) hfq) | |
| (pow_nonneg hp.le (q-1))) | |
| theorem square_le_log_fifth_of_moments {x p D : ℝ} | |
| (hp : 0 < p) (hp1 : p ≤ 1) (hD : 0 ≤ D) | |
| (hx : ∀ k : ℕ, 0 < k → x^(2*k) ≤ p^(2*k-1) * (2*(D*(k:ℝ)^5)^k)) : | |
| x^2 ≤ 32 * Real.exp 2 * D * p^2 * (1-Real.log p)^5 := by | |
| let L : ℝ := 1-Real.log p | |
| have hlog : Real.log p ≤ 0 := Real.log_nonpos hp.le hp1 | |
| have hL : 1 ≤ L := by dsimp [L]; linarith | |
| have hL0 : 0 ≤ L := le_trans zero_le_one hL | |
| let k : ℕ := ⌈L⌉₊ | |
| have hkL : L ≤ (k:ℝ) := Nat.le_ceil L | |
| have hk : 0 < k := Nat.ceil_pos.mpr (lt_of_lt_of_le zero_lt_one hL) | |
| have hk1 : 1 ≤ (k:ℝ) := le_trans hL hkL | |
| have hkU : (k:ℝ) ≤ 2*L := by | |
| have hh := Nat.ceil_lt_add_one hL0 | |
| change (k:ℝ) < L+1 at hh | |
| linarith | |
| have h2p : 2 ≤ p * (Real.exp 2)^k := by | |
| calc | |
| 2 ≤ Real.exp 1 := Real.exp_one_gt_two.le | |
| _ ≤ Real.exp (Real.log p + (k:ℝ)*2) := by | |
| apply Real.exp_le_exp.mpr | |
| dsimp [L] at hkL | |
| linarith | |
| _ = p * (Real.exp 2)^k := by rw [Real.exp_add, Real.exp_log hp, Real.exp_nat_mul] | |
| have hxp : (x^2)^k ≤ (D * Real.exp 2 * (k:ℝ)^5 * p^2)^k := by | |
| calc | |
| (x^2)^k = x^(2*k) := by rw [pow_mul] | |
| _ ≤ p^(2*k-1) * (2*(D*(k:ℝ)^5)^k) := hx k hk | |
| _ ≤ p^(2*k-1) * ((p * (Real.exp 2)^k)*(D*(k:ℝ)^5)^k) := | |
| mul_le_mul_of_nonneg_left | |
| (mul_le_mul_of_nonneg_right h2p (by positivity)) (by positivity) | |
| _ = (D * Real.exp 2 * (k:ℝ)^5 * p^2)^k := by | |
| have he : p^(2*k-1)*p = p^(2*k) := by | |
| rw [← pow_succ] | |
| congr 1 | |
| omega | |
| calc | |
| p^(2*k-1) * ((p * (Real.exp 2)^k)*(D*(k:ℝ)^5)^k) = | |
| (p^(2*k-1)*p) * ((Real.exp 2)^k*(D*(k:ℝ)^5)^k) := by ring | |
| _ = (p^2)^k * ((Real.exp 2)^k*(D*(k:ℝ)^5)^k) := by rw [he, pow_mul] | |
| _ = (D * Real.exp 2 * (k:ℝ)^5 * p^2)^k := by simp only [mul_pow]; ring | |
| have hx2 : x^2 ≤ D * Real.exp 2 * (k:ℝ)^5 * p^2 := | |
| (pow_le_pow_iff_left₀ (sq_nonneg x) (by positivity) hk.ne').mp hxp | |
| calc | |
| x^2 ≤ D * Real.exp 2 * (k:ℝ)^5 * p^2 := hx2 | |
| _ ≤ D * Real.exp 2 * (2*L)^5 * p^2 := by gcongr | |
| _ = 32 * Real.exp 2 * D * p^2 * (1-Real.log p)^5 := by dsimp [L]; ring | |
| theorem observationScorePi_event_bound {ι : Type*} [Fintype ι] | |
| (a : ι → ℝ) (s : Set (ι → ℝ)) | |
| (hp : 0 < (Measure.pi (fun _ : ι => observationNoiseLaw)).real s) : | |
| (∫ u in s, |∑ i, a i * observationTranslationScore (u i)| | |
| ∂Measure.pi (fun _ : ι => observationNoiseLaw))^2 ≤ | |
| (32 * Real.exp 2 * (2048 * Real.exp 1 * (max 1 (2*observationNoiseNormalizer))^2)) * | |
| (∑ i, (a i)^2) * ((Measure.pi (fun _ : ι => observationNoiseLaw)).real s)^2 * | |
| (1-Real.log ((Measure.pi (fun _ : ι => observationNoiseLaw)).real s))^5 := by | |
| classical | |
| let μ := Measure.pi (fun _ : ι => observationNoiseLaw) | |
| let f := fun u : ι → ℝ => ∑ i, a i * observationTranslationScore (u i) | |
| let D := 2048 * Real.exp 1 * (max 1 (2*observationNoiseNormalizer))^2 * | |
| (∑ i, (a i)^2) | |
| have hD : 0 ≤ D := by dsimp [D]; positivity | |
| have hf : Integrable f μ := (observationScorePi_sum_memLp a 1 (by omega)).integrable (by norm_num) | |
| have hh := square_le_log_fifth_of_moments hp measureReal_le_one hD | |
| (x := ∫ u in s, |f u| ∂μ) (fun k hk => by | |
| have hi := observationScorePi_sum_pow_integrable a (2*k) (by omega) | |
| have hj := setIntegral_abs_pow_le μ f s hp hf (2*k) (by omega) hi | |
| apply hj.trans | |
| have hb := mul_le_mul_of_nonneg_left (observationScorePi_moment_le a k hk) | |
| (pow_nonneg hp.le (2*k-1)) | |
| convert hb using 1 | |
| dsimp [D] | |
| congr 3 | |
| ring) | |
| convert hh using 1 | |
| dsimp [D] | |
| ring | |
| open scoped Convolution | |
| def observationProductDensity {ι : Type*} [Fintype ι] (u : ι → ℝ) : ℝ := | |
| ∏ i, observationNoiseDensity (u i) | |
| theorem observationProductDensity_nonneg {ι : Type*} [Fintype ι] (u : ι → ℝ) : | |
| 0 ≤ observationProductDensity u := | |
| Finset.prod_nonneg (fun _i _ => observationNoiseDensity_nonneg _) | |
| theorem observationProductDensity_contDiff {ι : Type*} [Fintype ι] : | |
| ContDiff ℝ ∞ (@observationProductDensity ι _) := by | |
| unfold observationProductDensity | |
| have h := observationNoiseDensity_contDiff | |
| fun_prop | |
| theorem observationProductDensity_compact {ι : Type*} [Fintype ι] : | |
| HasCompactSupport (@observationProductDensity ι _) := by | |
| classical | |
| apply HasCompactSupport.intro | |
| (isCompact_pi_infinite (fun _ : ι => (isCompact_Icc : IsCompact (Set.Icc (-1:ℝ) 1)))) | |
| intro u hu | |
| simp only [Set.mem_ofPred_eq, not_forall] at hu | |
| obtain ⟨i, hi⟩ := hu | |
| apply Finset.prod_eq_zero (Finset.mem_univ i) | |
| rw [observationNoiseDensity_formula, ite_eq_right, mul_zero] | |
| intro hh | |
| exact hi ⟨(abs_lt.mp hh).1.le, (abs_lt.mp hh).2.le⟩ | |
| theorem observationProductDensity_integrable {ι : Type*} [Fintype ι] : | |
| Integrable (@observationProductDensity ι _) := | |
| Integrable.fintype_prod (fun _ => observationNoiseDensity_integrable) | |
| theorem observationProductDensity_even {ι : Type*} [Fintype ι] (u : ι → ℝ) : | |
| observationProductDensity (-u) = observationProductDensity u := by | |
| simp [observationProductDensity, observationNoiseDensity_even] | |
| theorem observationNoiseLaw_pi_density {ι : Type*} [Fintype ι] : | |
| Measure.pi (fun _ : ι => observationNoiseLaw) = | |
| volume.withDensity (fun u : ι → ℝ => ENNReal.ofReal (observationProductDensity u)) := by | |
| classical | |
| apply Measure.pi_eq | |
| intro s hs | |
| rw [withDensity_apply _ (MeasurableSet.univ_pi hs), | |
| ← ofReal_integral_eq_lintegral_ofReal observationProductDensity_integrable.integrableOn | |
| (Filter.Eventually.of_forall observationProductDensity_nonneg)] | |
| change ENNReal.ofReal (∫ u : ι → ℝ in Set.univ.pi s, | |
| ∏ i, observationNoiseDensity (u i) ∂Measure.pi (fun _ => volume)) = _ | |
| rw [Measure.restrict_pi_pi, integral_fintype_prod_eq_prod, ENNReal.ofReal_prod_of_nonneg] | |
| · apply Finset.prod_congr rfl | |
| intro i _ | |
| rw [observationNoiseLaw, withDensity_apply _ (hs i), | |
| ← ofReal_integral_eq_lintegral_ofReal observationNoiseDensity_integrable.integrableOn | |
| (Filter.Eventually.of_forall observationNoiseDensity_nonneg)] | |
| · intro i _ | |
| exact integral_nonneg observationNoiseDensity_nonneg | |
| theorem observationNoiseLaw_pi_integral {ι : Type*} [Fintype ι] (f : (ι → ℝ) → ℝ) : | |
| (∫ u, f u ∂Measure.pi (fun _ : ι => observationNoiseLaw)) = | |
| ∫ u, observationProductDensity u * f u := by | |
| rw [observationNoiseLaw_pi_density, integral_withDensity_eq_integral_toReal_smul] | |
| · simp only [ENNReal.toReal_ofReal (observationProductDensity_nonneg _), smul_eq_mul] | |
| · exact observationProductDensity_contDiff.continuous.measurable.ennreal_ofReal | |
| · exact Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top) | |
| theorem observationProductDensity_fderiv {ι : Type*} [Fintype ι] | |
| (u v : ι → ℝ) : | |
| fderiv ℝ observationProductDensity u v = | |
| -(∑ i, v i * observationTranslationScore (u i)) * observationProductDensity u := by | |
| classical | |
| have hd (i : ι) : HasFDerivAt (fun w : ι → ℝ => observationNoiseDensity (w i)) | |
| ((-observationTranslationScore (u i) * observationNoiseDensity (u i)) • | |
| (ContinuousLinearMap.proj i : (ι → ℝ) →L[ℝ] ℝ)) u := | |
| (observationNoiseDensity_hasDerivAt (u i)).comp_hasFDerivAt | |
| (f := fun w : ι → ℝ => w i) u (ContinuousLinearMap.proj i : (ι → ℝ) →L[ℝ] ℝ).hasFDerivAt | |
| unfold observationProductDensity | |
| rw [(HasFDerivAt.finsetProd (fun i (_ : i ∈ Finset.univ) => hd i)).fderiv] | |
| simp only [sum_apply, smul_apply, | |
| ContinuousLinearMap.proj_apply, smul_eq_mul] | |
| rw [← Finset.sum_neg_distrib, Finset.sum_mul] | |
| apply Finset.sum_congr rfl | |
| intro i hi | |
| have he := Finset.mul_prod_erase Finset.univ (fun j => observationNoiseDensity (u j)) hi | |
| change (∏ j ∈ Finset.univ.erase i, observationNoiseDensity (u j)) * | |
| ((-observationTranslationScore (u i) * observationNoiseDensity (u i)) * v i) = | |
| -(v i * observationTranslationScore (u i)) * (∏ j, observationNoiseDensity (u j)) | |
| rw [← he] | |
| ring | |
| def observationEventLikelihood {ι : Type*} [Fintype ι] | |
| (s : Set (ι → ℝ)) (z : ι → ℝ) : ℝ := | |
| (s.indicator (fun _ => (1:ℝ)) ⋆[ContinuousLinearMap.mul ℝ ℝ] observationProductDensity) z | |
| theorem observationEventLikelihood_contDiff {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) : | |
| ContDiff ℝ ∞ (observationEventLikelihood s) := | |
| observationProductDensity_compact.contDiff_convolution_right (ContinuousLinearMap.mul ℝ ℝ) | |
| ((locallyIntegrable_const 1).indicator hs) observationProductDensity_contDiff | |
| theorem observationEventLikelihood_integral {ι : Type*} [Fintype ι] | |
| (s : Set (ι → ℝ)) (z : ι → ℝ) : | |
| observationEventLikelihood s z = | |
| ∫ u, s.indicator (fun _ => (1:ℝ)) (z+u) | |
| ∂Measure.pi (fun _ : ι => observationNoiseLaw) := by | |
| rw [observationEventLikelihood, convolution_def, observationNoiseLaw_pi_integral, | |
| ← integral_add_left_eq_self (fun y : ι → ℝ => | |
| (ContinuousLinearMap.mul ℝ ℝ) (s.indicator (fun _ => (1:ℝ)) y) | |
| (observationProductDensity (z-y))) z] | |
| apply integral_congr_ae | |
| filter_upwards with u | |
| simp only [ContinuousLinearMap.mul_apply', show z-(z+u) = -u by abel, | |
| observationProductDensity_even] | |
| ring | |
| theorem observationEventLikelihood_probability {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) (z : ι → ℝ) : | |
| observationEventLikelihood s z = | |
| (Measure.pi (fun _ : ι => observationNoiseLaw)).real ((fun u => z+u) ⁻¹' s) := by | |
| rw [observationEventLikelihood_integral] | |
| have he : (fun u => s.indicator (fun _ => (1:ℝ)) (z+u)) = | |
| ((fun u => z+u) ⁻¹' s).indicator (fun _ => (1:ℝ)) := by | |
| ext u | |
| exact (Set.indicator_comp_right (fun u : ι → ℝ => z+u)).symm | |
| rw [he] | |
| have ht : MeasurableSet ((fun u : ι → ℝ => z+u) ⁻¹' s) := hs.preimage (by fun_prop) | |
| rw [integral_indicator ht, setIntegral_const, smul_eq_mul, mul_one] | |
| theorem observationEventLikelihood_fderiv {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) (z v : ι → ℝ) : | |
| fderiv ℝ (observationEventLikelihood s) z v = | |
| ∫ u in ((fun u => z+u) ⁻¹' s), ∑ i, v i * observationTranslationScore (u i) | |
| ∂Measure.pi (fun _ : ι => observationNoiseLaw) := by | |
| have hf := (locallyIntegrable_const (1:ℝ) (μ := (volume : Measure (ι → ℝ)))).indicator hs | |
| have hg : ContDiff ℝ 1 (@observationProductDensity ι _) := | |
| observationProductDensity_contDiff.of_le (by norm_num) | |
| have hd := observationProductDensity_compact.hasFDerivAt_convolution_right | |
| (ContinuousLinearMap.mul ℝ ℝ) hf hg z | |
| change fderiv ℝ (s.indicator (fun _ => (1:ℝ)) ⋆[ContinuousLinearMap.mul ℝ ℝ] | |
| observationProductDensity) z v = _ | |
| rw [hd.fderiv, convolution_precompR_apply (ContinuousLinearMap.mul ℝ ℝ) hf | |
| (observationProductDensity_compact.fderiv ℝ) (hg.continuous_fderiv one_ne_zero), | |
| convolution_def] | |
| have ht : MeasurableSet ((fun u : ι → ℝ => z+u) ⁻¹' s) := hs.preimage (by fun_prop) | |
| rw [← integral_indicator ht, observationNoiseLaw_pi_integral, | |
| ← integral_add_left_eq_self (fun y : ι → ℝ => | |
| (ContinuousLinearMap.mul ℝ ℝ) (s.indicator (fun _ => (1:ℝ)) y) | |
| (fderiv ℝ observationProductDensity (z-y) v)) z] | |
| apply integral_congr_ae | |
| filter_upwards with u | |
| rw [observationProductDensity_fderiv] | |
| simp only [show z-(z+u) = -u by abel, ContinuousLinearMap.mul_apply', | |
| observationProductDensity_even, Pi.neg_apply, observationTranslationScore_odd, | |
| mul_neg, Finset.sum_neg_distrib, neg_neg] | |
| by_cases hu : z+u ∈ s | |
| · simp [hu, mul_comm] | |
| · simp [hu] | |
| theorem observationEventLikelihood_nonneg {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) (z : ι → ℝ) : | |
| 0 ≤ observationEventLikelihood s z := by | |
| rw [observationEventLikelihood_probability hs] | |
| exact measureReal_nonneg | |
| theorem observationEventLikelihood_le_one {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) (z : ι → ℝ) : | |
| observationEventLikelihood s z ≤ 1 := by | |
| rw [observationEventLikelihood_probability hs] | |
| exact measureReal_le_one | |
| def observationScoreConstant : ℝ := | |
| 32 * Real.exp 2 * (2048 * Real.exp 1 * (max 1 (2*observationNoiseNormalizer))^2) | |
| theorem observationScoreConstant_pos : 0 < observationScoreConstant := by | |
| unfold observationScoreConstant | |
| have : 0 < max 1 (2*observationNoiseNormalizer) := lt_of_lt_of_le zero_lt_one (le_max_left _ _) | |
| positivity | |
| theorem observationEventLikelihood_derivative_bound {ι : Type*} [Fintype ι] | |
| {s : Set (ι → ℝ)} (hs : MeasurableSet s) (z v : ι → ℝ) : | |
| (fderiv ℝ (observationEventLikelihood s) z v)^2 ≤ | |
| observationScoreConstant * (∑ i, (v i)^2) * (observationEventLikelihood s z)^2 * | |
| (1-Real.log (observationEventLikelihood s z))^5 := by | |
| let μ := Measure.pi (fun _ : ι => observationNoiseLaw) | |
| let t := (fun u : ι → ℝ => z+u) ⁻¹' s | |
| rw [observationEventLikelihood_fderiv hs, observationEventLikelihood_probability hs] | |
| change (∫ u in t, ∑ i, v i * observationTranslationScore (u i) ∂μ)^2 ≤ | |
| observationScoreConstant * (∑ i, (v i)^2) * (μ.real t)^2 * (1-Real.log (μ.real t))^5 | |
| rcases (measureReal_nonneg : 0 ≤ μ.real t).eq_or_lt with hp | hp | |
| · have hzero : μ t = 0 := (ENNReal.toReal_eq_zero_iff _).mp hp.symm |>.resolve_right (measure_ne_top μ t) | |
| simp [Measure.restrict_eq_zero.mpr hzero, hp.symm] | |
| · have hh := observationScorePi_event_bound v t hp | |
| apply le_trans _ hh | |
| have ha := abs_integral_le_integral_abs (f := fun u : ι → ℝ => | |
| ∑ i, v i * observationTranslationScore (u i)) (μ := μ.restrict t) | |
| simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg _) ha 2 | |
| theorem likelihood_log_fifth_majorant {u p : ℝ} | |
| (hu : 0 ≤ u) (hu1 : u ≤ 1) (hp : 0 < p) (hp1 : p ≤ 1) : | |
| u * (1-Real.log u)^5 ≤ | |
| (u + 120 * Real.exp 1 * p) * (1-Real.log p)^5 := by | |
| have hL : 1 ≤ 1-Real.log p := by have := Real.log_nonpos hp.le hp1; linarith | |
| have hL0 : 0 ≤ 1-Real.log p := by linarith | |
| rcases hu.eq_or_lt with rfl | hu | |
| · simp only [zero_mul, zero_add] | |
| positivity | |
| by_cases hup : u ≤ p | |
| · let t := Real.log p - Real.log u | |
| have ht : 0 ≤ t := sub_nonneg.mpr (Real.log_le_log hu hup) | |
| have hpow : (1-Real.log u)^5 ≤ ((1-Real.log p)*(1+t))^5 := by | |
| apply pow_le_pow_left₀ (by have := Real.log_nonpos hu.le hu1; linarith) | |
| have he : 1-Real.log u = (1-Real.log p)+t := by dsimp [t]; ring | |
| rw [he] | |
| nlinarith | |
| have hex := pow_mul_exp_neg_le_factorial 5 (add_nonneg zero_le_one ht) | |
| have hex' : (1+t)^5 * Real.exp (-t) ≤ 120 * Real.exp 1 := by | |
| have hh := mul_le_mul_of_nonneg_right hex (Real.exp_pos 1).le | |
| rw [mul_assoc, ← Real.exp_add] at hh | |
| convert hh using 1 <;> norm_num | |
| have he : u = p * Real.exp (-t) := by | |
| dsimp [t] | |
| rw [neg_sub, Real.exp_sub, Real.exp_log hu, Real.exp_log hp] | |
| field_simp | |
| calc | |
| u * (1-Real.log u)^5 ≤ u * ((1-Real.log p)*(1+t))^5 := | |
| mul_le_mul_of_nonneg_left hpow hu.le | |
| _ = p * (1-Real.log p)^5 * ((1+t)^5 * Real.exp (-t)) := by rw [he, mul_pow]; ring | |
| _ ≤ p * (1-Real.log p)^5 * (120 * Real.exp 1) := | |
| mul_le_mul_of_nonneg_left hex' (by positivity) | |
| _ ≤ (u + 120 * Real.exp 1 * p) * (1-Real.log p)^5 := by | |
| nlinarith [mul_nonneg hu.le (pow_nonneg hL0 5)] | |
| · have hpu : p ≤ u := (lt_of_not_ge hup).le | |
| have hl : 1-Real.log u ≤ 1-Real.log p := sub_le_sub_left (Real.log_le_log hp hpu) 1 | |
| have h0 : 0 ≤ 1-Real.log u := by have := Real.log_nonpos hu.le hu1; linarith | |
| calc | |
| u * (1-Real.log u)^5 ≤ u * (1-Real.log p)^5 := by gcongr | |
| _ ≤ (u + 120 * Real.exp 1 * p) * (1-Real.log p)^5 := by | |
| apply mul_le_mul_of_nonneg_right _ (pow_nonneg hL0 5) | |
| exact le_add_of_nonneg_right (by positivity) | |
| theorem integral_likelihood_log_fifth {Ω : Type*} [MeasurableSpace Ω] | |
| (μ : Measure Ω) [IsProbabilityMeasure μ] {f : Ω → ℝ} | |
| (hf : Measurable f) (hf0 : ∀ x, 0 ≤ f x) (hf1 : ∀ x, f x ≤ 1) | |
| (hp : 0 < ∫ x, f x ∂μ) : | |
| Integrable (fun x => f x * (1-Real.log (f x))^5) μ ∧ | |
| (∫ x, f x * (1-Real.log (f x))^5 ∂μ) ≤ | |
| (1+120*Real.exp 1) * (∫ x, f x ∂μ) * (1-Real.log (∫ x, f x ∂μ))^5 := by | |
| let p := ∫ x, f x ∂μ | |
| have hfi : Integrable f μ := Integrable.mono' (integrable_const (1:ℝ)) | |
| hf.aestronglyMeasurable (Filter.Eventually.of_forall (fun x => by | |
| rw [Real.norm_eq_abs, abs_of_nonneg (hf0 x)]; exact hf1 x)) | |
| have hp1 : p ≤ 1 := by | |
| calc | |
| p ≤ ∫ _ : Ω, (1:ℝ) ∂μ := integral_mono hfi (integrable_const _) hf1 | |
| _ = 1 := by simp | |
| have hmaj (x : Ω) := likelihood_log_fifth_majorant (hf0 x) (hf1 x) hp hp1 | |
| have hnonneg (x : Ω) : 0 ≤ f x * (1-Real.log (f x))^5 := by | |
| have hh := Real.log_nonpos (hf0 x) (hf1 x) | |
| exact mul_nonneg (hf0 x) (pow_nonneg (by linarith) 5) | |
| have hgi : Integrable (fun x => (f x+120*Real.exp 1*p)*(1-Real.log p)^5) μ := | |
| (hfi.add (integrable_const _)).mul_const _ | |
| have hai : Integrable (fun x => f x * (1-Real.log (f x))^5) μ := | |
| Integrable.mono' hgi (by fun_prop) (Filter.Eventually.of_forall (fun x => by | |
| rw [Real.norm_eq_abs, abs_of_nonneg (hnonneg x)]; exact hmaj x)) | |
| refine ⟨hai, (integral_mono hai hgi hmaj).trans_eq ?_⟩ | |
| rw [integral_mul_const, integral_add hfi (integrable_const _)] | |
| simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] | |
| dsimp [p] | |
| ring | |
| def coordinateLinear {n : ℕ} (i : Fin n) (a : Fin 3) : Configuration n →L[ℝ] ℝ := | |
| (EuclideanSpace.proj a).comp (ContinuousLinearMap.proj i) | |
| @[simp] theorem coordinateLinear_apply {n : ℕ} (i : Fin n) (a : Fin 3) (x : Configuration n) : | |
| coordinateLinear i a x = x i a := rfl | |
| def observationArrayCenter {H : Type*} [Fintype H] {n : ℕ} (ℓ : H → ℝ) : | |
| Configuration n →L[ℝ] ((H × (Fin n × Fin 3)) → ℝ) := | |
| ContinuousLinearMap.pi (fun hia => (ℓ hia.1)⁻¹ • coordinateLinear hia.2.1 hia.2.2) | |
| def observationArrayRescale {H : Type*} {n : ℕ} (ℓ : H → ℝ) | |
| (y : (H × (Fin n × Fin 3)) → ℝ) : (H × (Fin n × Fin 3)) → ℝ := | |
| fun hia => ℓ hia.1 * y hia | |
| def arrayEventLikelihood {H : Type*} [Fintype H] {n : ℕ} (ℓ : H → ℝ) | |
| (s : Set ((H × (Fin n × Fin 3)) → ℝ)) (x : Configuration n) : ℝ := | |
| observationEventLikelihood (observationArrayRescale ℓ ⁻¹' s) (observationArrayCenter ℓ x) | |
| theorem arrayEventLikelihood_contDiff {H : Type*} [Fintype H] {n : ℕ} | |
| (ℓ : H → ℝ) {s : Set ((H × (Fin n × Fin 3)) → ℝ)} (hs : MeasurableSet s) : | |
| ContDiff ℝ ∞ (arrayEventLikelihood ℓ s) := | |
| (observationEventLikelihood_contDiff (hs.preimage (by | |
| unfold observationArrayRescale; fun_prop))).comp (observationArrayCenter ℓ).contDiff | |
| theorem arrayEventLikelihood_nonneg {H : Type*} [Fintype H] {n : ℕ} | |
| (ℓ : H → ℝ) {s : Set ((H × (Fin n × Fin 3)) → ℝ)} (hs : MeasurableSet s) | |
| (x : Configuration n) : 0 ≤ arrayEventLikelihood ℓ s x := | |
| observationEventLikelihood_nonneg (hs.preimage (by unfold observationArrayRescale; fun_prop)) _ | |
| end NeutralAtom | |
| end | |
| end | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 21.1 kB
- Xet hash:
- cb028698b51b7ec1afd82236a9062b05aa7fe55d3e0321d13f98aefd522759be
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.