Download data/lean/OAI/Probability/SKFluctuations/CompContDiff.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 29.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/CompContDiff.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKFluctuations/CompContDiff.lean
-
curl -L -o CompContDiff.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/CompContDiff.lean
29.2 kB
| import Mathlib | |
| import OAI.Probability.SKFluctuations.LineDerivativesSignEquivVolume | |
| namespace OAI | |
| /-! Comp Cont Diff. -/ | |
| 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 ContDiff | |
| variable {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| theorem BddSmooth.comp_contDiff {n : β} {A : E β β} (hA : BddSmooth n A) | |
| {f : β β β} (hf : ContDiff β β f) : BddSmooth n (fun x => f (A x)) := by | |
| induction n generalizing A f with | |
| | zero => | |
| obtain β¨B,hB,hbβ© := hA.bound | |
| obtain β¨C,hCβ© := (isCompact_Icc : IsCompact (Icc (-B) B)).exists_bound_of_continuousOn | |
| hf.continuous.continuousOn | |
| refine β¨hf.continuous.comp hA.continuous, max C 0, le_max_right _ _, fun x => ?_β© | |
| exact (hC (A x) (abs_le.mp (hb x))).trans (le_max_left _ _) | |
| | succ n ih => | |
| refine β¨ih hA.down hf, fun v => ?_β© | |
| obtain β¨Aβ,hAβ,hdβ© := hA.2 v | |
| have hdf : ContDiff β β (deriv f) := (contDiff_infty_iff_deriv.mp hf).2 | |
| refine β¨fun x => deriv f (A x)*Aβ x, (ih hA.down hdf).mul hAβ, fun x t => ?_β© | |
| exact ((contDiff_infty_iff_deriv.mp hf).1 (A (x+tβ’v))).hasDerivAt.comp t (hd x t) | |
| def smoothAbsPower (Ξ΅ p : β) (x : β) : β := (x^2+Ξ΅)^(p/2) | |
| theorem contDiff_smoothAbsPower {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (p : β) : | |
| ContDiff β β (smoothAbsPower Ξ΅ p) := by | |
| exact ((contDiff_id.pow 2).add contDiff_const).rpow_const_of_ne | |
| (fun x => ne_of_gt (add_pos_of_nonneg_of_pos (sq_nonneg x) hΞ΅)) | |
| theorem BddSmooth.smoothAbsPower {n : β} {A : E β β} (hA : BddSmooth n A) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (p : β) : BddSmooth n (fun x => smoothAbsPower Ξ΅ p (A x)) := | |
| hA.comp_contDiff (contDiff_smoothAbsPower hΞ΅ p) | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped NNReal Topology | |
| theorem potentialLaw_equiv {n : β} (T : (Fin n β β) βL[β] (Fin n β β)) | |
| (hT : MeasurePreserving T volume volume) {U V : (Fin n β β) β β} | |
| (hUV : β x, V (T x) = U x) : | |
| MeasurePreserving T (potentialLaw U) (potentialLaw V) := by | |
| have hI : (β« z, Real.exp (-V z)) = β« z, Real.exp (-U z) := by | |
| rw [β hT.integral_comp T.toHomeomorph.toMeasurableEquiv.measurableEmbedding] | |
| simp_rw [hUV] | |
| have hn (x : Fin n β β) : normalizedPotential V (T x) = normalizedPotential U x := by | |
| simp only [normalizedPotential, hUV, hI] | |
| refine β¨T.continuous.measurable, ?_β© | |
| ext s hs | |
| rw [Measure.map_apply T.continuous.measurable hs] | |
| unfold potentialLaw | |
| rw [withDensity_apply _ (T.continuous.measurable hs), withDensity_apply _ hs, | |
| β lintegral_indicator (T.continuous.measurable hs), β lintegral_indicator hs] | |
| rw [β hT.lintegral_comp_emb T.toHomeomorph.toMeasurableEquiv.measurableEmbedding | |
| (s.indicator (fun x => ENNReal.ofReal (Real.exp (-normalizedPotential V x))))] | |
| apply lintegral_congr | |
| intro x | |
| by_cases hx : T x β s | |
| Β· simp only [mem_preimage, hx, indicator_of_mem, hn] | |
| Β· simp only [mem_preimage, hx, not_false_eq_true, indicator_of_notMem] | |
| theorem potentialLaw_joint_test_eq {n : β} (T : (Fin n β β) βL[β] (Fin n β β)) | |
| (hT : MeasurePreserving T volume volume) {U V A B J K : (Fin n β β) β β} | |
| (hUV : β x, V (T x) = U x) (hAB : β x, B (T x) = A x) | |
| (hJK : β x, K (T x) = J x) (f : β Γ β β β) : | |
| (β« x, f (B x, K x) βpotentialLaw V) = | |
| β« x, f (A x, J x) βpotentialLaw U := by | |
| rw [β (potentialLaw_equiv T hT hUV).integral_comp | |
| T.toHomeomorph.toMeasurableEquiv.measurableEmbedding] | |
| simp_rw [hAB, hJK] | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped NNReal Topology ContDiff | |
| open SKFluctuations.PinnedVariance SKFluctuations.PreKopa | |
| theorem BddSmooth.lineDeriv_comp_contDiff {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| {A : E β β} (hA : BddSmooth 1 A) {f : β β β} (hf : ContDiff β β f) (x v : E) : | |
| lineDeriv β (fun y => f (A y)) x v = deriv f (A x)*lineDeriv β A x v := by | |
| apply HasLineDerivAt.lineDeriv | |
| have h := (((contDiff_infty_iff_deriv.mp hf).1 (A (x+0β’v))).hasDerivAt).comp 0 | |
| (hA.hasDerivAt_line x v 0) | |
| simpa only [zero_smul, add_zero, HasLineDerivAt, Function.comp_def] using h | |
| theorem variance_comp_le_BddSmooth_block {n : β} {U A J : (Fin n β β) β β} | |
| {ΞΌ : Measure (Fin n β β)} [IsProbabilityMeasure ΞΌ] | |
| (hΞΌ : ΞΌ = volume.withDensity (fun x => ENNReal.ofReal (Real.exp (-U x)))) | |
| (hU : GaussianDominated (fun x => Real.exp (-U x))) (hUc : Continuous U) | |
| (DU : LineDerivatives U) (hA : BddSmooth 2 A) (hJ : BddSmooth 2 J) | |
| (hstrong : β x v, βvβ^2 β€ DU.second x v) | |
| (hblock : β x v s, 0 β€ DU.second x v - 2*s*lineDeriv β A x v + s^2*J x) | |
| {f : β β β} (hf : ContDiff β β f) : | |
| variance (fun x => f (A x)) ΞΌ β€ β« x, (deriv f (A x))^2 * J x βΞΌ := by | |
| have hdf : ContDiff β β (deriv f) := (contDiff_infty_iff_deriv.mp hf).2 | |
| have hg : BddSmooth 2 (fun x => deriv f (A x)) := hA.comp_contDiff hdf | |
| simp only [pow_two] | |
| apply variance_le_BddSmooth_block hΞΌ hU hUc DU (hA.comp_contDiff hf) | |
| ((hg.mul hg).mul hJ) hstrong | |
| intro x v s | |
| rw [hA.down.lineDeriv_comp_contDiff hf x v] | |
| convert hblock x v (s*deriv f (A x)) using 1 | |
| ring | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory | |
| open scoped NNReal Topology | |
| variable {ΞΉ S : Type*} [Fintype ΞΉ] [Fintype S] | |
| theorem gaussianHierarchyMean_const_mul (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (A : S β β) (steps : List (GaussianStep ΞΉ)) (c : β) (x : ΞΉ β β) : | |
| gaussianHierarchyMean w Ο (fun s => c*A s) steps x = | |
| c*gaussianHierarchyMean w Ο A steps x := by | |
| induction steps generalizing x with | |
| | nil => | |
| simp only [gaussianHierarchyMean, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro s _ | |
| ring | |
| | cons p tail ih => | |
| obtain β¨m,qβ© := p | |
| simp only [gaussianHierarchyMean, funext ih] | |
| exact shiftedMean_const_mul c x | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators Topology NNReal | |
| open Hierarchy | |
| abbrev FeatureIndex (n : β) := Sum (Fin n) (CompletedIndex n) | |
| def featureCoefficient (n : β) (Ο : Spin n) : FeatureIndex n β β | |
| | Sum.inl i => spinValue (Ο i) | |
| | Sum.inr j => liftedCoefficients 1 n Ο j | |
| def finiteFeature (n : β) (Ο : Spin n) : (FeatureIndex n β β) βL[β] β := | |
| β i, featureCoefficient n Ο i β’ ContinuousLinearMap.proj i | |
| @[simp] theorem finiteFeature_apply (n : β) (Ο : Spin n) (x : FeatureIndex n β β) : | |
| finiteFeature n Ο x = β i, featureCoefficient n Ο i*x i := by | |
| simp [finiteFeature] | |
| def uniformWeight (n : β) (_ : Spin n) : β := (2 : β)^(-(n : β€)) | |
| theorem uniformWeight_pos (n : β) (Ο : Spin n) : 0 < uniformWeight n Ο := by | |
| exact zpow_pos (by norm_num) _ | |
| def featureSigns {n : β} (Ο : Spin n) : FeatureIndex n β β | |
| | Sum.inl i => spinValue (Ο i) | |
| | Sum.inr none => 1 | |
| | Sum.inr (some e) => spinValue (Ο e.val.1)*spinValue (Ο e.val.2) | |
| theorem featureSigns_sq {n : β} (Ο : Spin n) (i : FeatureIndex n) : | |
| featureSigns Ο i*featureSigns Ο i = 1 := by | |
| rcases i with i | (_ | e) | |
| Β· exact spinValue_sq _ | |
| Β· norm_num [featureSigns] | |
| Β· dsimp [featureSigns] | |
| calc | |
| _ = (spinValue (Ο e.val.1)*spinValue (Ο e.val.1))* | |
| (spinValue (Ο e.val.2)*spinValue (Ο e.val.2)) := by ring | |
| _ = 1 := by rw [spinValue_sq, spinValue_sq]; norm_num | |
| def featureGauge {n : β} (Ο : Spin n) : (FeatureIndex n β β) βL[β] (FeatureIndex n β β) := | |
| signEquiv (featureSigns Ο) (featureSigns_sq Ο) | |
| theorem featureCoefficient_gauge {n : β} (Ο Ο : Spin n) (i : FeatureIndex n) : | |
| featureCoefficient n (spinGauge Ο Ο) i = featureSigns Ο i*featureCoefficient n Ο i := by | |
| rcases i with i | (_ | e) | |
| Β· simp [featureCoefficient, featureSigns, spinGauge] | |
| Β· simp [featureCoefficient, featureSigns, liftedCoefficients] | |
| Β· simp only [featureCoefficient, featureSigns, liftedCoefficients, spinGauge, | |
| Equiv.coe_fn_mk, spinValue_beq] | |
| ring | |
| theorem finiteFeature_gauge {n : β} (Ο Ο : Spin n) (x : FeatureIndex n β β) : | |
| finiteFeature n (spinGauge Ο Ο) (featureGauge Ο x) = finiteFeature n Ο x := by | |
| simp only [finiteFeature_apply] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| rw [featureCoefficient_gauge] | |
| change (featureSigns Ο i * featureCoefficient n Ο i)*(featureSigns Ο i*x i) = _ | |
| calc | |
| _ = (featureSigns Ο i*featureSigns Ο i)*(featureCoefficient n Ο i*x i) := by ring | |
| _ = _ := by rw [featureSigns_sq, one_mul] | |
| theorem featureGauge_gaussian {n : β} (Ο : Spin n) (q : FeatureIndex n β ββ₯0) : | |
| MeasurePreserving (featureGauge Ο) (Measure.pi fun i => gaussianReal 0 (q i)) | |
| (Measure.pi fun i => gaussianReal 0 (q i)) := | |
| signEquiv_gaussian _ _ q | |
| theorem featureGauge_volume {n : β} (Ο : Spin n) : | |
| MeasurePreserving (featureGauge Ο) volume volume := signEquiv_volume _ _ | |
| def finiteSKHierarchy (n : β) (steps : List (GaussianStep (FeatureIndex n))) : | |
| (FeatureIndex n β β) β β := gaussianHierarchy (uniformWeight n) (finiteFeature n) steps | |
| theorem finiteSKHierarchy_gauge (n : β) (steps : List (GaussianStep (FeatureIndex n))) | |
| (Ο : Spin n) (x : FeatureIndex n β β) : | |
| finiteSKHierarchy n steps (featureGauge Ο x) = finiteSKHierarchy n steps x := | |
| gaussianHierarchy_equiv (featureGauge Ο) (spinGauge Ο) (fun _ => rfl) | |
| (finiteFeature_gauge Ο) steps (fun p _ => featureGauge_gaussian Ο p.2) x | |
| def spinSource (n : β) (i : Fin n) : FeatureIndex n β β := | |
| Pi.single (Sum.inl i) (1 / Real.sqrt (n : β)) | |
| theorem finiteFeature_source (n : β) (Ο : Spin n) (i : Fin n) : | |
| finiteFeature n Ο (spinSource n i) = spinValue (Ο i) / Real.sqrt (n : β) := by | |
| classical | |
| simp [finiteFeature_apply, spinSource, Pi.single_apply, featureCoefficient, mul_ite, div_eq_mul_inv] | |
| theorem spinSource_gauge {n : β} (Ο : Spin n) (i : Fin n) : | |
| featureGauge Ο (spinSource n i) = spinValue (Ο i) β’ spinSource n i := by | |
| classical | |
| ext j | |
| change featureSigns Ο j * (Pi.single (Sum.inl i) (1 / Real.sqrt (n : β)) : FeatureIndex n β β) j = | |
| spinValue (Ο i) * (Pi.single (Sum.inl i) (1 / Real.sqrt (n : β)) : FeatureIndex n β β) j | |
| by_cases hj : j = Sum.inl i | |
| Β· subst j; rfl | |
| Β· simp [hj] | |
| def matrixEmbedding (Ξ² : β) (n : β) (x : StandardCompletedDisorder n) : FeatureIndex n β β | |
| | Sum.inl _ => 0 | |
| | Sum.inr i => Ξ²*x i | |
| theorem finiteFeature_matrixEmbedding (Ξ² : β) (n : β) (Ο : Spin n) | |
| (x : StandardCompletedDisorder n) : | |
| finiteFeature n Ο (matrixEmbedding Ξ² n x) = liftedHamiltonian Ξ² n x Ο := by | |
| rw [finiteFeature_apply, liftedHamiltonian_eq_sum, Fintype.sum_sum_type] | |
| simp only [matrixEmbedding, mul_zero, Finset.sum_const_zero, zero_add, featureCoefficient] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| cases i <;> simp only [liftedCoefficients] <;> ring | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Hierarchy | |
| open scoped NNReal Topology BigOperators | |
| theorem spinMean_gauge (n : β) (steps : List (GaussianStep (FeatureIndex n))) | |
| (Ο : Spin n) (x : FeatureIndex n β β) (i : Fin n) : | |
| gaussianHierarchyMean (uniformWeight n) (finiteFeature n) | |
| (fun s => finiteFeature n s (spinSource n i)) steps (featureGauge Ο x) = | |
| spinValue (Ο i) * gaussianHierarchyMean (uniformWeight n) (finiteFeature n) | |
| (fun s => finiteFeature n s (spinSource n i)) steps x := by | |
| rw [gaussianHierarchyMean_equiv (featureGauge Ο) (spinGauge Ο) (fun _ => rfl) | |
| (finiteFeature_gauge Ο) steps (fun p _ => featureGauge_gaussian Ο p.2)] | |
| have he : (fun s => finiteFeature n (spinGauge Ο s) (spinSource n i)) = | |
| (fun s => spinValue (Ο i)*finiteFeature n s (spinSource n i)) := by | |
| funext s | |
| simp only [finiteFeature_source, spinGauge, Equiv.coe_fn_mk, spinValue_beq] | |
| ring | |
| rw [he, gaussianHierarchyMean_const_mul] | |
| theorem spinObservable_gauge (n : β) (steps : List (GaussianStep (FeatureIndex n))) | |
| (Ο Ο : Spin n) (x : FeatureIndex n β β) : | |
| driverObservable (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) (spinGauge Ο Ο) (featureGauge Ο x) = | |
| driverObservable (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) Ο x := by | |
| unfold driverObservable driverMean | |
| simp only [ContinuousLinearMap.id_apply] | |
| simp_rw [spinMean_gauge] | |
| simp only [finiteFeature_source, spinGauge, Equiv.coe_fn_mk, spinValue_beq] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| have hs := spinValue_sq (Ο i) | |
| rcases mul_self_eq_one_iff.mp hs with hi | hi <;> rw [hi] <;> ring | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Hierarchy | |
| open scoped NNReal Topology BigOperators | |
| theorem spinDriverSource_gauge (n : β) (steps : List (GaussianStep (FeatureIndex n))) | |
| (Ο Ο : Spin n) (x : FeatureIndex n β β) : | |
| driverSource (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) (spinGauge Ο Ο) (featureGauge Ο x) = | |
| featureGauge Ο (driverSource (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) Ο x) := by | |
| unfold driverSource driverMean | |
| simp only [ContinuousLinearMap.id_apply, map_sum, map_smul, spinSource_gauge, smul_smul] | |
| simp_rw [spinMean_gauge] | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| congr 1 | |
| simp only [finiteFeature_source, spinGauge, Equiv.coe_fn_mk, spinValue_beq] | |
| ring | |
| theorem spinEnergy_gauge (n : β) (steps : List (GaussianStep (FeatureIndex n))) | |
| {a : β} (ha : OrderedSteps a steps) (Ο Ο : Spin n) (x : FeatureIndex n β β) : | |
| driverEnergy (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) (spinGauge Ο Ο) (featureGauge Ο x) = | |
| driverEnergy (uniformWeight n) (finiteFeature n) steps | |
| (ContinuousLinearMap.id β _) (spinSource n) Ο x := by | |
| rw [driverEnergy_eq (uniformWeight_pos n) (finiteFeature n) steps ha, | |
| driverEnergy_eq (uniformWeight_pos n) (finiteFeature n) steps ha] | |
| simp only [ContinuousLinearMap.id_apply, spinDriverSource_gauge] | |
| exact gaussianHierarchyHessian_equiv (featureGauge Ο) (spinGauge Ο) (uniformWeight_pos n) | |
| (fun _ => rfl) (finiteFeature_gauge Ο) steps ha | |
| (fun p _ => featureGauge_gaussian Ο p.2) _ _ _ | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Hierarchy | |
| open scoped NNReal Topology BigOperators | |
| abbrev IncrementIndex (n L : β) := Fin (L+1) Γ FeatureIndex n | |
| abbrev DriverDimension (n L : β) := Fintype.card (IncrementIndex n L) | |
| def prefixDriver (n L : β) (q : Fin (L+1) β FeatureIndex n β ββ₯0) | |
| (cut : Fin (L+1)) : (Fin (DriverDimension n L) β β) βL[β] (FeatureIndex n β β) := | |
| ContinuousLinearMap.pi fun i => β k β Finset.univ.filter (Β· β€ cut), | |
| Real.sqrt (q k i : β) β’ ContinuousLinearMap.proj (Fintype.equivFin (IncrementIndex n L) (k,i)) | |
| @[simp] theorem prefixDriver_apply (n L : β) (q : Fin (L+1) β FeatureIndex n β ββ₯0) | |
| (cut : Fin (L+1)) (x : Fin (DriverDimension n L) β β) (i : FeatureIndex n) : | |
| prefixDriver n L q cut x i = β k β Finset.univ.filter (Β· β€ cut), | |
| Real.sqrt (q k i : β)*x (Fintype.equivFin (IncrementIndex n L) (k,i)) := by | |
| simp [prefixDriver] | |
| def driverSigns (n L : β) (Ο : Spin n) (j : Fin (DriverDimension n L)) : β := | |
| featureSigns Ο ((Fintype.equivFin (IncrementIndex n L)).symm j).2 | |
| theorem driverSigns_sq (n L : β) (Ο : Spin n) (j : Fin (DriverDimension n L)) : | |
| driverSigns n L Ο j*driverSigns n L Ο j = 1 := featureSigns_sq Ο _ | |
| def driverGauge (n L : β) (Ο : Spin n) : | |
| (Fin (DriverDimension n L) β β) βL[β] (Fin (DriverDimension n L) β β) := | |
| signEquiv (driverSigns n L Ο) (driverSigns_sq n L Ο) | |
| theorem prefixDriver_gauge (n L : β) (q : Fin (L+1) β FeatureIndex n β ββ₯0) | |
| (cut : Fin (L+1)) (Ο : Spin n) (x : Fin (DriverDimension n L) β β) : | |
| prefixDriver n L q cut (driverGauge n L Ο x) = featureGauge Ο (prefixDriver n L q cut x) := by | |
| ext i | |
| simp only [prefixDriver_apply, driverGauge, signEquiv_apply, driverSigns, | |
| Equiv.symm_apply_apply, featureGauge] | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro k _ | |
| ring | |
| def skPinFrame (n L : β) (q : Fin (L+1) β FeatureIndex n β ββ₯0) | |
| (cut : Fin (L+1)) (steps : List (GaussianStep (FeatureIndex n))) | |
| (a : β) (ha : OrderedSteps a steps) : | |
| PinFrame (FeatureIndex n) (Spin n) (Fin n) (DriverDimension n L) where | |
| weight := uniformWeight n | |
| weight_pos := uniformWeight_pos n | |
| feature := finiteFeature n | |
| steps := steps | |
| mass := a | |
| ordered := ha | |
| driver := prefixDriver n L q cut | |
| source := spinSource n | |
| end SKFluctuations | |
| namespace SKFluctuations | |
| open MeasureTheory ProbabilityTheory Hierarchy | |
| open scoped NNReal Topology BigOperators | |
| variable {n L : β} (q : Fin (L+1) β FeatureIndex n β ββ₯0) | |
| (cuts : Fin (L+1) β Fin (L+1)) | |
| (steps : Fin (L+1) β List (GaussianStep (FeatureIndex n))) | |
| (a : Fin (L+1) β β) (ha : β j, OrderedSteps (a j) (steps j)) | |
| abbrev skPinFamily : Fin (L+1) β PinFrame (FeatureIndex n) (Spin n) (Fin n) (DriverDimension n L) := | |
| fun j => skPinFrame n L q (cuts j) (steps j) (a j) (ha j) | |
| theorem skPinFrame_potential_gauge (j : Fin (L+1)) (Ο : Spin n) | |
| (x : Fin (DriverDimension n L) β β) : | |
| (skPinFamily q cuts steps a ha j).potential (driverGauge n L Ο x) = | |
| (skPinFamily q cuts steps a ha j).potential x := by | |
| change finiteSKHierarchy n (steps j) (prefixDriver n L q (cuts j) (driverGauge n L Ο x)) = _ | |
| rw [prefixDriver_gauge, finiteSKHierarchy_gauge] | |
| rfl | |
| theorem skPinFrame_observable_gauge (j : Fin (L+1)) (Ο Ο : Spin n) | |
| (x : Fin (DriverDimension n L) β β) : | |
| (skPinFamily q cuts steps a ha j).observable (spinGauge Ο Ο) (driverGauge n L Ο x) = | |
| (skPinFamily q cuts steps a ha j).observable Ο x := by | |
| change driverObservable (uniformWeight n) (finiteFeature n) (steps j) | |
| (ContinuousLinearMap.id β _) (spinSource n) (spinGauge Ο Ο) | |
| (prefixDriver n L q (cuts j) (driverGauge n L Ο x)) = | |
| driverObservable (uniformWeight n) (finiteFeature n) (steps j) | |
| (ContinuousLinearMap.id β _) (spinSource n) Ο (prefixDriver n L q (cuts j) x) | |
| rw [prefixDriver_gauge] | |
| exact spinObservable_gauge n (steps j) Ο Ο (prefixDriver n L q (cuts j) x) | |
| theorem skPinFrame_energy_gauge (j : Fin (L+1)) (Ο Ο : Spin n) | |
| (x : Fin (DriverDimension n L) β β) : | |
| (skPinFamily q cuts steps a ha j).energy (spinGauge Ο Ο) (driverGauge n L Ο x) = | |
| (skPinFamily q cuts steps a ha j).energy Ο x := by | |
| change driverEnergy (uniformWeight n) (finiteFeature n) (steps j) | |
| (ContinuousLinearMap.id β _) (spinSource n) (spinGauge Ο Ο) | |
| (prefixDriver n L q (cuts j) (driverGauge n L Ο x)) = | |
| driverEnergy (uniformWeight n) (finiteFeature n) (steps j) | |
| (ContinuousLinearMap.id β _) (spinSource n) Ο (prefixDriver n L q (cuts j) x) | |
| rw [prefixDriver_gauge] | |
| exact spinEnergy_gauge n (steps j) (ha j) Ο Ο (prefixDriver n L q (cuts j) x) | |
| theorem driverQuadratic_gauge (Ο : Spin n) (x : Fin (DriverDimension n L) β β) : | |
| driverQuadratic (driverGauge n L Ο x) = driverQuadratic x := by | |
| unfold driverQuadratic | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro i _ | |
| change (driverSigns n L Ο i*x i)^2 = (x i)^2 | |
| rw [mul_pow] | |
| have hi := driverSigns_sq n L Ο i | |
| nlinarith [sq_nonneg (x i)] | |
| theorem skPinned_joint_test_gauge (Ξ± k : Fin (L+1) β β) (Ο Ο : Spin n) (f : β Γ β β β) : | |
| let P := skPinFamily q cuts steps a ha | |
| let U := fun Ο => pinnedPotential P Ξ± ((finiteFeature n Ο).comp (prefixDriver n L q (Fin.last L))) | |
| (β« x, f (pinnedObservable P Ξ± k (spinGauge Ο Ο) x, pinnedEnergy P Ξ± k (spinGauge Ο Ο) x) | |
| βpotentialLaw (U (spinGauge Ο Ο))) = | |
| β« x, f (pinnedObservable P Ξ± k Ο x, pinnedEnergy P Ξ± k Ο x) βpotentialLaw (U Ο) := by | |
| dsimp only | |
| apply potentialLaw_joint_test_eq (driverGauge n L Ο) (signEquiv_volume _ _) | |
| Β· intro x | |
| unfold pinnedPotential | |
| rw [driverQuadratic_gauge] | |
| simp only [ContinuousLinearMap.comp_apply, prefixDriver_gauge, finiteFeature_gauge] | |
| simp_rw [skPinFrame_potential_gauge] | |
| Β· intro x | |
| unfold pinnedObservable | |
| simp_rw [skPinFrame_observable_gauge] | |
| Β· intro x | |
| unfold pinnedEnergy | |
| simp_rw [skPinFrame_energy_gauge] | |
| end SKFluctuations | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology ContDiff | |
| theorem deriv_smoothAbsPower {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (p x : β) : | |
| deriv (smoothAbsPower Ξ΅ p) x = p*x*(x^2+Ξ΅)^(p/2-1) := by | |
| have h : HasDerivAt (smoothAbsPower Ξ΅ p) | |
| ((2*x)*(p/2)*(x^2+Ξ΅)^(p/2-1)) x := by | |
| change HasDerivAt (fun y : β => (y^2+Ξ΅)^(p/2)) _ x | |
| simpa using (((hasDerivAt_id x).pow 2).add_const Ξ΅).rpow_const (p := p/2) | |
| (Or.inl (ne_of_gt (add_pos_of_nonneg_of_pos (sq_nonneg x) hΞ΅))) | |
| rw [h.deriv] | |
| ring | |
| theorem deriv_smoothAbsPower_sq_le {Ξ΅ p : β} (hΞ΅ : 0 < Ξ΅) (x : β) : | |
| (deriv (smoothAbsPower Ξ΅ p) x)^2 β€ p^2*(x^2+Ξ΅)^(p-1) := by | |
| rw [deriv_smoothAbsPower hΞ΅] | |
| have hz : 0 < x^2+Ξ΅ := add_pos_of_nonneg_of_pos (sq_nonneg _) hΞ΅ | |
| have he : ((x^2+Ξ΅)^(p/2-1))^2 = (x^2+Ξ΅)^(p-2) := by | |
| rw [β Real.rpow_natCast, β Real.rpow_mul hz.le] | |
| congr 1 | |
| ring | |
| have he' : (x^2+Ξ΅)^(p-1) = (x^2+Ξ΅)*(x^2+Ξ΅)^(p-2) := by | |
| rw [show p-1 = 1+(p-2) by ring, Real.rpow_add hz, Real.rpow_one] | |
| rw [mul_pow, mul_pow, he, he'] | |
| rw [mul_assoc] | |
| apply mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right (by linarith) | |
| (Real.rpow_nonneg hz.le _)) (sq_nonneg p) | |
| theorem smoothAbsPower_sq {Ξ΅ : β} (hΞ΅ : 0 β€ Ξ΅) (p x : β) : | |
| (smoothAbsPower Ξ΅ p x)^2 = (x^2+Ξ΅)^p := by | |
| unfold smoothAbsPower | |
| rw [β Real.rpow_natCast, β Real.rpow_mul (by positivity)] | |
| congr 1 | |
| ring | |
| theorem smoothAbsPower_zero (p : β) (x : β) : smoothAbsPower 0 p x = |x|^p := by | |
| unfold smoothAbsPower | |
| rw [add_zero, β sq_abs, β Real.rpow_natCast, β Real.rpow_mul (abs_nonneg x)] | |
| congr 1 | |
| ring | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology ContDiff | |
| def powerEps (k : β) : β := 1 / ((k : β)+1) | |
| theorem powerEps_pos (k : β) : 0 < powerEps k := by unfold powerEps; positivity | |
| theorem powerEps_le_one (k : β) : powerEps k β€ 1 := by | |
| unfold powerEps | |
| rw [div_le_one (by positivity)] | |
| linarith [Nat.cast_nonneg (Ξ± := β) k] | |
| theorem powerEps_tendsto : Tendsto powerEps atTop (π 0) := | |
| tendsto_one_div_add_atTop_nhds_zero_nat | |
| theorem integral_regularized_power_tendsto {E : Type*} [NormedAddCommGroup E] | |
| [NormedSpace β E] [MeasurableSpace E] [BorelSpace E] | |
| {ΞΌ : Measure E} [IsFiniteMeasure ΞΌ] {A J : E β β} | |
| (hA : BddSmooth 0 A) (hJ : BddSmooth 0 J) {p : β} (hp : 0 β€ p) : | |
| Tendsto (fun k => β« x, (A x^2+powerEps k)^p * J x βΞΌ) atTop | |
| (π (β« x, |A x|^(2*p)*J x βΞΌ)) := by | |
| obtain β¨B,hB,hAbβ© := hA.bound | |
| obtain β¨C,hC,hJbβ© := hJ.bound | |
| apply tendsto_integral_of_dominated_convergence (fun _ => (B^2+1)^p*C) | |
| Β· intro k | |
| exact ((Real.continuous_rpow_const hp).comp | |
| ((hA.continuous.pow 2).add continuous_const) |>.mul hJ.continuous).aestronglyMeasurable | |
| Β· exact integrable_const _ | |
| Β· intro k | |
| filter_upwards [] with x | |
| have hz : 0 β€ A x^2+powerEps k := add_nonneg (sq_nonneg _) (powerEps_pos k).le | |
| rw [norm_mul, Real.norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg hz _)] | |
| apply mul_le_mul _ (hJb x) (abs_nonneg _) (Real.rpow_nonneg (by positivity) _) | |
| apply Real.rpow_le_rpow hz _ hp | |
| have hab : A x^2 β€ B^2 := by | |
| simpa only [sq_abs] using (sq_le_sqβ (abs_nonneg _) hB).mpr (hAb x) | |
| linarith [powerEps_le_one k] | |
| Β· filter_upwards [] with x | |
| have ht : Tendsto (fun k => A x^2+powerEps k) atTop (π (A x^2)) := by | |
| simpa using tendsto_const_nhds.add powerEps_tendsto (a := A x^2) | |
| have he : (A x^2)^p = |A x|^(2*p) := by | |
| rw [β sq_abs, β Real.rpow_natCast, β Real.rpow_mul (abs_nonneg _)] | |
| norm_num | |
| simpa only [he, Function.comp_def] using ((Real.continuous_rpow_const hp).tendsto _ |>.comp ht).mul_const (J x) | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped NNReal Topology ContDiff | |
| open SKFluctuations.PinnedVariance SKFluctuations.PreKopa | |
| theorem BddSmooth.memLp {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [MeasurableSpace E] [BorelSpace E] {ΞΌ : Measure E} [IsFiniteMeasure ΞΌ] | |
| {r : β} {A : E β β} (hA : BddSmooth r A) (p : ENNReal) : MemLp A p ΞΌ := by | |
| obtain β¨B,_,hBβ© := hA.bound | |
| exact MemLp.of_bound hA.continuous.aestronglyMeasurable B (ae_of_all _ hB) | |
| theorem BddSmooth.integrable {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [MeasurableSpace E] [BorelSpace E] {ΞΌ : Measure E} [IsFiniteMeasure ΞΌ] | |
| {r : β} {A : E β β} (hA : BddSmooth r A) : Integrable A ΞΌ := | |
| memLp_one_iff_integrable.mp (hA.memLp 1) | |
| theorem regularized_power_moment_le {n : β} {U A J : (Fin n β β) β β} | |
| {ΞΌ : Measure (Fin n β β)} [IsProbabilityMeasure ΞΌ] | |
| (hΞΌ : ΞΌ = volume.withDensity (fun x => ENNReal.ofReal (Real.exp (-U x)))) | |
| (hU : GaussianDominated (fun x => Real.exp (-U x))) (hUc : Continuous U) | |
| (DU : LineDerivatives U) (hA : BddSmooth 2 A) (hJ : BddSmooth 2 J) | |
| (hJ0 : β x, 0 β€ J x) | |
| (hstrong : β x v, βvβ^2 β€ DU.second x v) | |
| (hblock : β x v s, 0 β€ DU.second x v - 2*s*lineDeriv β A x v + s^2*J x) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (p : β) : | |
| (β« x, (A x^2+Ξ΅)^(p/2) βΞΌ) β€ | |
| (β« x, (A x^2+Ξ΅)^(p/4) βΞΌ)^2 + | |
| (p^2/4)*(β« x, (A x^2+Ξ΅)^((p-2)/2)*J x βΞΌ) := by | |
| let f := smoothAbsPower Ξ΅ (p/2) | |
| have hf : ContDiff β β f := contDiff_smoothAbsPower hΞ΅ _ | |
| have hAf := hA.comp_contDiff hf | |
| have hdf := hA.comp_contDiff (contDiff_infty_iff_deriv.mp hf).2 | |
| have hG : BddSmooth 2 (fun x => (A x^2+Ξ΅)^((p-2)/2)*J x) := | |
| (hA.smoothAbsPower hΞ΅ (p-2)).mul hJ | |
| have hv := variance_comp_le_BddSmooth_block hΞΌ hU hUc DU hA hJ hstrong hblock hf | |
| rw [variance_eq_sub (hAf.memLp 2)] at hv | |
| have he : (β« x, (deriv f (A x))^2*J x βΞΌ) β€ | |
| (p^2/4)*(β« x, (A x^2+Ξ΅)^((p-2)/2)*J x βΞΌ) := by | |
| rw [β integral_const_mul] | |
| apply integral_mono | |
| Β· simpa only [pow_two] using ((hdf.mul hdf).mul hJ).integrable (ΞΌ := ΞΌ) | |
| Β· exact (hG.const_mul (p^2/4)).integrable | |
| Β· intro x | |
| have he := mul_le_mul_of_nonneg_right (deriv_smoothAbsPower_sq_le hΞ΅ (p := p/2) (A x)) (hJ0 x) | |
| have hexp : p/2-1 = (p-2)/2 := by ring | |
| have hcoef : (p/2)^2 = p^2/4 := by ring | |
| simpa only [f, hexp, hcoef, mul_assoc] using he | |
| have hsq : (β« x, ((fun x => f (A x))^2) x βΞΌ) = β« x, (A x^2+Ξ΅)^(p/2) βΞΌ := by | |
| apply integral_congr_ae | |
| filter_upwards [] with x | |
| exact smoothAbsPower_sq hΞ΅.le _ _ | |
| have hmean : (β« x, f (A x) βΞΌ) = β« x, (A x^2+Ξ΅)^(p/4) βΞΌ := by | |
| congr 1 | |
| funext x | |
| dsimp [f, smoothAbsPower] | |
| congr 1 | |
| ring | |
| rw [hsq, hmean] at hv | |
| linarith | |
| theorem power_moment_le {n : β} {U A J : (Fin n β β) β β} | |
| {ΞΌ : Measure (Fin n β β)} [IsProbabilityMeasure ΞΌ] | |
| (hΞΌ : ΞΌ = volume.withDensity (fun x => ENNReal.ofReal (Real.exp (-U x)))) | |
| (hU : GaussianDominated (fun x => Real.exp (-U x))) (hUc : Continuous U) | |
| (DU : LineDerivatives U) (hA : BddSmooth 2 A) (hJ : BddSmooth 2 J) | |
| (hJ0 : β x, 0 β€ J x) | |
| (hstrong : β x v, βvβ^2 β€ DU.second x v) | |
| (hblock : β x v s, 0 β€ DU.second x v - 2*s*lineDeriv β A x v + s^2*J x) | |
| {p : β} (hp : 2 < p) : | |
| (β« x, |A x|^p βΞΌ) β€ (β« x, |A x|^(p/2) βΞΌ)^2 + | |
| (p^2/4)*(β« x, |A x|^(p-2)*J x βΞΌ) := by | |
| have hβ := integral_regularized_power_tendsto (ΞΌ := ΞΌ) hA.down.down | |
| (BddSmooth.const 0 (1 : β)) (p := p/2) (by linarith) | |
| have hβ := integral_regularized_power_tendsto (ΞΌ := ΞΌ) hA.down.down | |
| (BddSmooth.const 0 (1 : β)) (p := p/4) (by linarith) | |
| have hβ := integral_regularized_power_tendsto (ΞΌ := ΞΌ) hA.down.down hJ.down.down | |
| (p := (p-2)/2) (by linarith) | |
| have heβ : 2*(p/2) = p := by ring | |
| have heβ : 2*(p/4) = p/2 := by ring | |
| have heβ : 2*((p-2)/2) = p-2 := by ring | |
| simp only [mul_one, heβ, heβ, heβ] at hβ hβ hβ | |
| exact le_of_tendsto_of_tendsto hβ ((hβ.pow 2).add (hβ.const_mul (p^2/4))) | |
| (Filter.Eventually.of_forall fun k => regularized_power_moment_le hΞΌ hU hUc DU hA hJ hJ0 hstrong hblock | |
| (powerEps_pos k) p) | |
| end SKFluctuations.Hierarchy | |
| end | |
| end OAI | |