Download data/lean/OAI/Probability/SKFluctuations/Chain.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 32.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/Chain.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKFluctuations/Chain.lean
-
curl -L -o Chain.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/Chain.lean
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 | |