cfahlgren1/math / lean /OAI /Analysis /CoulombRadii /RandomFields /ObservationWidthSquareSum.lean
cfahlgren1's picture
download
raw
24.5 kB
import Mathlib
import OAI.Analysis.CoulombRadii.RandomFields.ObservationProductDensity
namespace OAI
section
section
open MeasureTheory Filter
open scoped BigOperators Topology ContDiff Classical
noncomputable section
namespace NeutralAtom
open scoped ENNReal Convolution
open scoped BigOperators
open scoped Convolution
theorem arrayEventLikelihood_le_one {H : Type*} [Fintype H] {n : ℕ}
(ℓ : H → ℝ) {s : Set ((H × (Fin n × Fin 3)) → ℝ)} (hs : MeasurableSet s)
(x : Configuration n) : arrayEventLikelihood ℓ s x ≤ 1 :=
observationEventLikelihood_le_one (hs.preimage (by unfold observationArrayRescale; fun_prop)) _
theorem arrayEventLikelihood_integral {H : Type*} [Fintype H] {n : ℕ}
(ℓ : H → ℝ) (hℓ : ∀ h, ℓ h ≠ 0)
(s : Set ((H × (Fin n × Fin 3)) → ℝ)) (x : Configuration n) :
arrayEventLikelihood ℓ s x =
∫ u, s.indicator (fun _ => (1:ℝ)) (fun hia => x hia.2.1 hia.2.2 + ℓ hia.1 * u hia)
∂Measure.pi (fun _ : H × (Fin n × Fin 3) => observationNoiseLaw) := by
rw [arrayEventLikelihood, observationEventLikelihood_integral]
apply integral_congr_ae
filter_upwards with u
have he : observationArrayRescale ℓ (observationArrayCenter ℓ x + u) =
(fun hia => x hia.2.1 hia.2.2 + ℓ hia.1 * u hia) := by
ext hia
simp [observationArrayRescale, observationArrayCenter, mul_add, hℓ]
change (observationArrayRescale ℓ ⁻¹' s).indicator
((fun _ => (1:ℝ)) ∘ observationArrayRescale ℓ) (observationArrayCenter ℓ x + u) = _
rw [Set.indicator_comp_right, he]
def observationWidthSquareSum {H : Type*} [Fintype H] (ℓ : H → ℝ) : ℝ :=
∑ h, ((ℓ h)⁻¹)^2
theorem observationWidthSquareSum_nonneg {H : Type*} [Fintype H] (ℓ : H → ℝ) :
0 ≤ observationWidthSquareSum ℓ := Finset.sum_nonneg (fun _ _ => sq_nonneg _)
theorem arrayEventLikelihood_direction_bound {H : Type*} [Fintype H] {n : ℕ}
(ℓ : H → ℝ) {s : Set ((H × (Fin n × Fin 3)) → ℝ)} (hs : MeasurableSet s)
(x v : Configuration n) :
(fderiv ℝ (arrayEventLikelihood ℓ s) x v)^2 ≤
observationScoreConstant * observationWidthSquareSum ℓ * (∑ i, ∑ a, (v i a)^2) *
(arrayEventLikelihood ℓ s x)^2 * (1-Real.log (arrayEventLikelihood ℓ s x))^5 := by
have ht : MeasurableSet (observationArrayRescale ℓ ⁻¹' s) := hs.preimage (by
unfold observationArrayRescale; fun_prop)
have hd := (observationEventLikelihood_contDiff ht).differentiable (by simp)
have he : fderiv ℝ (arrayEventLikelihood ℓ s) x v =
fderiv ℝ (observationEventLikelihood (observationArrayRescale ℓ ⁻¹' s))
(observationArrayCenter ℓ x) (observationArrayCenter ℓ v) := by
exact congrArg (fun D : Configuration n →L[ℝ] ℝ => D v)
((hd _).hasFDerivAt.comp x (observationArrayCenter ℓ).hasFDerivAt).fderiv
rw [he]
have hh := observationEventLikelihood_derivative_bound ht (observationArrayCenter ℓ x)
(observationArrayCenter ℓ v)
have hsum : (∑ hia : H × (Fin n × Fin 3), (observationArrayCenter ℓ v hia)^2) =
observationWidthSquareSum ℓ * (∑ i, ∑ a, (v i a)^2) := by
simp only [observationArrayCenter, ContinuousLinearMap.pi_apply, smul_apply,
smul_eq_mul, coordinateLinear_apply, mul_pow, Fintype.sum_prod_type,
← Finset.mul_sum, ← Finset.sum_mul, observationWidthSquareSum]
simpa only [hsum, arrayEventLikelihood, mul_assoc] using hh
theorem configuration_coordinate_expansion {n : ℕ} (v : Configuration n) :
v = ∑ i, ∑ a, (v i a) • coordinateDirection i a := by
classical
ext i a
simp [coordinateDirection, Pi.single_apply]
theorem arrayEventLikelihood_gradient_bound {H : Type*} [Fintype H] {n : ℕ}
(ℓ : H → ℝ) {s : Set ((H × (Fin n × Fin 3)) → ℝ)} (hs : MeasurableSet s)
(x : Configuration n) :
(∑ i, ∑ a, (fderiv ℝ (arrayEventLikelihood ℓ s) x (coordinateDirection i a))^2) ≤
observationScoreConstant * observationWidthSquareSum ℓ *
(arrayEventLikelihood ℓ s x)^2 * (1-Real.log (arrayEventLikelihood ℓ s x))^5 := by
let d : Fin n → Fin 3 → ℝ := fun i a =>
fderiv ℝ (arrayEventLikelihood ℓ s) x (coordinateDirection i a)
let v : Configuration n := fun i => (EuclideanSpace.equiv (Fin 3) ℝ).symm (d i)
let A : ℝ := ∑ i, ∑ a, (d i a)^2
have hA : 0 ≤ A := Finset.sum_nonneg (fun i _ => Finset.sum_nonneg (fun a _ => sq_nonneg _))
have hv (i : Fin n) (a : Fin 3) : v i a = d i a := rfl
have he : fderiv ℝ (arrayEventLikelihood ℓ s) x v = A := by
conv_lhs => rw [configuration_coordinate_expansion v]
simp only [map_sum, map_smul, smul_eq_mul, hv, d, A, pow_two]
have hh := arrayEventLikelihood_direction_bound ℓ hs x v
simp only [he, hv] at hh
change A^2 ≤ observationScoreConstant * observationWidthSquareSum ℓ * A *
(arrayEventLikelihood ℓ s x)^2 * (1-Real.log (arrayEventLikelihood ℓ s x))^5 at hh
change A ≤ _
rcases hA.eq_or_lt with hAz | hAz
· rw [← hAz]
have hl := Real.log_nonpos (arrayEventLikelihood_nonneg ℓ hs x) (arrayEventLikelihood_le_one ℓ hs x)
exact mul_nonneg (mul_nonneg (mul_nonneg observationScoreConstant_pos.le
(observationWidthSquareSum_nonneg ℓ)) (sq_nonneg _)) (pow_nonneg (by linarith) 5)
· exact (mul_le_mul_iff_left₀ hAz).mp (by nlinarith only [hh])
def permuteObservationArray {H : Type*} {n : ℕ} (p : Equiv.Perm (Fin n))
(y : (H × (Fin n × Fin 3)) → ℝ) : (H × (Fin n × Fin 3)) → ℝ :=
fun hia => y (hia.1, p hia.2.1, hia.2.2)
theorem arrayEventLikelihood_symmetric {H : Type*} [Fintype H] {n : ℕ}
(ℓ : H → ℝ) (hℓ : ∀ h, ℓ h ≠ 0)
{s : Set ((H × (Fin n × Fin 3)) → ℝ)}
(hsym : ∀ (p : Equiv.Perm (Fin n)) y, permuteObservationArray p y ∈ s ↔ y ∈ s)
(p : Equiv.Perm (Fin n)) (x : Configuration n) :
arrayEventLikelihood ℓ s (x ∘ p) = arrayEventLikelihood ℓ s x := by
rw [arrayEventLikelihood_integral ℓ hℓ, arrayEventLikelihood_integral ℓ hℓ]
let e : Equiv.Perm (H × (Fin n × Fin 3)) :=
Equiv.prodCongr (Equiv.refl H) (Equiv.prodCongr p (Equiv.refl (Fin 3)))
let F : ((H × (Fin n × Fin 3)) → ℝ) → ℝ := fun u =>
s.indicator (fun _ => (1:ℝ)) (fun hia => (x ∘ p) hia.2.1 hia.2.2 + ℓ hia.1 * u hia)
have he := (measurePreserving_piCongrLeft
(fun _ : H × (Fin n × Fin 3) => observationNoiseLaw) e.symm).integral_comp' F
rw [← he]
apply integral_congr_ae
filter_upwards with u
have hu : (MeasurableEquiv.piCongrLeft (fun _ : H × (Fin n × Fin 3) => ℝ) e.symm) u =
permuteObservationArray p u := by
ext hia
have hh := MeasurableEquiv.piCongrLeft_apply_apply (β := fun _ => ℝ) e.symm u (e hia)
rw [e.symm_apply_apply] at hh
exact hh
rw [hu]
dsimp only [F]
have hv : (fun hia => (x ∘ p) hia.2.1 hia.2.2 + ℓ hia.1 * permuteObservationArray p u hia) =
permuteObservationArray p (fun hia => x hia.2.1 hia.2.2 + ℓ hia.1 * u hia) := rfl
rw [hv]
simp only [Set.indicator, hsym]
def eventRootDerivative {n : ℕ} (F : Configuration n → ℝ)
(i : Fin n) (a : Fin 3) (x : Configuration n) : ℝ :=
fderiv ℝ F x (coordinateDirection i a) / (2 * Real.sqrt (F x))
def regularizedEventRoot {n : ℕ} (F : Configuration n → ℝ)
(k : ℕ) (x : Configuration n) : ℝ := Real.sqrt (1/((k:ℝ)+1) + F x)
theorem regularizedEventRoot_derivative {n : ℕ} {F : Configuration n → ℝ}
(hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x)
(k : ℕ) (i : Fin n) (a : Fin 3) (x : Configuration n) :
fderiv ℝ (regularizedEventRoot F k) x (coordinateDirection i a) =
fderiv ℝ F x (coordinateDirection i a) / (2 * regularizedEventRoot F k x) := by
have hpos : 0 < 1/((k:ℝ)+1) + F x := add_pos_of_pos_of_nonneg (by positivity) (hF0 x)
unfold regularizedEventRoot
rw [fderiv_sqrt ((contDiff_const.add hF).differentiable (by simp)).differentiableAt hpos.ne',
fderiv_const_add]
simp only [smul_apply, smul_eq_mul]
ring
theorem root_gradient_square_bound {n : ℕ} {F : Configuration n → ℝ}
{K : ℝ} (hK : 0 ≤ K) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
{ε : ℝ} (hε : 0 ≤ ε) (x : Configuration n) :
(∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a) /
(2 * Real.sqrt (ε + F x)))^2) ≤ K/4 * F x * (1-Real.log (F x))^5 := by
have hlog : 0 ≤ (1-Real.log (F x))^5 := by
apply pow_nonneg
have := Real.log_nonpos (hF0 x) (hF1 x)
linarith
rcases (add_nonneg hε (hF0 x)).eq_or_lt with hh | hh
· rw [← hh, Real.sqrt_zero, mul_zero]
simp only [div_zero, zero_pow (by decide : 2 ≠ 0), Finset.sum_const_zero]
exact mul_nonneg (mul_nonneg (div_nonneg hK (by norm_num)) (hF0 x)) hlog
· simp only [div_pow, mul_pow, Real.sq_sqrt hh.le, ← Finset.sum_div]
apply (div_le_iff₀ (by positivity : (0:ℝ) < 2^2*(ε+F x))).mpr
have hnonneg := mul_nonneg (mul_nonneg (mul_nonneg hK (hF0 x)) hlog) hε
nlinarith [hgrad x]
theorem eventRootDerivative_gradient_bound {n : ℕ} {F : Configuration n → ℝ}
{K : ℝ} (hK : 0 ≤ K) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5) (x : Configuration n) :
(∑ i, ∑ a, (eventRootDerivative F i a x)^2) ≤
K/4 * F x * (1-Real.log (F x))^5 := by
simpa only [zero_add, eventRootDerivative] using
root_gradient_square_bound hK hF0 hF1 hgrad (ε := 0) le_rfl x
theorem coordinate_square_le_sum {n : ℕ} (D : Fin n → Fin 3 → ℝ)
(i : Fin n) (a : Fin 3) : (D i a)^2 ≤ ∑ j, ∑ b, (D j b)^2 := by
apply (Finset.single_le_sum (fun b _ => sq_nonneg (D i b)) (Finset.mem_univ a)).trans
exact Finset.single_le_sum (fun j _ => Finset.sum_nonneg (fun b _ => sq_nonneg (D j b)))
(Finset.mem_univ i)
theorem regularizedEventRoot_tendsto {n : ℕ} (F : Configuration n → ℝ)
(x : Configuration n) :
Tendsto (fun k => regularizedEventRoot F k x) atTop (𝓝 (Real.sqrt (F x))) := by
have ht : Tendsto (fun k : ℕ => 1/((k:ℝ)+1) + F x) atTop (𝓝 (F x)) := by
simpa only [zero_add] using tendsto_one_div_add_atTop_nhds_zero_nat.add_const (F x)
exact Real.continuous_sqrt.continuousAt.tendsto.comp ht
theorem likelihood_log_fifth_nonneg {u : ℝ} (hu : 0 ≤ u) (hu1 : u ≤ 1) :
0 ≤ u * (1-Real.log u)^5 := by
have := Real.log_nonpos hu hu1
exact mul_nonneg hu (pow_nonneg (by linarith) 5)
theorem likelihood_log_fifth_bounded {u : ℝ} (hu : 0 ≤ u) (hu1 : u ≤ 1) :
u * (1-Real.log u)^5 ≤ 1+120*Real.exp 1 := by
have hh := likelihood_log_fifth_majorant hu hu1 (p := 1) (by norm_num) le_rfl
simp only [Real.log_one, sub_zero, one_pow, mul_one] at hh
linarith
theorem likelihood_gradient_zero {n : ℕ} {F : Configuration n → ℝ} {K : ℝ}
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
{x : Configuration n} (hzero : F x = 0) (i : Fin n) (a : Fin 3) :
fderiv ℝ F x (coordinateDirection i a) = 0 := by
have hh := (coordinate_square_le_sum
(fun i a => fderiv ℝ F x (coordinateDirection i a)) i a).trans (hgrad x)
rw [hzero] at hh
nlinarith [sq_nonneg (fderiv ℝ F x (coordinateDirection i a))]
theorem regularizedEventRoot_contDiff {n : ℕ} {F : Configuration n → ℝ}
(hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x) (k : ℕ) :
ContDiff ℝ ∞ (regularizedEventRoot F k) :=
(contDiff_const.add hF).sqrt (fun x =>
(add_pos_of_pos_of_nonneg (by positivity) (hF0 x)).ne')
theorem regularizedEventRoot_bound {n : ℕ} {F : Configuration n → ℝ}
(hF1 : ∀ x, F x ≤ 1) (k : ℕ) (x : Configuration n) :
|regularizedEventRoot F k x| ≤ Real.sqrt 2 := by
rw [regularizedEventRoot, abs_of_nonneg (Real.sqrt_nonneg _)]
apply Real.sqrt_le_sqrt
have hh : 1/((k:ℝ)+1) ≤ 1 := by
apply (div_le_one (by positivity)).mpr
have := Nat.cast_nonneg (α := ℝ) k
linarith
linarith [hF1 x]
theorem regularizedEventRoot_derivative_bound {n : ℕ} {F : Configuration n → ℝ}
{K : ℝ} (hK : 0 ≤ K) (hF : ContDiff ℝ ∞ F)
(hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
(k : ℕ) (i : Fin n) (a : Fin 3) (x : Configuration n) :
|fderiv ℝ (regularizedEventRoot F k) x (coordinateDirection i a)| ≤
Real.sqrt (K/4*(1+120*Real.exp 1)) := by
rw [regularizedEventRoot_derivative hF hF0]
apply Real.abs_le_sqrt
apply (coordinate_square_le_sum
(fun i a => fderiv ℝ F x (coordinateDirection i a) /
(2*regularizedEventRoot F k x)) i a).trans
calc
_ ≤ K/4 * F x * (1-Real.log (F x))^5 :=
root_gradient_square_bound hK hF0 hF1 hgrad (by positivity) x
_ ≤ K/4*(1+120*Real.exp 1) := by
rw [mul_assoc]
exact mul_le_mul_of_nonneg_left (likelihood_log_fifth_bounded (hF0 x) (hF1 x))
(div_nonneg hK (by norm_num))
theorem regularizedEventRoot_derivative_tendsto {n : ℕ} {F : Configuration n → ℝ}
{K : ℝ} (hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
(i : Fin n) (a : Fin 3) (x : Configuration n) :
Tendsto (fun k => fderiv ℝ (regularizedEventRoot F k) x (coordinateDirection i a))
atTop (𝓝 (eventRootDerivative F i a x)) := by
simp_rw [regularizedEventRoot_derivative hF hF0]
unfold eventRootDerivative
by_cases hz : F x = 0
· simp_rw [likelihood_gradient_zero hgrad hz i a, zero_div]
exact tendsto_const_nhds
· exact tendsto_const_nhds.div (tendsto_const_nhds.mul (regularizedEventRoot_tendsto F x))
(mul_ne_zero (by norm_num) (Real.sqrt_ne_zero'.mpr (lt_of_le_of_ne (hF0 x) (Ne.symm hz))))
theorem eventRootDerivative_measurable {n : ℕ} {F : Configuration n → ℝ}
(hF : ContDiff ℝ ∞ F) (i : Fin n) (a : Fin 3) :
Measurable (eventRootDerivative F i a) :=
(((hF.continuous_fderiv (by simp)).clm_apply continuous_const).measurable).div
(measurable_const.mul (Real.continuous_sqrt.comp hF.continuous).measurable)
theorem eventRootDerivative_bound {n : ℕ} {F : Configuration n → ℝ}
{K : ℝ} (hK : 0 ≤ K) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
(i : Fin n) (a : Fin 3) (x : Configuration n) :
|eventRootDerivative F i a x| ≤ Real.sqrt (K/4*(1+120*Real.exp 1)) := by
apply Real.abs_le_sqrt
apply (coordinate_square_le_sum (fun i a => eventRootDerivative F i a x) i a).trans
exact (eventRootDerivative_gradient_bound hK hF0 hF1 hgrad x).trans (by
rw [mul_assoc]
exact mul_le_mul_of_nonneg_left (likelihood_log_fifth_bounded (hF0 x) (hF1 x))
(div_nonneg hK (by norm_num)))
theorem FormDomain.eventRoot {n : ℕ} {ψ : Wavefunction n} {g : Gradient n}
(hd : FormDomain ψ g) {F : Configuration n → ℝ} {K : ℝ}
(hK : 0 ≤ K) (hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hsym : ∀ (p : Equiv.Perm (Fin n)) x, F (x ∘ p) = F x)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5) :
FormDomain (multiplyWavefunction (fun x => Real.sqrt (F x)) ψ)
(explicitMultiplyGradient (fun x => Real.sqrt (F x)) (eventRootDerivative F) ψ g) := by
apply hd.multiply_limit (θk := regularizedEventRoot F)
(Real.continuous_sqrt.comp hF.continuous) (fun p x => by dsimp only [Function.comp_apply]; rw [hsym p x])
(fun i a => (eventRootDerivative_measurable hF i a).aestronglyMeasurable)
(regularizedEventRoot_contDiff hF hF0)
⟨Real.sqrt 2, regularizedEventRoot_bound hF1⟩
(fun i a => ⟨_, fun k x => regularizedEventRoot_derivative_bound hK hF hF0 hF1 hgrad k i a x⟩)
(regularizedEventRoot_tendsto F)
(regularizedEventRoot_derivative_tendsto hF hF0 hgrad)
theorem likelihood_smoothMultiplier {n : ℕ} {F : Configuration n → ℝ} {K : ℝ}
(hK : 0 ≤ K) (hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hsym : ∀ (p : Equiv.Perm (Fin n)) x, F (x ∘ p) = F x)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5) : SmoothMultiplier F := by
refine ⟨hF, hsym, ⟨1, fun x => by rw [abs_of_nonneg (hF0 x)]; exact hF1 x⟩, ?_⟩
intro i a
refine ⟨Real.sqrt (K*(1+120*Real.exp 1)), fun x => Real.abs_le_sqrt ?_⟩
apply (coordinate_square_le_sum (fun i a => fderiv ℝ F x (coordinateDirection i a)) i a).trans
apply (hgrad x).trans
calc
K * F x^2 * (1-Real.log (F x))^5 = K * F x * (F x * (1-Real.log (F x))^5) := by ring
_ ≤ K * 1 * (1+120*Real.exp 1) :=
mul_le_mul (mul_le_mul_of_nonneg_left (hF1 x) hK)
(likelihood_log_fifth_bounded (hF0 x) (hF1 x))
(likelihood_log_fifth_nonneg (hF0 x) (hF1 x)) (by positivity)
_ = _ := by ring
theorem eventRoot_square_derivative {n : ℕ} {F : Configuration n → ℝ} {K : ℝ}
(hF0 : ∀ x, 0 ≤ F x)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
(i : Fin n) (a : Fin 3) (x : Configuration n) :
fderiv ℝ (fun y => (Real.sqrt (F y))^2) x (coordinateDirection i a) =
2*Real.sqrt (F x)*eventRootDerivative F i a x := by
simp_rw [Real.sq_sqrt (hF0 _)]
unfold eventRootDerivative
by_cases hz : F x = 0
· rw [likelihood_gradient_zero hgrad hz i a]; simp
· field_simp [Real.sqrt_ne_zero'.mpr (lt_of_le_of_ne (hF0 x) (Ne.symm hz))]
theorem stateWeighted_integrable {n : ℕ} {ψ : Wavefunction n} {g : Gradient n}
(hd : FormDomain ψ g) {F : Configuration n → ℝ} (hF : Measurable F)
{C : ℝ} (hFb : ∀ x, |F x| ≤ C) (σ : Spins n) :
Integrable (fun x => F x * ‖ψ σ x‖^2) :=
(hd.2.2.1 σ).norm.integrable_sq.bdd_mul hF.aestronglyMeasurable
(Eventually.of_forall fun x => by simpa only [Real.norm_eq_abs] using hFb x)
theorem stateWeightedIntegral_le_one {n : ℕ} {ψ : Wavefunction n} {g : Gradient n}
(hd : FormDomain ψ g) (hn : normSquared ψ = 1)
{F : Configuration n → ℝ} (hF : Measurable F)
(hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1) : stateWeightedIntegral ψ F ≤ 1 := by
rw [← hn]
apply Finset.sum_le_sum
intro σ _
apply integral_mono (stateWeighted_integrable hd hF (C := 1)
(fun x => by rw [abs_of_nonneg (hF0 x)]; exact hF1 x) σ) (hd.2.2.1 σ).norm.integrable_sq
intro x
exact mul_le_of_le_one_left (sq_nonneg _) (hF1 x)
theorem stateWeightedIntegral_log_fifth {n : ℕ} {ψ : Wavefunction n} {g : Gradient n}
(hd : FormDomain ψ g) (hn : normSquared ψ = 1)
{F : Configuration n → ℝ} (hF : Measurable F)
(hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hp : 0 < stateWeightedIntegral ψ F) :
stateWeightedIntegral ψ (fun x => F x*(1-Real.log (F x))^5) ≤
(1+120*Real.exp 1)*stateWeightedIntegral ψ F*
(1-Real.log (stateWeightedIntegral ψ F))^5 := by
let p := stateWeightedIntegral ψ F
have hp1 : p ≤ 1 := stateWeightedIntegral_le_one hd hn hF hF0 hF1
have hfi (σ : Spins n) := stateWeighted_integrable hd hF (C := 1)
(fun x => by rw [abs_of_nonneg (hF0 x)]; exact hF1 x) σ
have hli (σ : Spins n) := stateWeighted_integrable hd
(F := fun x => F x*(1-Real.log (F x))^5)
(hF.mul ((measurable_const.sub hF.log).pow_const 5))
(C := 1+120*Real.exp 1)
(fun x => by rw [abs_of_nonneg (likelihood_log_fifth_nonneg (hF0 x) (hF1 x))]
exact likelihood_log_fifth_bounded (hF0 x) (hF1 x)) σ
have hh (σ : Spins n) :
(∫ x, (F x*(1-Real.log (F x))^5)*‖ψ σ x‖^2) ≤
((∫ x, F x*‖ψ σ x‖^2) + 120*Real.exp 1*p*(∫ x, ‖ψ σ x‖^2))*
(1-Real.log p)^5 := by
calc
_ ≤ ∫ x, ((F x+120*Real.exp 1*p)*‖ψ σ x‖^2)*(1-Real.log p)^5 := by
apply integral_mono (hli σ)
(((hfi σ).add ((hd.2.2.1 σ).norm.integrable_sq.const_mul (120*Real.exp 1*p))).mul_const ((1-Real.log p)^5) |>.congr
(Eventually.of_forall fun x => by dsimp only [Pi.add_apply]; ring))
intro x
have ht := mul_le_mul_of_nonneg_right
(likelihood_log_fifth_majorant (hF0 x) (hF1 x) hp hp1) (sq_nonneg ‖ψ σ x‖)
nlinarith only [ht]
_ = _ := by
rw [integral_mul_const]
congr 1
simp_rw [add_mul]
rw [integral_add (hfi σ) ((hd.2.2.1 σ).norm.integrable_sq.const_mul (120*Real.exp 1*p)),
integral_const_mul]
have hs := Finset.sum_le_sum (fun σ (_ : σ ∈ (Finset.univ : Finset (Spins n))) => hh σ)
simp only [← Finset.sum_mul, Finset.sum_add_distrib, ← Finset.mul_sum] at hs
change stateWeightedIntegral ψ (fun x => F x*(1-Real.log (F x))^5) ≤
(p+120*Real.exp 1*p*normSquared ψ)*(1-Real.log p)^5 at hs
rw [hn] at hs
convert hs using 1
dsimp only [p]
ring
theorem explicitLocalizationError_eventRoot_le {n : ℕ}
{ψ : Wavefunction n} {g : Gradient n} (hd : FormDomain ψ g)
(hn : normSquared ψ = 1) {F : Configuration n → ℝ} {K : ℝ}
(hK : 0 ≤ K) (hF : ContDiff ℝ ∞ F) (hF0 : ∀ x, 0 ≤ F x) (hF1 : ∀ x, F x ≤ 1)
(hgrad : ∀ x, (∑ i, ∑ a, (fderiv ℝ F x (coordinateDirection i a))^2) ≤
K * (F x)^2 * (1-Real.log (F x))^5)
(hp : 0 < stateWeightedIntegral ψ F) :
explicitLocalizationError ψ (eventRootDerivative F) ≤
K/8*(1+120*Real.exp 1)*stateWeightedIntegral ψ F*
(1-Real.log (stateWeightedIntegral ψ F))^5 := by
have hdi (σ : Spins n) (i : Fin n) (a : Fin 3) :
Integrable (fun x => (eventRootDerivative F i a x)^2*‖ψ σ x‖^2) := by
have hl := memLp_bounded_measurable_real_smul (hd.2.2.1 σ)
(eventRootDerivative_measurable hF i a).aestronglyMeasurable
⟨_, eventRootDerivative_bound hK hF0 hF1 hgrad i a⟩
simpa only [norm_smul, Real.norm_eq_abs, mul_pow, sq_abs] using hl.norm.integrable_sq
have hli (σ : Spins n) := stateWeighted_integrable hd
(F := fun x => F x*(1-Real.log (F x))^5)
(hF.continuous.measurable.mul ((measurable_const.sub hF.continuous.measurable.log).pow_const 5))
(C := 1+120*Real.exp 1)
(fun x => by rw [abs_of_nonneg (likelihood_log_fifth_nonneg (hF0 x) (hF1 x))]
exact likelihood_log_fifth_bounded (hF0 x) (hF1 x)) σ
have hs (σ : Spins n) :
(∑ i, ∑ a, ∫ x, (eventRootDerivative F i a x)^2*‖ψ σ x‖^2) ≤
K/4 * ∫ x, (F x*(1-Real.log (F x))^5)*‖ψ σ x‖^2 := by
calc
_ = ∫ x, (∑ i, ∑ a, (eventRootDerivative F i a x)^2)*‖ψ σ x‖^2 := by
simp_rw [Finset.sum_mul]
rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _ (fun a _ => hdi σ i a))]
apply Finset.sum_congr rfl
intro i _
exact (integral_finsetSum _ (fun a _ => hdi σ i a)).symm
_ ≤ ∫ x, K/4*((F x*(1-Real.log (F x))^5)*‖ψ σ x‖^2) := by
apply integral_mono
· simpa only [Finset.sum_mul] using
integrable_finsetSum _ (fun i _ => integrable_finsetSum _ (fun a _ => hdi σ i a))
· exact (hli σ).const_mul _
· intro x
have hh := mul_le_mul_of_nonneg_right
(eventRootDerivative_gradient_bound hK hF0 hF1 hgrad x) (sq_nonneg ‖ψ σ x‖)
nlinarith only [hh]
_ = _ := integral_const_mul _ _
have hh := mul_le_mul_of_nonneg_left (Finset.sum_le_sum
(fun σ (_ : σ ∈ (Finset.univ : Finset (Spins n))) => hs σ)) (by norm_num : (0:ℝ) ≤ 1/2)
simp only [← Finset.mul_sum] at hh
change explicitLocalizationError ψ (eventRootDerivative F) ≤
(1/2)*(K/4*stateWeightedIntegral ψ (fun x => F x*(1-Real.log (F x))^5)) at hh
apply hh.trans
have hlog := mul_le_mul_of_nonneg_left
(stateWeightedIntegral_log_fifth hd hn hF.continuous.measurable hF0 hF1 hp)
(div_nonneg hK (by norm_num : (0:ℝ) ≤ 8))
nlinarith only [hlog]
end NeutralAtom
end
end
end
end OAI

Xet Storage Details

Size:
24.5 kB
·
Xet hash:
31402988b52338d015af2a880d99ffb69bb6633286b23d8fb0f81d25bbc73b25

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.