introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
32.8 kB
import Mathlib
import OAI.Probability.SKFluctuations.CumulativeIncrements
namespace OAI
/-! Chain. -/
noncomputable section
open MeasureTheory ProbabilityTheory Filter
open scoped BigOperators Topology
open MeasureTheory Filter Set
open scoped Topology
open MeasureTheory ProbabilityTheory Filter Set
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
theorem ExpClose.chain (p : β„• β†’ ℝ) (E : β„• β†’ ℝ) (N : β„•) (hp : 0 ≀ p 0)
(hE : βˆ€ j < N, ExpClose (E j) (p j) (p (j+1))) :
ExpClose (βˆ‘ j ∈ Finset.range N, E j) (p 0) (p N) := by
induction N with
| zero => simpa only [Finset.range_zero,Finset.sum_empty] using ExpClose.refl hp
| succ N ih =>
simpa only [Finset.sum_range_succ] using
(ih (fun j hj => hE j (Nat.lt_succ_of_lt hj))).trans (hE N (Nat.lt_succ_self _))
variable {S : Type*} {as : List PositiveMass}
variable [Fintype S] [Nonempty S] {n : β„•}
theorem ClockTree.cumulative_lowering_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (T : ClockTree S as)
(ho : MassOrdered 0 as) (D M : Fin (n+1) β†’ ℝ)
(hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(l : Fin (n+1) β†’ ℝ) (q r : β„• β†’ Fin (n+1) β†’ ℝ)
(hq : βˆ€ i, Monotone (fun j => q j i)) (hr : βˆ€ i, Monotone (fun j => r j i))
(hql : βˆ€ i, l i ≀ q 0 i) (hrl : βˆ€ i, l i ≀ r 0 i)
(hM : βˆ€ i, 0 ≀ M i) (hm : βˆ€ i j, j < as.length β†’ |q j i-r j i| ≀ M i)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose ((7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2)
(T.weight w Ο† (cumulativeIncrements l q) Οƒ x)
(T.weight w Ο† (cumulativeIncrements l (loweredBoundary (as.length-1) q r)) Οƒ x) := by
let K : ℝ := βˆ‘ i, M i*(D i)^2
have hK : 0 ≀ K := Finset.sum_nonneg fun i _ => mul_nonneg (hM i) (sq_nonneg _)
let E := fun j => (7*(T.leaves:ℝ)*massGap as j+8*(T.leaves:ℝ)*(T.leaves+1:ℝ)*T.forksAt (j+1))*K
have hstep (j : β„•) (hj : j < as.length-1) :
ExpClose (E j) (T.weight w Ο† (cumulativeIncrements l (loweredBoundary j q r)) Οƒ x)
(T.weight w Ο† (cumulativeIncrements l (loweredBoundary (j+1) q r)) Οƒ x) := by
have hh := T.cumulative_boundary_close_at hw Ο† ho j (by omega) D hD hB l (loweredBoundary j q r)
(fun i => min (q j i) (r j i)) (loweredBoundary_previous hq hr hql hrl j)
(fun i => by simp only [loweredBoundary,lt_self_iff_false,ite_false]; exact min_le_left _ _)
(fun i => loweredBoundary_mono hq hr j i (Nat.le_succ j)) Οƒ x
rw [←loweredBoundary_update] at hh
apply hh.mono
apply mul_le_mul_of_nonneg_left _ (by
have hg := massGap_nonneg as j
positivity)
exact Finset.sum_le_sum fun i _ => mul_le_mul_of_nonneg_right
((loweredBoundary_difference j i).trans (hm i j (by omega))) (sq_nonneg _)
have hh := ExpClose.chain
(fun j => T.weight w Ο† (cumulativeIncrements l (loweredBoundary j q r)) Οƒ x)
E (as.length-1) ((T.weight_probability hw Ο† ho _ x).1 Οƒ) hstep
rw [loweredBoundary_zero] at hh
apply hh.mono
have hg := massGap_sum_prefix_le_one ho (as.length-1) (by omega)
have hf := T.forks_sum_shift_le (as.length-1) (by omega)
have hgm := mul_le_mul_of_nonneg_left hg (show 0 ≀ 7*(T.leaves:ℝ) by positivity)
have hfm := mul_le_mul_of_nonneg_left hf (show 0 ≀ 8*(T.leaves:ℝ)*(T.leaves+1:ℝ) by positivity)
dsimp only [E]
rw [←Finset.sum_mul,Finset.sum_add_distrib,←Finset.mul_sum,←Finset.mul_sum]
apply mul_le_mul_of_nonneg_right _ hK
nlinarith
theorem ClockTree.cumulative_uniform_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (T : ClockTree S as)
(ho : MassOrdered 0 as) (D M : Fin (n+1) β†’ ℝ)
(hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(l : Fin (n+1) β†’ ℝ) (q r : β„• β†’ Fin (n+1) β†’ ℝ)
(hq : βˆ€ i, Monotone (fun j => q j i)) (hr : βˆ€ i, Monotone (fun j => r j i))
(hql : βˆ€ i, l i ≀ q 0 i) (hrl : βˆ€ i, l i ≀ r 0 i)
(hend : q (as.length-1) = r (as.length-1))
(hM : βˆ€ i, 0 ≀ M i) (hm : βˆ€ i j, j < as.length β†’ |q j i-r j i| ≀ M i)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose (2*(7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2)
(T.weight w Ο† (cumulativeIncrements l q) Οƒ x) (T.weight w Ο† (cumulativeIncrements l r) Οƒ x) := by
have hQ := T.cumulative_lowering_close hw Ο† ho D M hD hB l q r hq hr hql hrl hM hm Οƒ x
have hR := T.cumulative_lowering_close hw Ο† ho D M hD hB l r q hr hq hrl hql hM
(fun i j hj => by rw [abs_sub_comm]; exact hm i j hj) Οƒ x
have he (Οƒ : T.Assignment) :
T.weight w Ο† (cumulativeIncrements l (loweredBoundary (as.length-1) q r)) Οƒ x =
T.weight w Ο† (cumulativeIncrements l (loweredBoundary (as.length-1) r q)) Οƒ x := by
apply T.cumulative_weight_congr w Ο† l _ Οƒ x
intro k hk
funext i
by_cases hkl : k < as.length-1
Β· simp only [loweredBoundary,hkl,ite_true,min_comm]
Β· have hek : k=as.length-1 := by omega
subst k
simp only [loweredBoundary,lt_self_iff_false,ite_false]
exact congrFun hend i
rw [he Οƒ] at hQ
convert hQ.trans hR.symm using 1
ring
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
variable {ΞΉ S : Type*} [Fintype ΞΉ] [Fintype S] [Nonempty S] {n : β„•}
theorem ReplicaTree.linearClock_mass_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (ΞΉ β†’ ℝ) β†’L[ℝ] ℝ) (L : (Fin (n+1) β†’ ℝ) β†’L[ℝ] (ΞΉ β†’ ℝ))
{steps : List (GaussianStep ΞΉ)} (R : ReplicaTree ΞΉ S steps) {a b : ℝ}
(hoa : OrderedSteps a steps) (hob : OrderedSteps b steps) {P : R.Assignment β†’ ℝ} (hp : βˆ€ Οƒ, 0 ≀ P Οƒ)
(D : Fin (n+1) β†’ ℝ) (hD : βˆ€ i, 0 ≀ D i)
(hB : βˆ€ i Οƒ, |Ο† Οƒ (L (Pi.single i 1))| ≀ D i)
(ha : 0 ≀ a) (ha1 : a ≀ 1) (hb : 0 < b) (hb1 : b ≀ 1)
{t : ℝ} (ht : 0 ≀ t) (x : ΞΉ β†’ ℝ) :
ExpClose ((|a-b| *(2*(R.leaves:ℝ)+3)*βˆ‘ i, (D i)^2)*t)
(linearClockTest L a (gaussianHierarchy w Ο† steps) (R.expect w Ο† P) t x)
(linearClockTest L b (gaussianHierarchy w Ο† steps) (R.expect w Ο† P) t x) := by
apply ExpClose.of_bounds (R.clock_nonneg hw Ο† L hoa hp t x) (R.clock_nonneg hw Ο† L hob hp t x)
let J := replicaFeatureJet hw Ο† L R hob P x
have hh := J.massSplit_exp_comparison D hD
(fun y => R.expect_nonneg hw Ο† hob hp (x+L y))
(replicaFeatureJet_G_abs_le hw Ο† L R hob P x D hB)
(replicaFeatureJet_A₁_relative_abs_le hw Ο† L R hob hp x D hD hB) ha ha1 hb hb1
(show (0:ℝ) ∈ Icc 0 t from ⟨le_rfl,ht⟩) (show t ∈ Icc 0 t from ⟨ht,le_rfl⟩) 0
rw [J.massSplit_zero,J.massSplit_terminal,sub_zero,abs_of_nonneg ht] at hh
have hF := (gaussianHierarchy_regular hw Ο† steps hob 0).1.choose_spec.continuous
have hA := (R.expect_smooth hw Ο† hob P 0).continuous
simpa only [J,replicaFeatureJet_F,replicaFeatureJet_A,← linearClockTest_eq L hF hA,neg_mul] using hh
theorem ClockTree.atomicHead_mass_close_nonneg {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) {as : List PositiveMass} (T : ClockTree S as)
{a b : ℝ} (hoa : MassOrdered a as) (hob : MassOrdered b as)
(ha : 0 ≀ a) (ha1 : a ≀ 1) (hb : 0 < b) (hb1 : b ≀ 1)
(D : Fin (n+1) β†’ ℝ) (hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(q : β„• β†’ Fin (n+1) β†’ ℝβ‰₯0) (v : Fin (n+1) β†’ ℝβ‰₯0) (Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose (|a-b| *(2*(T.leaves:ℝ)+3)*βˆ‘ i, (v i:ℝ)*(D i)^2)
(T.atomicHead w Ο† q v a Οƒ x) (T.atomicHead w Ο† q v b Οƒ x) := by
classical
have hd (i : Fin (n+1)) (Οƒ : S) : |Ο† Οƒ (diagonalDriver v (Pi.single i 1))| ≀ Real.sqrt (v i)*D i := by
rw [diagonalDriver_single,map_smul,smul_eq_mul,abs_mul,abs_of_nonneg (Real.sqrt_nonneg _)]
exact mul_le_mul_of_nonneg_left (hB i Οƒ) (Real.sqrt_nonneg _)
have hh := (T.realize q).linearClock_mass_close hw Ο† (diagonalDriver v)
(clockSteps_ordered hoa q) (clockSteps_ordered hob q)
(P := fun Ο„ => if Ο„ = T.assignmentEquiv q Οƒ then 1 else 0)
(by intro Ο„; split_ifs <;> norm_num) (fun i => Real.sqrt (v i)*D i)
(fun i => mul_nonneg (Real.sqrt_nonneg _) (hD i)) hd ha ha1 hb hb1
(by norm_num : (0:ℝ) ≀ 1) x
rw [T.atomicHead_eq_clock,T.atomicHead_eq_clock]
simpa only [ReplicaTree.atomicClock,mul_one,mul_pow,Real.sq_sqrt (v _).coe_nonneg,ClockTree.realize_leaves] using hh
theorem ClockTree.atomicHead_root_transfer_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) {b : PositiveMass} {bs : List PositiveMass}
(T : ClockTree S (b::bs)) (ho : MassOrdered b.val bs)
(D : Fin (n+1) β†’ ℝ) (hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(q : β„• β†’ Fin (n+1) β†’ ℝβ‰₯0) (v : Fin (n+1) β†’ ℝβ‰₯0) (Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose ((b.val*(2*(T.leaves:ℝ)+3)+8*(T.leaves:ℝ)*(T.leaves+1:ℝ)*T.rootForks)*
βˆ‘ i, (v i:ℝ)*(D i)^2)
(T.atomicHead w Ο† q v 0 Οƒ x) (T.weight w Ο† (addHeadClock q v) Οƒ x) := by
have hb1 : b.val ≀ 1 := (massOrdered_bounds ho).2
have h₁ := T.atomicHead_mass_close_nonneg hw Ο† ⟨le_rfl,b.property.le,ho⟩ ⟨b.property.le,le_rfl,ho⟩
le_rfl (by norm_num) b.property hb1 D hD hB q v Οƒ x
have hβ‚‚ := T.atomicHead_crossing_close hw Ο† rfl ho D hD hB q v Οƒ x
simp only [zero_sub,abs_neg,abs_of_pos b.property] at h₁
convert h₁.trans hβ‚‚ using 1
ring
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
theorem ExpClose.integral {Ξ© : Type*} [MeasurableSpace Ξ©] {ΞΌ : Measure Ξ©}
{c : ℝ} {p q : Ξ© β†’ ℝ} (hp : Integrable p ΞΌ) (hq : Integrable q ΞΌ)
(h : βˆ€ x, ExpClose c (p x) (q x)) : ExpClose c (∫ x, p x βˆ‚ΞΌ) (∫ x, q x βˆ‚ΞΌ) := by
refine ⟨integral_nonneg fun x => (h x).left_nonneg,integral_nonneg fun x => (h x).right_nonneg,?_,?_⟩
Β· calc
_ ≀ ∫ x, Real.exp c*q x βˆ‚ΞΌ := integral_mono hp (hq.const_mul _) fun x => (h x).le_mul
_ = _ := integral_const_mul _ _
Β· calc
_ ≀ ∫ x, Real.exp c*p x βˆ‚ΞΌ := integral_mono hq (hp.const_mul _) fun x => (h x).rev_le_mul
_ = _ := integral_const_mul _ _
variable {S : Type*} [Fintype S] [Nonempty S] {n : β„•} {as : List PositiveMass}
omit [Nonempty S] in
theorem ClockTree.expect_close (w : S β†’ ℝ) (Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ)
(T : ClockTree S as) (q r : β„• β†’ Fin (n+1) β†’ ℝβ‰₯0) (P : T.Assignment β†’ ℝ)
(hP : βˆ€ Οƒ, 0 ≀ P Οƒ) {C : ℝ} (x : Fin (n+1) β†’ ℝ)
(h : βˆ€ Οƒ, ExpClose C (T.weight w Ο† q Οƒ x) (T.weight w Ο† r Οƒ x)) :
ExpClose C (T.expect w Ο† q P x) (T.expect w Ο† r P x) := by
unfold ClockTree.expect
apply ExpClose.finset_sum
intro Οƒ _
simpa only [add_zero] using (h Οƒ).mul (ExpClose.refl (hP Οƒ))
theorem ClockTree.root_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (T : ClockTree S as) (ho : MassOrdered 0 as)
(q r : β„• β†’ Fin (n+1) β†’ ℝβ‰₯0) (v : Fin (n+1) β†’ ℝβ‰₯0) {C : ℝ}
(h : βˆ€ Οƒ x, ExpClose C (T.weight w Ο† q Οƒ x) (T.weight w Ο† r Οƒ x))
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose C (T.atomicHead w Ο† q v 0 Οƒ x) (T.atomicHead w Ο† r v 0 Οƒ x) := by
simp only [ClockTree.atomicHead,shiftedMean_zero,zeroContinuation]
exact ExpClose.integral ((T.weight_smooth hw Ο† ho q Οƒ 0).integrable_zero_shift x)
((T.weight_smooth hw Ο† ho r Οƒ 0).integrable_zero_shift x) (fun z => h Οƒ (x+z))
theorem ClockTree.cumulative_uniform_expect_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (T : ClockTree S as)
(ho : MassOrdered 0 as) (D M : Fin (n+1) β†’ ℝ)
(hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(l : Fin (n+1) β†’ ℝ) (q r : β„• β†’ Fin (n+1) β†’ ℝ)
(hq : βˆ€ i, Monotone (fun j => q j i)) (hr : βˆ€ i, Monotone (fun j => r j i))
(hql : βˆ€ i, l i ≀ q 0 i) (hrl : βˆ€ i, l i ≀ r 0 i)
(hend : q (as.length-1) = r (as.length-1))
(hM : βˆ€ i, 0 ≀ M i) (hm : βˆ€ i j, j < as.length β†’ |q j i-r j i| ≀ M i)
(P : T.Assignment β†’ ℝ) (hP : βˆ€ Οƒ, 0 ≀ P Οƒ) (x : Fin (n+1) β†’ ℝ) :
ExpClose (2*(7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2)
(T.expect w Ο† (cumulativeIncrements l q) P x) (T.expect w Ο† (cumulativeIncrements l r) P x) :=
T.expect_close w Ο† _ _ P hP x (fun Οƒ => T.cumulative_uniform_close hw Ο† ho D M hD hB l q r
hq hr hql hrl hend hM hm Οƒ x)
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
theorem ExpClose.limit_cost {Ξ± : Type*} {l : Filter Ξ±} [NeBot l]
{c : Ξ± β†’ ℝ} {C p q : ℝ} (hc : Tendsto c l (𝓝 C))
(h : βˆ€αΆ  a in l, ExpClose (c a) p q) : ExpClose C p q := by
obtain ⟨a,ha⟩ := h.exists
refine ⟨ha.left_nonneg,ha.right_nonneg,?_,?_⟩
Β· exact ge_of_tendsto (((Real.continuous_exp.tendsto C).comp hc).mul_const q) (h.mono fun _ hs => hs.le_mul)
Β· exact ge_of_tendsto (((Real.continuous_exp.tendsto C).comp hc).mul_const p) (h.mono fun _ hs => hs.rev_le_mul)
theorem MassOrdered.exists_positive_lower {as : List PositiveMass} (ho : MassOrdered 0 as) :
βˆƒ Ξ΄ : ℝ, 0 < Ξ΄ ∧ βˆ€ e : ℝ, 0 ≀ e β†’ e ≀ Ξ΄ β†’ MassOrdered e as := by
cases as with
| nil => exact ⟨1,by norm_num,fun _ he he1 => ⟨he,he1⟩⟩
| cons a as => exact ⟨a.val,a.property,fun _ he hea => ⟨he,hea,ho.2.2⟩⟩
variable {S : Type*} [Fintype S] [Nonempty S] {n : β„•} {as : List PositiveMass}
def ClockTree.rootWeight (w : S β†’ ℝ) (Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ)
(T : ClockTree S as) (l : Fin (n+1) β†’ ℝ) (q : β„• β†’ Fin (n+1) β†’ ℝ)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) : ℝ :=
T.atomicHead w Ο† (cumulativeIncrements (q 0) (fun k => q (k+1)))
(fun i => Real.toNNReal (q 0 i-l i)) 0 Οƒ x
theorem ClockTree.rootCumulative_uniform_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (T : ClockTree S as)
(ho : MassOrdered 0 as) (D M : Fin (n+1) β†’ ℝ)
(hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(l : Fin (n+1) β†’ ℝ) (q r : β„• β†’ Fin (n+1) β†’ ℝ)
(hq : βˆ€ i, Monotone (fun j => q j i)) (hr : βˆ€ i, Monotone (fun j => r j i))
(hql : βˆ€ i, l i ≀ q 0 i) (hrl : βˆ€ i, l i ≀ r 0 i)
(hend : q as.length = r as.length)
(hM : βˆ€ i, 0 ≀ M i) (hm : βˆ€ i j, j ≀ as.length β†’ |q j i-r j i| ≀ M i)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose (2*(7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2)
(T.rootWeight w Ο† l q Οƒ x) (T.rootWeight w Ο† l r Οƒ x) := by
let C := 2*(7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2
let Kq := (2*(T.leaves:ℝ)+3)*βˆ‘ i, (Real.toNNReal (q 0 i-l i):ℝ)*(D i)^2
let Kr := (2*(T.leaves:ℝ)+3)*βˆ‘ i, (Real.toNNReal (r 0 i-l i):ℝ)*(D i)^2
obtain ⟨δ,hδ,hd⟩ := ho.exists_positive_lower
have hc : Continuous (fun e : ℝ => (e*Kq+C)+e*Kr) := by fun_prop
apply ExpClose.limit_cost (l := 𝓝[>] (0:ℝ))
(c := fun e => (e*Kq+C)+e*Kr)
(by simpa only [zero_mul,zero_add,add_zero] using
((hc.tendsto (0:ℝ)).mono_left nhdsWithin_le_nhds))
filter_upwards [self_mem_nhdsWithin,
(Iio_mem_nhds hΞ΄ : Iio Ξ΄ ∈ 𝓝 (0:ℝ)) |> mem_nhdsWithin_of_mem_nhds] with e he heΞ΄
have hep : 0 < e := he
have hoe := hd e hep.le heΞ΄.le
have he1 := (massOrdered_bounds hoe).2
let a : PositiveMass := ⟨e,hep⟩
have hQ := T.atomicHead_mass_close_nonneg hw Ο† ho hoe le_rfl (by norm_num) hep he1 D hD hB
(cumulativeIncrements (q 0) (fun k => q (k+1))) (fun i => Real.toNNReal (q 0 i-l i)) Οƒ x
have hR := T.atomicHead_mass_close_nonneg hw Ο† ho hoe le_rfl (by norm_num) hep he1 D hD hB
(cumulativeIncrements (r 0) (fun k => r (k+1))) (fun i => Real.toNNReal (r 0 i-l i)) Οƒ x
have hE := (T.step a).cumulative_uniform_close hw Ο† ⟨le_rfl,hep.le,hoe⟩ D M hD hB l q r
hq hr hql hrl (by simpa only [List.length_cons,Nat.add_sub_cancel] using hend) hM
(fun i j hj => hm i j (by simpa only [List.length_cons,Nat.lt_add_one_iff] using hj)) Οƒ x
simp only [ClockTree.weight_step,cumulativeIncrements_shift,ClockTree.leaves] at hE
change ExpClose C (T.atomicHead w Ο† _ _ e Οƒ x) (T.atomicHead w Ο† _ _ e Οƒ x) at hE
simp only [zero_sub,abs_neg,abs_of_pos hep] at hQ hR
convert (hQ.trans hE).trans hR.symm using 1 <;>
dsimp only [Kq,Kr,ClockTree.rootWeight]
ring
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] {Ξ½ : Measure E}
omit [NormedSpace ℝ E] [BorelSpace E] in
theorem shiftedMean_add_const (F A : E β†’ ℝ) (m c : ℝ) (x : E) :
shiftedMean Ξ½ m (fun y => F y+c) A x = shiftedMean Ξ½ m F A x := by
simp only [shiftedMean,tiltedMean,mul_add,Real.exp_add,← mul_assoc]
rw [integral_mul_const,integral_mul_const]
exact mul_div_mul_right _ _ (Real.exp_ne_zero _)
variable {ΞΉ S : Type*} [Fintype ΞΉ] [DecidableEq ΞΉ] [Fintype S] [Nonempty S]
theorem spinWeight_mass_one {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (ΞΉ β†’ ℝ) β†’L[ℝ] ℝ) (q : ΞΉ β†’ ℝβ‰₯0) (C : ΞΉ β†’ ℝ)
(hC : βˆ€ Οƒ i, (Ο† Οƒ (Pi.single i 1))^2 = C i) (Οƒ : S) (x : ΞΉ β†’ ℝ) :
shiftedMean (Measure.pi fun i => gaussianReal 0 (q i)) 1 (spinLogPartition w Ο†)
(fun y => spinWeight w Ο† y Οƒ) x = spinWeight w Ο† x Οƒ := by
have hd := exp_mul_shiftedContinuation (by norm_num : (1:ℝ) β‰  0) x
((exponentialIncrement_gaussian q).integrable_shift (lipschitzWith_spinLogPartition hw Ο†) 1 x)
rw [spinLogPartition_mass_one hw Ο† q C hC x,one_mul,Real.exp_add,spinLogPartition,
Real.exp_log (spinPartition_pos hw Ο† x)] at hd
unfold shiftedMean tiltedMean
rw [← hd]
have hn : (∫ z, spinWeight w Ο† (x+z) Οƒ*Real.exp (1*spinLogPartition w Ο† (x+z))
βˆ‚Measure.pi fun i => gaussianReal 0 (q i)) =
w Οƒ*Real.exp (Ο† Οƒ x)*Real.exp ((1/2:ℝ)*βˆ‘ i, (q i:ℝ)*C i) := by
simp only [one_mul,spinLogPartition,Real.exp_log (spinPartition_pos hw Ο† _),spinWeight,
div_mul_cancelβ‚€ _ (spinPartition_pos hw Ο† _).ne']
simp_rw [map_add,Real.exp_add]
rw [integral_const_mul,integral_const_mul,integral_exp_finiteLinear]
simp_rw [hC]
ring
rw [hn,mul_div_mul_right _ _ (Real.exp_ne_zero _)]
rfl
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
universe vC
variable {S : Type vC} {ΞΉ : Type*}
def terminalMass : PositiveMass := ⟨1,by norm_num⟩
def ClockTree.extendOne : {as : List PositiveMass} β†’ ClockTree S as β†’ ClockTree S (as++[terminalMass])
| _,.leaf => .step terminalMass .leaf
| _,.step a T => .step a T.extendOne
| _,.fork T U => .fork T.extendOne U.extendOne
noncomputable def ClockTree.extendOneEquiv : {as : List PositiveMass} β†’ (T : ClockTree S as) β†’
T.Assignment ≃ T.extendOne.Assignment
| _,.leaf => Equiv.refl S
| _,.step _ T => T.extendOneEquiv
| _,.fork T U => Equiv.prodCongr T.extendOneEquiv U.extendOneEquiv
theorem ClockTree.extendOne_leaves {as : List PositiveMass} (T : ClockTree S as) :
T.extendOne.leaves = T.leaves := by
induction T with
| leaf => rfl
| step a T ih => exact ih
| fork T U ihT ihU => exact congrArgβ‚‚ (Β·+Β·) ihT ihU
theorem MassOrdered.append_one {as : List PositiveMass} {a : ℝ} (ho : MassOrdered a as) :
MassOrdered a (as++[terminalMass]) := by
induction as generalizing a with
| nil => exact ⟨ho.1,ho.2,by norm_num [MassOrdered,terminalMass]⟩
| cons b bs ih => exact ⟨ho.1,ho.2.1,ih ho.2.2⟩
variable [Fintype ΞΉ] [DecidableEq ΞΉ] [Fintype S] [Nonempty S]
theorem ClockTree.weight_extendOne {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (ΞΉ β†’ ℝ) β†’L[ℝ] ℝ) (C : ΞΉ β†’ ℝ)
(hC : βˆ€ Οƒ i, (Ο† Οƒ (Pi.single i 1))^2 = C i)
{as : List PositiveMass} (T : ClockTree S as) {a : ℝ} (ho : MassOrdered a as)
(q : β„• β†’ ΞΉ β†’ ℝβ‰₯0) (Οƒ : T.Assignment) (x : ΞΉ β†’ ℝ) :
T.extendOne.weight w Ο† q (T.extendOneEquiv Οƒ) x = T.weight w Ο† q Οƒ x := by
induction T generalizing a q x with
| leaf => exact spinWeight_mass_one hw Ο† (q 0) C hC Οƒ x
| @step b bs T ih =>
change (T.extendOne.step b).weight w Ο† q (T.extendOneEquiv Οƒ) x = (T.step b).weight w Ο† q Οƒ x
rw [ClockTree.weight_step,ClockTree.weight_step]
have he : T.extendOne.weight w Ο† (fun j => q (j+1)) (T.extendOneEquiv Οƒ) =
T.weight w Ο† (fun j => q (j+1)) Οƒ := funext (ih ho.2.2 _ Οƒ)
rw [he,clockSteps_append]
simp only [clockSteps,Nat.add_zero,terminalMass]
have hg := gaussianHierarchy_append_mass_one hw Ο† (q (bs.length+1)) C hC
(clockSteps bs (fun j => q (j+1))) (clockSteps_ordered ho.2.2 _)
rw [show gaussianHierarchy w Ο† (clockSteps bs (fun j => q (j+1)) ++ [(1,q (bs.length+1))]) =
(fun y => gaussianHierarchy w Ο† (clockSteps bs (fun j => q (j+1))) y+
(1/2:ℝ)*βˆ‘ i, (q (bs.length+1) i:ℝ)*C i) from funext hg]
exact shiftedMean_add_const _ _ _ _ _
| fork T U ihT ihU =>
change T.extendOne.weight w Ο† q (T.extendOneEquiv Οƒ.1) x*
U.extendOne.weight w Ο† q (U.extendOneEquiv Οƒ.2) x = T.weight w Ο† q Οƒ.1 x*U.weight w Ο† q Οƒ.2 x
rw [ihT ho,ihU ho]
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
variable {S : Type*} [Fintype S] [Nonempty S] {n : β„•} {as : List PositiveMass}
omit [Nonempty S] in
theorem ClockTree.rootWeight_congr (w : S β†’ ℝ) (Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ)
(T : ClockTree S as) (l : Fin (n+1) β†’ ℝ) {q r : β„• β†’ Fin (n+1) β†’ ℝ}
(he : βˆ€ j ≀ as.length, q j = r j) (Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
T.rootWeight w Ο† l q Οƒ x = T.rootWeight w Ο† l r Οƒ x := by
simp only [ClockTree.rootWeight,ClockTree.atomicHead,shiftedMean_zero,zeroContinuation]
rw [he 0 (Nat.zero_le _)]
apply integral_congr_ae
filter_upwards [] with z
exact T.cumulative_weight_congr w Ο† (r 0) (fun j hj => he (j+1) (by omega)) Οƒ (x+z)
theorem ClockTree.rootWeight_extendOne {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (C : Fin (n+1) β†’ ℝ)
(hC : βˆ€ Οƒ i, (Ο† Οƒ (Pi.single i 1))^2 = C i)
(T : ClockTree S as) (ho : MassOrdered 0 as)
(l : Fin (n+1) β†’ ℝ) (q : β„• β†’ Fin (n+1) β†’ ℝ)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
T.extendOne.rootWeight w Ο† l q (T.extendOneEquiv Οƒ) x = T.rootWeight w Ο† l q Οƒ x := by
simp only [ClockTree.rootWeight,ClockTree.atomicHead,shiftedMean_zero,zeroContinuation]
apply integral_congr_ae
filter_upwards [] with z
exact T.weight_extendOne hw Ο† C hC ho _ Οƒ (x+z)
theorem ClockTree.rootCumulative_close {w : S β†’ ℝ} (hw : βˆ€ Οƒ, 0 < w Οƒ)
(Ο† : S β†’ (Fin (n+1) β†’ ℝ) β†’L[ℝ] ℝ) (C : Fin (n+1) β†’ ℝ)
(hC : βˆ€ Οƒ i, (Ο† Οƒ (Pi.single i 1))^2 = C i)
(T : ClockTree S as) (ho : MassOrdered 0 as) (D M : Fin (n+1) β†’ ℝ)
(hD : βˆ€ i, 0 ≀ D i) (hB : βˆ€ i Οƒ, |Ο† Οƒ (Pi.single i 1)| ≀ D i)
(l : Fin (n+1) β†’ ℝ) (q r : β„• β†’ Fin (n+1) β†’ ℝ)
(hq : βˆ€ i, Monotone (fun j => q j i)) (hr : βˆ€ i, Monotone (fun j => r j i))
(hql : βˆ€ i, l i ≀ q 0 i) (hrl : βˆ€ i, l i ≀ r 0 i)
(hM : βˆ€ i, 0 ≀ M i) (hm : βˆ€ i j, j ≀ as.length β†’ |q j i-r j i| ≀ M i)
(Οƒ : T.Assignment) (x : Fin (n+1) β†’ ℝ) :
ExpClose (2*(7*(T.leaves:ℝ)+8*(T.leaves:ℝ)^2*(T.leaves+1:ℝ))*βˆ‘ i, M i*(D i)^2)
(T.rootWeight w Ο† l q Οƒ x) (T.rootWeight w Ο† l r Οƒ x) := by
let t := fun i => max (q as.length i) (r as.length i)
let Q := extendBoundary q as.length t
let R := extendBoundary r as.length t
have hQ : βˆ€ j ≀ as.length, Q j = q j := fun j hj => extendBoundary_le _ _ _ hj
have hR : βˆ€ j ≀ as.length, R j = r j := fun j hj => extendBoundary_le _ _ _ hj
have hQT : βˆ€ j, as.length < j β†’ Q j = t := fun j hj => extendBoundary_gt _ _ _ hj
have hRT : βˆ€ j, as.length < j β†’ R j = t := fun j hj => extendBoundary_gt _ _ _ hj
have hE := T.extendOne.rootCumulative_uniform_close hw Ο† ho.append_one D M hD hB l Q R
(extendBoundary_monotone hq (fun i => le_max_left _ _))
(extendBoundary_monotone hr (fun i => le_max_right _ _))
(fun i => by rw [hQ 0 (Nat.zero_le _)]; exact hql i)
(fun i => by rw [hR 0 (Nat.zero_le _)]; exact hrl i)
(by rw [hQT _ (by simp),hRT _ (by simp)]) hM
(fun i j _ => by
by_cases hj : j ≀ as.length
Β· rw [hQ j hj,hR j hj]; exact hm i j hj
Β· rw [hQT j (lt_of_not_ge hj),hRT j (lt_of_not_ge hj),sub_self,abs_zero]; exact hM i)
(T.extendOneEquiv Οƒ) x
rw [T.rootWeight_extendOne hw Ο† C hC ho,T.rootWeight_extendOne hw Ο† C hC ho,
T.rootWeight_congr w Ο† l hQ Οƒ x,T.rootWeight_congr w Ο† l hR Οƒ x,ClockTree.extendOne_leaves] at hE
exact hE
end SKFluctuations.Hierarchy
namespace SKFluctuations.Hierarchy.ReplicaTree
open MeasureTheory ProbabilityTheory Filter Set
open scoped Topology NNReal BigOperators
variable {ΞΉ S : Type*}
@[reducible] def Slot : {steps : List (GaussianStep ΞΉ)} β†’ ReplicaTree ΞΉ S steps β†’ Type
| _, .leaf => Unit
| _, .step _ T => T.Slot
| _, .fork T U => T.Slot βŠ• U.Slot
def atSlot : {steps : List (GaussianStep ΞΉ)} β†’ (T : ReplicaTree ΞΉ S steps) β†’ T.Assignment β†’ T.Slot β†’ S
| _, .leaf => fun Οƒ _ => Οƒ
| _, .step _ T => T.atSlot
| _, .fork T U => fun Οƒ s => Sum.elim (T.atSlot Οƒ.1) (U.atSlot Οƒ.2) s
def singleSlot : (steps : List (GaussianStep ΞΉ)) β†’ (single (S := S) steps).Slot
| [] => ()
| _::tail => singleSlot tail
theorem atSlot_single (steps : List (GaussianStep ΞΉ)) (Οƒ : (single (S := S) steps).Assignment) :
(single steps).atSlot Οƒ (singleSlot steps) = singleEquiv (S := S) steps Οƒ := by
induction steps with
| nil => rfl
| cons st tail ih => exact ih Οƒ
structure MarkedPlacement {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) extends Placement T where
embed : T.Slot β†’ tree.Slot
mark : tree.Slot
restrict_at : βˆ€ Οƒ s, T.atSlot (restrict Οƒ) s = tree.atSlot Οƒ (embed s)
spin_at : βˆ€ Οƒ, spin Οƒ = tree.atSlot Οƒ mark
namespace MarkedPlacement
def fresh {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) (c : ℝ) : MarkedPlacement T where
toPlacement := Placement.fresh T c
embed := Sum.inl
mark := Sum.inr (singleSlot steps)
restrict_at := fun _ _ => rfl
spin_at := fun Οƒ => (atSlot_single steps Οƒ.2).symm
def coincide : MarkedPlacement (ReplicaTree.leaf (ΞΉ := ΞΉ) (S := S)) where
toPlacement := Placement.coincide
embed := id
mark := ()
restrict_at := fun _ _ => rfl
spin_at := fun _ => rfl
def step (st : GaussianStep ΞΉ) {tail : List (GaussianStep ΞΉ)} {T : ReplicaTree ΞΉ S tail}
(p : MarkedPlacement T) : MarkedPlacement (T.step st) where
toPlacement := p.toPlacement.step st
embed := p.embed
mark := p.mark
restrict_at := p.restrict_at
spin_at := p.spin_at
def left {steps : List (GaussianStep ΞΉ)} {T : ReplicaTree ΞΉ S steps}
(U : ReplicaTree ΞΉ S steps) (p : MarkedPlacement T) : MarkedPlacement (T.fork U) where
toPlacement := p.toPlacement.left U
embed := Sum.map p.embed id
mark := Sum.inl p.mark
restrict_at := by intro Οƒ s; cases s with
| inl s => exact p.restrict_at Οƒ.1 s
| inr s => rfl
spin_at := fun Οƒ => p.spin_at Οƒ.1
def right {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps)
{U : ReplicaTree ΞΉ S steps} (p : MarkedPlacement U) : MarkedPlacement (T.fork U) where
toPlacement := p.toPlacement.right T
embed := Sum.map id p.embed
mark := Sum.inr p.mark
restrict_at := by intro Οƒ s; cases s with
| inl s => rfl
| inr s => exact p.restrict_at Οƒ.2 s
spin_at := fun Οƒ => p.spin_at Οƒ.2
end MarkedPlacement
def markedAttach : {steps : List (GaussianStep ΞΉ)} β†’ (T : ReplicaTree ΞΉ S steps) β†’ ℝ β†’ List (MarkedPlacement T)
| _, .leaf, a => [MarkedPlacement.coincide,MarkedPlacement.fresh .leaf (a-1)]
| _, @ReplicaTree.step _ _ st tail T, a =>
MarkedPlacement.fresh (.step st T) (a-st.1) :: (T.markedAttach st.1).map (MarkedPlacement.step st)
| _, .fork T U, a => MarkedPlacement.fresh (T.fork U) (-a) ::
((T.markedAttach a).map (MarkedPlacement.left U) ++ (U.markedAttach a).map (MarkedPlacement.right T))
theorem markedAttach_forget {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) (a : ℝ) :
(T.markedAttach a).map MarkedPlacement.toPlacement = T.attach a := by
induction T generalizing a with
| leaf => rfl
| step st T ih =>
simp only [markedAttach,attach,List.map_cons,List.map_map]
rw [← ih st.1,List.map_map]
rfl
| fork T U ihT ihU =>
simp only [markedAttach,attach,List.map_cons,List.map_append,List.map_map]
rw [← ihT a,← ihU a,List.map_map,List.map_map]
rfl
theorem markedAttach_mass {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) (a : ℝ) :
((T.markedAttach a).map fun p => p.coeff).sum = a := by
have h := T.attach_mass a
rw [← T.markedAttach_forget a] at h
simpa only [mass,List.map_map,Function.comp_def] using h
noncomputable def MarkedPlacement.hit {steps : List (GaussianStep ΞΉ)} {T : ReplicaTree ΞΉ S steps}
(p : MarkedPlacement T) (s : T.Slot) : ℝ := by
classical
exact if p.mark = p.embed s then 1 else 0
theorem MarkedPlacement.hit_fresh {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps)
(c : ℝ) (s : T.Slot) : (MarkedPlacement.fresh T c).hit s = 0 := by
classical
unfold MarkedPlacement.hit
apply ite_eq_right
intro h
cases h
theorem MarkedPlacement.hit_step {steps : List (GaussianStep ΞΉ)} {T : ReplicaTree ΞΉ S steps}
(st : GaussianStep ΞΉ) (p : MarkedPlacement T) (s : T.Slot) : (p.step st).hit s = p.hit s := rfl
theorem MarkedPlacement.coeff_step {steps : List (GaussianStep ΞΉ)} {T : ReplicaTree ΞΉ S steps}
(st : GaussianStep ΞΉ) (p : MarkedPlacement T) : (p.step st).coeff = p.coeff := rfl
theorem markedAttach_hit {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) (a : ℝ) (s : T.Slot) :
((T.markedAttach a).map fun p => p.coeff*p.hit s).sum = 1 := by
classical
induction T generalizing a with
| leaf => cases s; simp [markedAttach,MarkedPlacement.hit,MarkedPlacement.coincide,
MarkedPlacement.fresh,Placement.coincide,Placement.fresh]
| step st T ih =>
simp only [markedAttach,List.map_cons,List.sum_cons,List.map_map,Function.comp_def,
MarkedPlacement.hit_fresh,mul_zero,zero_add,MarkedPlacement.hit_step,MarkedPlacement.coeff_step]
exact ih st.1 s
| fork T U ihT ihU =>
cases s with
| inl s =>
simpa only [markedAttach,List.map_cons,List.sum_cons,List.map_append,List.sum_append,List.map_map,
Function.comp_def,MarkedPlacement.fresh,MarkedPlacement.left,MarkedPlacement.right,
Placement.fresh,Placement.left,Placement.right,MarkedPlacement.hit,Sum.map_inl,id_eq,
Sum.inr_ne_inl,Sum.inl.injEq,ite_false,mul_zero,List.map_const',List.sum_replicate,nsmul_zero,
zero_add,add_zero] using ihT a s
| inr s =>
simpa only [markedAttach,List.map_cons,List.sum_cons,List.map_append,List.sum_append,List.map_map,
Function.comp_def,MarkedPlacement.fresh,MarkedPlacement.left,MarkedPlacement.right,
Placement.fresh,Placement.left,Placement.right,MarkedPlacement.hit,Sum.map_inr,id_eq,
Sum.inr_ne_inl,Sum.inl_ne_inr,Sum.inr.injEq,ite_false,mul_zero,List.map_const',List.sum_replicate,nsmul_zero,
zero_add,add_zero] using ihU a s
theorem markedAttach_diagonal {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) (a : ℝ) :
((T.markedAttach a).map fun p => p.coeff *
((p.tree.markedAttach a).map fun q => q.coeff*q.hit p.mark).sum).sum = a := by
simp only [markedAttach_hit,mul_one,markedAttach_mass]
end SKFluctuations.Hierarchy.ReplicaTree
end
end OAI