Download data/lean/OAI/Probability/SKFluctuations/CompletedFeatureKernel.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 29.1 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/CompletedFeatureKernel.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKFluctuations/CompletedFeatureKernel.lean
-
curl -L -o CompletedFeatureKernel.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/CompletedFeatureKernel.lean
29.1 kB
| import Mathlib | |
| import OAI.Probability.SKFluctuations.PhysicalIncrementMoment | |
| import OAI.Probability.SKFluctuations.RootedIncrements | |
| namespace OAI | |
| /-! Completed Feature Kernel. -/ | |
| noncomputable section | |
| namespace SKFluctuations | |
| open Hierarchy MeasureTheory ProbabilityTheory | |
| open scoped BigOperators Topology NNReal | |
| theorem sum_square_edges (n : β) (z : Fin n β β) : | |
| (β i, z i)^2 = (β i, (z i)^2)+2*β e : Edge n, z e.val.1*z e.val.2 := by | |
| induction n with | |
| | zero => simp | |
| | succ n ih => | |
| rw [Fin.sum_univ_castSucc,Fin.sum_univ_castSucc, Cavity.sum_edges] | |
| simp only [Cavity.oldEdge,Cavity.rowEdge] | |
| rw [add_sq,ih] | |
| rw [β Finset.sum_mul] | |
| ring | |
| theorem completedCovariance (n : β) (hn : 0<n) (Ο Ο : Spin n) (b h : β) : | |
| (β i : FeatureIndex n, Sum.elim (fun _ => h) (fun _ => b) i* | |
| featureCoefficient n Ο i*featureCoefficient n Ο i) = | |
| (n:β)*h*orderedOverlap n Ο Ο+(n:β)*b/2*(orderedOverlap n Ο Ο)^2 := by | |
| have hn0 : (n:β) β 0 := ne_of_gt (Nat.cast_pos.mpr hn) | |
| have hs : (Real.sqrt (n:β))^2=(n:β) := Real.sq_sqrt (Nat.cast_nonneg n) | |
| have hs2 : (Real.sqrt (2:β))^2=2 := Real.sq_sqrt (by norm_num) | |
| let z : Fin n β β := fun i => spinValue (Ο i)*spinValue (Ο i) | |
| have hz (i : Fin n) : (z i)^2=1 := by | |
| dsimp [z] | |
| rw [mul_pow] | |
| simp only [pow_two,spinValue_sq,mul_one] | |
| have he := sum_square_edges n z | |
| simp only [hz,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,mul_one] at he | |
| have hedge (e : Edge n) : | |
| b*(1/Real.sqrt (n:β)*spinValue (Ο e.val.1)*spinValue (Ο e.val.2))* | |
| (1/Real.sqrt (n:β)*spinValue (Ο e.val.1)*spinValue (Ο e.val.2)) = | |
| b/(n:β)*(z e.val.1*z e.val.2) := by | |
| calc | |
| _ = b/(Real.sqrt (n:β))^2*(z e.val.1*z e.val.2) := by dsimp [z]; ring | |
| _ = _ := by rw [hs] | |
| rw [Fintype.sum_sum_type,Fintype.sum_option] | |
| simp only [featureCoefficient,Sum.elim_inl,Sum.elim_inr,liftedCoefficients,hedge] | |
| have hnone : b*(1/Real.sqrt 2)*(1/Real.sqrt 2)=b/2 := by | |
| calc | |
| _ = b/(Real.sqrt 2)^2 := by ring | |
| _ = _ := by rw [hs2] | |
| rw [hnone] | |
| have hfield : (β i, h*spinValue (Ο i)*spinValue (Ο i))=h*β i, z i := by | |
| simp only [z,Finset.mul_sum,mul_assoc] | |
| rw [hfield,β Finset.mul_sum] | |
| change _ = (n:β)*h*((β i, z i)/(n:β))+(n:β)*b/2*((β i, z i)/(n:β))^2 | |
| field_simp | |
| nlinarith only [congrArg (fun t : β => b*t) he] | |
| end SKFluctuations | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| variable {S ΞΉ : Type*} [Fintype S] [Nonempty S] [Fintype ΞΉ] | |
| abbrev HamiltonianStep (S : Type*) [Fintype S] := β Γ ProbabilityMeasure (S β β) | |
| def hamiltonianHierarchy (w : S β β) : List (HamiltonianStep S) β (S β β) β β | |
| | [] => spinLogPartition w (fun Ο => ContinuousLinearMap.proj Ο) | |
| | (m,Ξ½)::L => shiftedContinuation Ξ½ m (hamiltonianHierarchy w L) | |
| def hamiltonianHierarchyMean (w : S β β) (A : S β β) : | |
| List (HamiltonianStep S) β (S β β) β β | |
| | [] => fun x => β Ο, spinWeight w (fun Ο => ContinuousLinearMap.proj Ο) x Ο*A Ο | |
| | (m,Ξ½)::L => shiftedMean Ξ½ m (hamiltonianHierarchy w L) (hamiltonianHierarchyMean w A L) | |
| omit [Nonempty S] in | |
| theorem hamiltonianHierarchy_measurable [Nonempty S] | |
| (w : S β β) (L : List (HamiltonianStep S)) : | |
| Measurable (hamiltonianHierarchy w L) := by | |
| induction L with | |
| | nil => | |
| change Measurable (fun x : S β β => Real.log (β Ο, w Ο*Real.exp (x Ο))) | |
| fun_prop | |
| | cons s L ih => | |
| obtain β¨m,Ξ½β© := s | |
| change Measurable (fun x => Real.log (β« z, Real.exp (m*hamiltonianHierarchy w L (x+z)) βΞ½)/m) | |
| have hh : Measurable (fun p : (S β β) Γ (S β β) => Real.exp (m*hamiltonianHierarchy w L (p.1+p.2))) := | |
| (measurable_const.mul (ih.comp (measurable_fst.add measurable_snd))).exp | |
| exact hh.stronglyMeasurable.integral_prod_right'.measurable.log.div_const m | |
| theorem hamiltonianHierarchyMean_measurable (w : S β β) (A : S β β) | |
| (L : List (HamiltonianStep S)) : Measurable (hamiltonianHierarchyMean w A L) := by | |
| induction L with | |
| | nil => | |
| change Measurable (fun x : S β β => β Ο, (w Ο*Real.exp (x Ο)/(β Ο, w Ο*Real.exp (x Ο)))*A Ο) | |
| fun_prop | |
| | cons s L ih => | |
| obtain β¨m,Ξ½β© := s | |
| change Measurable (fun x => | |
| (β« z, hamiltonianHierarchyMean w A L (x+z)*Real.exp (m*hamiltonianHierarchy w L (x+z)) βΞ½)/ | |
| (β« z, Real.exp (m*hamiltonianHierarchy w L (x+z)) βΞ½)) | |
| have hF : Measurable (fun p : (S β β) Γ (S β β) => Real.exp (m*hamiltonianHierarchy w L (p.1+p.2))) := | |
| (measurable_const.mul ((hamiltonianHierarchy_measurable w L).comp (measurable_fst.add measurable_snd))).exp | |
| exact ((ih.comp (measurable_fst.add measurable_snd)).mul hF).stronglyMeasurable.integral_prod_right'.measurable.div hF.stronglyMeasurable.integral_prod_right'.measurable | |
| def featureLaw (Ο : S β (ΞΉ β β) βL[β] β) (q : ΞΉ β ββ₯0) : ProbabilityMeasure (S β β) := | |
| β¨(Measure.pi fun i => gaussianReal 0 (q i)).map (featureVector Ο), | |
| (Measure.isProbabilityMeasure_map_iff (featureVector Ο).measurable.aemeasurable).2 inferInstanceβ© | |
| def featureSteps (Ο : S β (ΞΉ β β) βL[β] β) (L : List (GaussianStep ΞΉ)) : List (HamiltonianStep S) := | |
| L.map (fun s => (s.1,featureLaw Ο s.2)) | |
| omit [Nonempty S] in | |
| theorem featureLaw_integral [Nonempty S] (Ο : S β (ΞΉ β β) βL[β] β) (q : ΞΉ β ββ₯0) | |
| (f : (S β β) β β) (hf : Measurable f) : | |
| β« y, f y β(featureLaw Ο q) = β« x, f (featureVector Ο x) β(Measure.pi fun i => gaussianReal 0 (q i)) := by | |
| exact integral_map (featureVector Ο).measurable.aemeasurable hf.aestronglyMeasurable | |
| theorem gaussianHierarchy_featureLaw (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (L : List (GaussianStep ΞΉ)) (x : ΞΉ β β) : | |
| gaussianHierarchy w Ο L x = hamiltonianHierarchy w (featureSteps Ο L) (featureVector Ο x) := by | |
| induction L generalizing x with | |
| | nil => rfl | |
| | cons s L ih => | |
| obtain β¨m,qβ© := s | |
| simp only [gaussianHierarchy,featureSteps,List.map_cons,hamiltonianHierarchy,shiftedContinuation] | |
| simp_rw [ih] | |
| congr 2 | |
| have hF : Measurable (fun z : S β β => Real.exp (m*hamiltonianHierarchy w (featureSteps Ο L) (featureVector Ο x+z))) := | |
| (((hamiltonianHierarchy_measurable w (featureSteps Ο L)).comp | |
| (measurable_const.add measurable_id)).const_mul m).exp | |
| simpa only [map_add,featureSteps] using (featureLaw_integral Ο q _ hF).symm | |
| theorem gaussianHierarchyMean_featureLaw (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (A : S β β) (L : List (GaussianStep ΞΉ)) (x : ΞΉ β β) : | |
| gaussianHierarchyMean w Ο A L x = hamiltonianHierarchyMean w A (featureSteps Ο L) (featureVector Ο x) := by | |
| induction L generalizing x with | |
| | nil => rfl | |
| | cons s L ih => | |
| obtain β¨m,qβ© := s | |
| simp only [gaussianHierarchyMean,featureSteps,List.map_cons,hamiltonianHierarchyMean,shiftedMean,tiltedMean] | |
| simp_rw [ih,gaussianHierarchy_featureLaw] | |
| have hF : Measurable (fun z : S β β => Real.exp (m*hamiltonianHierarchy w (featureSteps Ο L) (featureVector Ο x+z))) := | |
| (((hamiltonianHierarchy_measurable w (featureSteps Ο L)).comp | |
| (measurable_const.add measurable_id)).const_mul m).exp | |
| have hA : Measurable (fun z : S β β => hamiltonianHierarchyMean w A (featureSteps Ο L) (featureVector Ο x+z)) := | |
| (hamiltonianHierarchyMean_measurable w A (featureSteps Ο L)).comp | |
| (measurable_const.add measurable_id) | |
| have hnum := (featureLaw_integral Ο q _ (hA.mul hF)).symm | |
| have hden := (featureLaw_integral Ο q _ hF).symm | |
| simpa only [map_add,featureSteps,Pi.mul_apply] using congrArgβ (fun a b : β => a/b) hnum hden | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| variable {S ΞΉ : Type*} [Fintype S] [Nonempty S] [Fintype ΞΉ] | |
| theorem hamiltonianHierarchyMean_jointMeasurable (w : S β β) (L : List (HamiltonianStep S)) : | |
| Measurable (fun p : (S β β) Γ (S β β) => hamiltonianHierarchyMean w p.1 L p.2) := by | |
| induction L with | |
| | nil => | |
| change Measurable (fun p : (S β β) Γ (S β β) => | |
| β Ο, (w Ο*Real.exp (p.2 Ο)/(β Ο, w Ο*Real.exp (p.2 Ο)))*p.1 Ο) | |
| fun_prop | |
| | cons s L ih => | |
| obtain β¨m,Ξ½β© := s | |
| change Measurable (fun p : (S β β) Γ (S β β) => | |
| (β« z, hamiltonianHierarchyMean w p.1 L (p.2+z)*Real.exp (m*hamiltonianHierarchy w L (p.2+z)) βΞ½)/ | |
| (β« z, Real.exp (m*hamiltonianHierarchy w L (p.2+z)) βΞ½)) | |
| have hF : Measurable (fun p : ((S β β) Γ (S β β)) Γ (S β β) => | |
| Real.exp (m*hamiltonianHierarchy w L (p.1.2+p.2))) := | |
| (((hamiltonianHierarchy_measurable w L).comp (measurable_fst.snd.add measurable_snd)).const_mul m).exp | |
| have hA : Measurable (fun p : ((S β β) Γ (S β β)) Γ (S β β) => | |
| hamiltonianHierarchyMean w p.1.1 L (p.1.2+p.2)) := | |
| ih.comp (measurable_fst.fst.prodMk (measurable_fst.snd.add measurable_snd)) | |
| exact (hA.mul hF).stronglyMeasurable.integral_prod_right'.measurable.div | |
| hF.stronglyMeasurable.integral_prod_right'.measurable | |
| def hamiltonianPrefixTest (w : S β β) (post : List (HamiltonianStep S)) | |
| (A : (S β β) β β) : List (HamiltonianStep S) β (S β β) β β | |
| | [] => A | |
| | (m,Ξ½)::L => shiftedMean Ξ½ m (hamiltonianHierarchy w (L++post)) (hamiltonianPrefixTest w post A L) | |
| theorem hamiltonianPrefixTest_measurable (w : S β β) (post pre : List (HamiltonianStep S)) | |
| (A : (S β β) β β) (hA : Measurable A) : Measurable (hamiltonianPrefixTest w post A pre) := by | |
| induction pre with | |
| | nil => exact hA | |
| | cons s L ih => | |
| obtain β¨m,Ξ½β© := s | |
| change Measurable (fun x => | |
| (β« z, hamiltonianPrefixTest w post A L (x+z)*Real.exp (m*hamiltonianHierarchy w (L++post) (x+z)) βΞ½)/ | |
| (β« z, Real.exp (m*hamiltonianHierarchy w (L++post) (x+z)) βΞ½)) | |
| have hF : Measurable (fun p : (S β β) Γ (S β β) => | |
| Real.exp (m*hamiltonianHierarchy w (L++post) (p.1+p.2))) := | |
| (((hamiltonianHierarchy_measurable w _).comp (measurable_fst.add measurable_snd)).const_mul m).exp | |
| exact ((ih.comp (measurable_fst.add measurable_snd)).mul hF).stronglyMeasurable.integral_prod_right'.measurable.div | |
| hF.stronglyMeasurable.integral_prod_right'.measurable | |
| theorem prefixTest_featureLaw (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (post pre : List (GaussianStep ΞΉ)) (A : (S β β) β β) (hA : Measurable A) (x : ΞΉ β β) : | |
| prefixTest pre (gaussianHierarchy w Ο post) (fun y => A (featureVector Ο y)) x = | |
| hamiltonianPrefixTest w (featureSteps Ο post) A (featureSteps Ο pre) (featureVector Ο x) := by | |
| induction pre generalizing x with | |
| | nil => rfl | |
| | cons s L ih => | |
| obtain β¨m,qβ© := s | |
| simp only [prefixTest,prefixContinuation_hierarchy,featureSteps,List.map_cons,hamiltonianPrefixTest, | |
| shiftedMean,tiltedMean] | |
| simp_rw [ih,gaussianHierarchy_featureLaw] | |
| have hF : Measurable (fun z : S β β => Real.exp (m*hamiltonianHierarchy w | |
| (featureSteps Ο (L++post)) (featureVector Ο x+z))) := | |
| (((hamiltonianHierarchy_measurable w _).comp (measurable_const.add measurable_id)).const_mul m).exp | |
| have hD : Measurable (fun z : S β β => hamiltonianPrefixTest w (featureSteps Ο post) A | |
| (featureSteps Ο L) (featureVector Ο x+z)) := | |
| (hamiltonianPrefixTest_measurable w _ _ A hA).comp (measurable_const.add measurable_id) | |
| have hn := (featureLaw_integral Ο q _ (hD.mul hF)).symm | |
| have hd := (featureLaw_integral Ο q _ hF).symm | |
| simpa only [map_add,featureSteps,List.map_append,Pi.mul_apply] using congrArgβ (fun a b : β => a/b) hn hd | |
| def hamiltonianPairTest (w : S β β) (L : List (HamiltonianStep S)) (P : S β S β β) | |
| (x : S β β) : β := hamiltonianHierarchyMean w (fun Ο => hamiltonianHierarchyMean w (P Ο) L x) L x | |
| theorem hamiltonianPairTest_measurable (w : S β β) (L : List (HamiltonianStep S)) (P : S β S β β) : | |
| Measurable (hamiltonianPairTest w L P) := by | |
| exact (hamiltonianHierarchyMean_jointMeasurable w L).comp | |
| ((Measurable.of_eval (fun Ο => hamiltonianHierarchyMean_measurable w (P Ο) L)).prodMk measurable_id) | |
| theorem stepPairMean_featureLaw (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (pre post : List (GaussianStep ΞΉ)) (P : S β S β β) (x : ΞΉ β β) : | |
| stepPairMean w Ο pre post P x = hamiltonianPrefixTest w (featureSteps Ο post) | |
| (hamiltonianPairTest w (featureSteps Ο post) P) (featureSteps Ο pre) (featureVector Ο x) := by | |
| have ht : (fun y => gaussianHierarchyMean w Ο | |
| (fun Ο => gaussianHierarchyMean w Ο (P Ο) post y) post y) = | |
| fun y => hamiltonianPairTest w (featureSteps Ο post) P (featureVector Ο y) := by | |
| funext y | |
| simp only [gaussianHierarchyMean_featureLaw,hamiltonianPairTest] | |
| unfold stepPairMean | |
| rw [ht] | |
| exact prefixTest_featureLaw w Ο post pre _ (hamiltonianPairTest_measurable w _ P) x | |
| theorem stepPairDisorder_featureLaw (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (q : ΞΉ β ββ₯0) (pre post : List (GaussianStep ΞΉ)) (P : S β S β β) (x : ΞΉ β β) : | |
| stepPairDisorder w Ο q pre post P x = | |
| β« z, hamiltonianPrefixTest w (featureSteps Ο post) (hamiltonianPairTest w (featureSteps Ο post) P) | |
| (featureSteps Ο pre) (featureVector Ο x+z) β(featureLaw Ο q) := by | |
| unfold stepPairDisorder zeroContinuation | |
| simp_rw [stepPairMean_featureLaw,map_add] | |
| exact (featureLaw_integral Ο q _ ((hamiltonianPrefixTest_measurable w _ _ _ | |
| (hamiltonianPairTest_measurable w _ P)).comp (measurable_const.add measurable_id))).symm | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| variable {S ΞΉ ΞΊ : Type*} [Fintype S] [Nonempty S] [Fintype ΞΉ] [Fintype ΞΊ] | |
| theorem stepPairDisorder_eq_of_featureLaws (w : S β β) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (Ο : S β (ΞΊ β β) βL[β] β) | |
| (q : ΞΉ β ββ₯0) (r : ΞΊ β ββ₯0) (pre post : List (GaussianStep ΞΉ)) | |
| (pre' post' : List (GaussianStep ΞΊ)) (P : S β S β β) | |
| (hroot : featureLaw Ο q=featureLaw Ο r) | |
| (hpre : featureSteps Ο pre=featureSteps Ο pre') (hpost : featureSteps Ο post=featureSteps Ο post') : | |
| stepPairDisorder w Ο q pre post P 0=stepPairDisorder w Ο r pre' post' P 0 := by | |
| rw [stepPairDisorder_featureLaw,stepPairDisorder_featureLaw,hroot,hpre,hpost] | |
| simp only [map_zero] | |
| def splitHamiltonianSteps (u : β) : List (HamiltonianStep S) β List (HamiltonianStep S) Γ List (HamiltonianStep S) | |
| | [] => ([],[]) | |
| | s::L => if s.1β€u then (s::(splitHamiltonianSteps u L).1,(splitHamiltonianSteps u L).2) else ([],s::L) | |
| omit [Nonempty S] in | |
| theorem featureSteps_split [Nonempty S] | |
| (Ο : S β (ΞΉ β β) βL[β] β) (u : β) (L : List (GaussianStep ΞΉ)) : | |
| (featureSteps Ο (splitClockSteps u L).1,featureSteps Ο (splitClockSteps u L).2)= | |
| splitHamiltonianSteps u (featureSteps Ο L) := by | |
| induction L with | |
| | nil => rfl | |
| | cons s L ih => | |
| simp only [splitClockSteps,featureSteps,List.map_cons,splitHamiltonianSteps] | |
| split_ifs with hs | |
| Β· have hβ := congrArg Prod.fst ih | |
| have hβ := congrArg Prod.snd ih | |
| simp only [featureSteps] at hβ hβ | |
| rw [List.map_cons,hβ,hβ] | |
| Β· rfl | |
| theorem stepPairMoment_eq_of_featureLaws [Nonempty ΞΉ] [Nonempty ΞΊ] {w : S β β} (hw : β Ο, 0<w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (Ο : S β (ΞΊ β β) βL[β] β) | |
| (q : ΞΉ β ββ₯0) (r : ΞΊ β ββ₯0) (L : List (GaussianStep ΞΉ)) (M : List (GaussianStep ΞΊ)) | |
| (hL : OrderedSteps 0 L) (hM : OrderedSteps 0 M) (P : S β S β β) | |
| (hroot : featureLaw Ο q=featureLaw Ο r) (hsteps : featureSteps Ο L=featureSteps Ο M) (u : β) : | |
| stepPairMoment w Ο q L hL.mem_pos P u=stepPairMoment w Ο r M hM.mem_pos P u := by | |
| rw [stepPairMoment_eq_split hw Ο q L hL,stepPairMoment_eq_split hw Ο r M hM] | |
| have he := (featureSteps_split Ο u L).trans ((congrArg (splitHamiltonianSteps u) hsteps).trans | |
| (featureSteps_split Ο u M).symm) | |
| exact stepPairDisorder_eq_of_featureLaws w Ο Ο q r _ _ _ _ P hroot | |
| (congrArg Prod.fst he) (congrArg Prod.snd he) | |
| omit [Nonempty S] in | |
| theorem sampleFeatureSteps_eq [Nonempty S] | |
| (Ο : S β (ΞΉ β β) βL[β] β) (Ο : S β (ΞΊ β β) βL[β] β) | |
| (q : β β ΞΉ β ββ₯0) (r : β β ΞΊ β ββ₯0) | |
| (he : β a b, featureLaw Ο (fun i => q b i-q a i)=featureLaw Ο (fun i => r b i-r a i)) | |
| (a : β) (as : List PositiveMass) : | |
| featureSteps Ο (sampleClockSteps q a as)=featureSteps Ο (sampleClockSteps r a as) := by | |
| induction as generalizing a with | |
| | nil => rfl | |
| | cons b bs ih => | |
| change (b.val,featureLaw Ο (fun i => q b.val i-q a i))::featureSteps Ο (sampleClockSteps q b.val bs)=_ | |
| rw [he,ih] | |
| rfl | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| variable {S ΞΉ ΞΊ : Type*} [Fintype S] [Nonempty S] [Fintype ΞΉ] [Fintype ΞΊ] | |
| variable [Nonempty ΞΉ] [Nonempty ΞΊ] | |
| omit [Nonempty ΞΉ] [Nonempty ΞΊ] in | |
| theorem retainedPairSample_eq_of_featureLaws [Nonempty ΞΉ] [Nonempty ΞΊ] (w : S β β) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (Ο : S β (ΞΊ β β) βL[β] β) | |
| (q : β β ΞΉ β ββ₯0) (r : β β ΞΊ β ββ₯0) | |
| (hroot : featureLaw Ο (q 0)=featureLaw Ο (r 0)) | |
| (he : β a b, featureLaw Ο (fun i => q b i-q a i)=featureLaw Ο (fun i => r b i-r a i)) | |
| (u : PositiveMass) (as : List PositiveMass) (P : S β S β β) : | |
| retainedPairSample w Ο q u as P 0=retainedPairSample w Ο r u as P 0 := by | |
| exact stepPairDisorder_eq_of_featureLaws w Ο Ο _ _ _ _ _ _ P hroot | |
| (sampleFeatureSteps_eq Ο Ο q r he _ _) (sampleFeatureSteps_eq Ο Ο q r he _ _) | |
| theorem pathPairMoment_eq_of_featureLaws {w : S β β} (hw : β Ο, 0<w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (Ο : S β (ΞΊ β β) βL[β] β) | |
| (q : β β ΞΉ β ββ₯0) (r : β β ΞΊ β ββ₯0) | |
| (hq : β i, MonotoneOn (fun u => q u i) (Icc (0:β) 1)) | |
| (hr : β i, MonotoneOn (fun u => r u i) (Icc (0:β) 1)) | |
| (hroot : featureLaw Ο (q 0)=featureLaw Ο (r 0)) | |
| (he : β a b, featureLaw Ο (fun i => q b i-q a i)=featureLaw Ο (fun i => r b i-r a i)) | |
| (P : S β S β β) {u : β} (hu : u β Ioc (0:β) 1) : | |
| pathPairMoment w Ο q P u=pathPairMoment w Ο r P u := by | |
| simp only [pathPairMoment,dite_eq_left hu.1] | |
| apply tendsto_nhds_unique (retainedPairSample_tendsto_all hw Ο q hq β¨u,hu.1β© hu.2 P 0) | |
| simpa only [retainedPairSample_eq_of_featureLaws w Ο Ο q r hroot he] using | |
| retainedPairSample_tendsto_all hw Ο r hr β¨u,hu.1β© hu.2 P 0 | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations | |
| open Hierarchy MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| def completedPathClock (n : β) (b h : β β ββ₯0) (u : β) : FeatureIndex n β ββ₯0 := | |
| Sum.elim (fun _ => h u) (fun _ => b u) | |
| theorem completedPathClock_monotone (n : β) {b h : β β ββ₯0} | |
| (hb : MonotoneOn b (Icc (0:β) 1)) (hh : MonotoneOn h (Icc (0:β) 1)) : | |
| β i, MonotoneOn (fun u => completedPathClock n b h u i) (Icc (0:β) 1) := by | |
| intro i; cases i with | |
| | inl i => exact hh | |
| | inr i => exact hb | |
| theorem ordered_completed_featureLaw (n : β) (hn : 0<n) (b h : ββ₯0) : | |
| featureLaw (orderedFeature n) (Sum.elim (fun _ => h) (fun _ => b))= | |
| featureLaw (finiteFeature n) (Sum.elim (fun _ => h) (fun _ => b)) := by | |
| classical | |
| apply Subtype.ext | |
| apply featureVector_law_eq | |
| intro Ο Ο | |
| simp only [orderedFeature_single] | |
| have hc (Ο : Spin n) (i : FeatureIndex n) : finiteFeature n Ο (Pi.single i 1)=featureCoefficient n Ο i := by | |
| simp [finiteFeature_apply,Pi.single_apply] | |
| simp only [hc] | |
| convert (orderedCovariance n hn Ο Ο (b:β) (h:β)).trans | |
| (completedCovariance n hn Ο Ο (b:β) (h:β)).symm using 1 <;> | |
| apply Finset.sum_congr rfl <;> intro i hi <;> cases i <;> rfl | |
| theorem ordered_completed_incrementLaw (n : β) (hn : 0<n) (b h : β β ββ₯0) (u v : β) : | |
| featureLaw (orderedFeature n) (fun i => orderedPathClock n b h v i-orderedPathClock n b h u i)= | |
| featureLaw (finiteFeature n) (fun i => completedPathClock n b h v i-completedPathClock n b h u i) := by | |
| have ho : (fun i => orderedPathClock n b h v i-orderedPathClock n b h u i)= | |
| Sum.elim (fun _ => h v-h u) (fun _ => b v-b u) := by funext i; cases i <;> rfl | |
| have he : (fun i => completedPathClock n b h v i-completedPathClock n b h u i)= | |
| Sum.elim (fun _ => h v-h u) (fun _ => b v-b u) := by funext i; cases i <;> rfl | |
| rw [ho,he] | |
| exact ordered_completed_featureLaw n hn _ _ | |
| theorem orderedPathPair_eq_completed (n : β) (hn : 0<n) (b h : β β ββ₯0) | |
| (hb : MonotoneOn b (Icc (0:β) 1)) (hh : MonotoneOn h (Icc (0:β) 1)) | |
| (P : Spin n β Spin n β β) {u : β} (hu : u β Ioc (0:β) 1) : | |
| orderedPathPair n b h P u= | |
| pathPairMoment (uniformWeight n) (finiteFeature n) (completedPathClock n b h) P u := by | |
| let : NeZero n := β¨Nat.ne_of_gt hnβ© | |
| exact pathPairMoment_eq_of_featureLaws (uniformWeight_pos n) _ _ _ _ | |
| (orderedPathClock_monotone n hb hh) (completedPathClock_monotone n hb hh) | |
| (ordered_completed_featureLaw n hn (b 0) (h 0)) (ordered_completed_incrementLaw n hn b h) P hu | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Filter Set Hierarchy | |
| open scoped Topology NNReal BigOperators | |
| theorem physicalFieldDuration_take_coordinate {ΞΉ : Type} (i : ΞΉ) (qβ : ΞΉ β β) | |
| (steps : List (GaussianStep ΞΉ)) (j : β) : | |
| physicalFieldDuration (fun st => st.2 i) (steps.take j)=stepClockValues qβ steps j i-qβ i := by | |
| induction steps generalizing qβ j with | |
| | nil => cases j <;> simp [physicalFieldDuration,stepClockValues] | |
| | cons st steps ih => | |
| cases j with | |
| | zero => simp [physicalFieldDuration,stepClockValues] | |
| | succ j => | |
| simp only [List.take_succ_cons,physicalFieldDuration,List.map_cons,List.sum_cons,NNReal.coe_add] | |
| change _+physicalFieldDuration (fun st => st.2 i) (steps.take j)=_ | |
| rw [ih (fun i => qβ i+st.2 i)] | |
| simp only [stepClockValues] | |
| ring | |
| theorem splitClockSteps_take {ΞΉ : Type} [Fintype ΞΉ] [Nonempty ΞΉ] (u : β) (steps : List (GaussianStep ΞΉ)) : | |
| steps.take (splitClockSteps u steps).1.length=(splitClockSteps u steps).1 := by | |
| calc _ = ((splitClockSteps u steps).1++(splitClockSteps u steps).2).take | |
| (splitClockSteps u steps).1.length := congrArg (fun L : List (GaussianStep ΞΉ) => L.take (splitClockSteps u steps).1.length) | |
| (splitClockSteps_append u steps).symm | |
| _ = _ := List.take_left .. | |
| theorem physicalFieldDuration_split {ΞΉ : Type} [Fintype ΞΉ] [Nonempty ΞΉ] (i : ΞΉ) (qβ : ΞΉ β β) | |
| (steps : List (GaussianStep ΞΉ)) {a : β} (ha : OrderedSteps a steps) (u : β) : | |
| physicalFieldDuration (fun st => st.2 i) (steps.take (splitClockSteps u steps).1.length)= | |
| stepClockFunction qβ steps u i-qβ i := by | |
| rw [splitClockSteps_take,stepClockFunction_split qβ u steps ha] | |
| simpa only [List.take_length] using physicalFieldDuration_take_coordinate i qβ | |
| (splitClockSteps u steps).1 (splitClockSteps u steps).1.length | |
| theorem sampledFieldDuration (n : β) (hn : 0<n) (b h : β β ββ₯0) | |
| (hb : MonotoneOn b (Icc (0:β) 1)) (hh : MonotoneOn h (Icc (0:β) 1)) | |
| (as : List PositiveMass) (ha : MassOrdered 0 as) (u : β) : | |
| let q := completedPathClock n b h | |
| let steps := sampleClockSteps q 0 as | |
| physicalFieldDuration (fun st => st.2 (Sum.inl β¨0,hnβ©)) | |
| (steps.take (splitClockSteps u steps).1.length)= | |
| partitionSample (fun u => (h u:β)) 0 as u-(h 0:β) := by | |
| dsimp only | |
| rw [physicalFieldDuration_split (Sum.inl β¨0,hnβ©) | |
| (fun i => (completedPathClock n b h 0 i:β)) _ (sampleClockSteps_ordered _ _ ha)] | |
| rw [sampleClockSteps_function _ (completedPathClock_monotone n hb hh) as ha] | |
| rfl | |
| theorem sampledFieldClock_aligned (n : β) (hn : 0<n) (b h : β β ββ₯0) | |
| (as : List PositiveMass) (a : β) : | |
| β st β sampleClockSteps (completedPathClock n b h) a as, β i : Fin n, | |
| st.2 (Sum.inl i)=st.2 (Sum.inl β¨0,hnβ©) := by | |
| induction as generalizing a with | |
| | nil => simp [sampleClockSteps] | |
| | cons c cs ih => | |
| intro st hst i | |
| rcases List.mem_cons.mp hst with rfl | hst | |
| Β· rfl | |
| Β· exact ih c.val st hst i | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Filter Set Hierarchy | |
| open scoped Topology NNReal BigOperators | |
| theorem pathMassDifferences_eq_cutMass {ΞΉ : Type} (steps : List (GaussianStep ΞΉ)) | |
| (a : β) (j : Fin (steps.length+1)) : | |
| pathMassDifferences steps a j=physicalCutMass a steps (j.val+1)-physicalCutMass a steps j.val := by | |
| induction steps generalizing a with | |
| | nil => | |
| have hj : j=0 := by | |
| apply Fin.ext | |
| change j.val=0 | |
| have hh := j.isLt | |
| simp only [List.length_nil,zero_add] at hh | |
| omega | |
| subst j | |
| rfl | |
| | cons st steps ih => | |
| rcases st with β¨m,qβ© | |
| refine Fin.cases ?_ (fun k => ?_) j | |
| Β· simp only [pathMassDifferences,Fin.cons_zero,Fin.val_zero,physicalCutMass] | |
| Β· simpa only [pathMassDifferences,Fin.cons_succ,Fin.val_succ,physicalCutMass] using ih m k | |
| theorem physicalCutMass_sampleClockSteps {ΞΉ : Type} (q : β β ΞΉ β ββ₯0) | |
| (a : β) (as : List PositiveMass) (j : β) (hj : j β€ as.length) : | |
| physicalCutMass a (sampleClockSteps q a as) j=partitionPoint a as j := by | |
| induction as generalizing a j with | |
| | nil => | |
| have hj' : j=0 := by simpa using hj | |
| subst j | |
| rfl | |
| | cons b bs ih => cases j with | |
| | zero => rfl | |
| | succ j => exact ih b.val j (by simpa using hj) | |
| theorem sampledFieldDuration_index (n : β) (hn : 0<n) (b h : β β ββ₯0) | |
| (hb : MonotoneOn b (Icc (0:β) 1)) (hh : MonotoneOn h (Icc (0:β) 1)) | |
| (as : List PositiveMass) (ha : MassOrdered 0 as) (j : β) (hj : j β€ as.length) : | |
| let q := completedPathClock n b h | |
| let steps := sampleClockSteps q 0 as | |
| physicalFieldDuration (fun st => st.2 (Sum.inl β¨0,hnβ©)) (steps.take j)= | |
| (h (physicalCutMass 0 steps j):β)-(h 0:β) := by | |
| dsimp only | |
| rw [physicalFieldDuration_take_coordinate (Sum.inl β¨0,hnβ©) | |
| (fun i => (completedPathClock n b h 0 i:β))] | |
| rw [sampleClockSteps_values _ (completedPathClock_monotone n hb hh) as ha, | |
| partitionValues_point,physicalCutMass_sampleClockSteps _ _ _ j hj] | |
| rfl | |
| end SKFluctuations | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| def cutPredecessor : (cs : List (β Γ β)) β β β Fin cs.length β β | |
| | [], _, i => Fin.elim0 i | |
| | c::cs, j, i => Fin.cases j (cutPredecessor cs c.2) i | |
| def cutIncrement {E : Type*} [Sub E] (cs : List (β Γ β)) (X : β β E) | |
| (j : β) (i : Fin cs.length) : E := X (cs.get i).2-X (cutPredecessor cs j i) | |
| theorem cutIncrement_zero {E : Type*} [Sub E] (c : β Γ β) (cs : List (β Γ β)) | |
| (X : β β E) (j : β) : cutIncrement (c::cs) X j 0 = X c.2-X j := rfl | |
| theorem cutIncrement_succ {E : Type*} [Sub E] (c : β Γ β) (cs : List (β Γ β)) | |
| (X : β β E) (j : β) (i : Fin cs.length) : | |
| cutIncrement (c::cs) X j i.succ = cutIncrement cs X c.2 i := rfl | |
| theorem weightedPathIncrements_eq_sum (cs : List (β Γ β)) (X : β β β) (j : β) : | |
| weightedPathIncrements cs X j = β i : Fin cs.length, (cs.get i).1*(cutIncrement cs X j i)^2 := by | |
| induction cs generalizing j with | |
| | nil => simp [weightedPathIncrements] | |
| | cons c cs ih => | |
| simp only [weightedPathIncrements, List.length_cons, Fin.sum_univ_succ, | |
| cutIncrement_zero,cutIncrement_succ] | |
| exact congrArg (fun t => c.1*(X c.2-X j)^2+t) (ih c.2) | |
| theorem sum_cutIncrement {E : Type*} [AddCommGroup E] (cs : List (β Γ β)) | |
| (X : β β E) (j : β) : | |
| (β i : Fin cs.length, cutIncrement cs X j i) = X (lastLayerCut cs j)-X j := by | |
| induction cs generalizing j with | |
| | nil => simp [lastLayerCut] | |
| | cons c cs ih => | |
| simp only [List.length_cons,Fin.sum_univ_succ,cutIncrement_zero,cutIncrement_succ,ih,lastLayerCut] | |
| abel | |
| theorem dot_cutIncrement {d : Type*} [Fintype d] (cs : List (β Γ β)) | |
| (X : β β d β β) (V : d β β) (j : β) (i : Fin cs.length) : | |
| cutIncrement cs (fun k => β l, V l*X k l) j i = β l, V l*cutIncrement cs X j i l := by | |
| simp only [cutIncrement,Pi.sub_apply,mul_sub,Finset.sum_sub_distrib] | |
| end SKFluctuations.Hierarchy | |
| end | |
| end OAI | |