Download data/lean/OAI/Probability/SKFluctuations/FeatureClockResponse.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 35.6 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/FeatureClockResponse.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKFluctuations/FeatureClockResponse.lean
-
curl -L -o FeatureClockResponse.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKFluctuations/FeatureClockResponse.lean
35.6 kB
| import Mathlib | |
| import OAI.Probability.SKFluctuations.FilledSquare | |
| namespace OAI | |
| /-! Feature Clock Response. -/ | |
| 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 | |
| variable {ΞΉ S : Type*} [Fintype ΞΉ] [Fintype S] [Nonempty S] {n : β} | |
| noncomputable def featureClockResponse (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) (steps : List (GaussianStep ΞΉ)) (m : β) : β β (ΞΉ β β) β β := | |
| linearClockDerivative L m (gaussianHierarchy w Ο steps) | |
| (fun i => gaussianHierarchyMean w Ο (fun Ο => Ο Ο (L (Pi.single i 1))) steps) | |
| (fun i => gaussianHierarchyResponse w Ο (fun Ο => Ο Ο (L (Pi.single i 1))) (L (Pi.single i 1)) steps) | |
| theorem featureClockResponse_bound {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) {Q m : β} | |
| (hQ : β Ο, β i, (Ο Ο (L (Pi.single i 1)))^2 = Q) | |
| (steps : List (GaussianStep ΞΉ)) (ha : OrderedSteps m steps) (t : β) (x : ΞΉ β β) : | |
| |featureClockResponse w Ο L steps m t x| β€ Q/2 := by | |
| obtain β¨C,hFβ© := (gaussianHierarchy_regular hw Ο steps ha 0).1 | |
| have hi := (exponentialIncrement_linearGaussian L (Real.toNNReal t)).integrable_shift hF m x | |
| have hP := linearFeaturePenalty_smooth hw Ο L steps ha 0 | |
| have hp : 0 β€ linearClockTest L m (gaussianHierarchy w Ο steps) (linearFeaturePenalty w Ο L m steps) t x := | |
| shiftedMean_nonneg (fun y => (linearFeaturePenalty_bounds hw Ο L hQ steps ha y).1) hi | |
| have hb : linearClockTest L m (gaussianHierarchy w Ο steps) (linearFeaturePenalty w Ο L m steps) t x β€ Q := by | |
| have hh := shiftedMean_mono hP (BddSmooth.const 0 Q) | |
| (fun y => (le_abs_self _).trans (linearFeaturePenalty_abs_le hw Ο L hQ steps ha y)) hi | |
| rwa [shiftedMean_const Q hi] at hh | |
| unfold featureClockResponse | |
| rw [linearClockDerivative_feature_trace hw Ο L hQ steps ha t x] | |
| rw [abs_of_nonneg (mul_nonneg (by norm_num) (sub_nonneg.mpr hb))] | |
| linarith | |
| theorem parametric_featureClock {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) {Q m : β} | |
| (hQ : β Ο, β i, (Ο Ο (L (Pi.single i 1)))^2 = Q) | |
| (steps : List (GaussianStep ΞΉ)) (ha : OrderedSteps m steps) (hm : 0 < m) (r : β) : | |
| ParametricRegular 0 r (Q/2) (linearClockContinuation L m (gaussianHierarchy w Ο steps)) | |
| (featureClockResponse w Ο L steps m) := by | |
| obtain β¨C,hCβ© := (gaussianHierarchy_regular hw Ο steps ha 0).1 | |
| obtain β¨K,hKβ© := parametric_linear_clock L hC | |
| (fun i => gaussianHierarchyMean_smooth hw Ο _ steps ha 0) | |
| (fun i => gaussianHierarchyResponse_smooth hw Ο _ _ steps ha 0) | |
| (fun y => (gaussianHierarchy_linear_feature_derivatives hw Ο L steps ha y).1) | |
| (fun y => (gaussianHierarchy_linear_feature_derivatives hw Ο L steps ha y).2) hm | |
| have hQ0 : 0 β€ Q := by | |
| obtain β¨Οβ© := βΉNonempty SβΊ | |
| rw [β hQ Ο] | |
| exact Finset.sum_nonneg fun i _ => sq_nonneg _ | |
| exact β¨by positivity,(hK r).spatial,(hK r).continuous, | |
| fun t _ x => featureClockResponse_bound hw Ο L hQ steps ha t x,(hK r).derivativeβ© | |
| namespace ReplicaTree | |
| theorem clockResponse_smooth0 {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| (P : T.Assignment β β) (t : β) : BddSmooth 0 (T.clockResponse w Ο L m P t) := by | |
| have hF := gaussianHierarchy_regular hw Ο steps ha 0 | |
| have hi := (exponentialIncrement_linearGaussian L (Real.toNNReal t)).integrable_shift hF.1.choose_spec m | |
| exact (((T.powerTrace_smooth hw Ο L ha P 0).shiftedMean hF hi).sub | |
| (((T.expect_smooth hw Ο ha P 0).shiftedMean hF hi).mul | |
| ((T.powerTrace_smooth hw Ο L ha (fun _ => 1) 0).shiftedMean hF hi))).const_mul (1/2) | |
| theorem parametric_clockTest {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| {P : T.Assignment β β} {C : β} (D : Fin (n+1) β β) | |
| (hC : 0 β€ C) (hD : β i, 0 β€ D i) (hP : β Ο, |P Ο| β€ C) | |
| (hB : β i Ο, |Ο Ο (L (Pi.single i 1))| β€ D i) (r : β) : | |
| ParametricTest 0 r (C+4*(T.leaves:β)*(T.leaves+1:β)*C*β i, (D i)^2) | |
| (linearClockTest L m (gaussianHierarchy w Ο steps) (T.expect w Ο P)) | |
| (T.clockResponse w Ο L m P) := by | |
| have hK : 0 β€ 4*(T.leaves:β)*(T.leaves+1:β)*C*β i, (D i)^2 := by positivity | |
| refine β¨by positivity,?_,fun t _ => (T.clockResponse_smooth0 hw Ο L ha P t).continuous,?_,?_,?_β© | |
| Β· intro t _ | |
| have hF := gaussianHierarchy_regular hw Ο steps ha 0 | |
| exact ((T.expect_smooth hw Ο ha P 0).shiftedMean hF | |
| ((exponentialIncrement_linearGaussian L (Real.toNNReal t)).integrable_shift hF.1.choose_spec m)).continuous | |
| Β· intro t _ x | |
| exact (T.clock_abs_le hw Ο L ha hP t x).trans (le_add_of_nonneg_right hK) | |
| Β· intro t _ x | |
| exact (T.clockResponse_abs_le hw Ο L ha D hC hD hP hB t x).trans (le_add_of_nonneg_left hC) | |
| Β· intro t ht x | |
| exact (T.hasDerivWithinAt_linearClockTest hw Ο L ha P x ht.1.le).hasDerivAt (Ici_mem_nhds ht.1) | |
| end ReplicaTree | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| theorem finite_law_variation_dual {ΞΊ : Type*} [Fintype ΞΊ] {R : ΞΊ β β} {K : β} | |
| (h : β P : ΞΊ β β, (β Ο, |P Ο| β€ 1) β |β Ο, P Ο*R Ο| β€ K) : | |
| β Ο, |R Ο| β€ K := by | |
| classical | |
| let P : ΞΊ β β := fun Ο => if 0 β€ R Ο then 1 else -1 | |
| have hP : β Ο, |P Ο| β€ 1 := by intro Ο; dsimp [P]; split_ifs <;> norm_num | |
| have he : β Ο, P Ο*R Ο = β Ο, |R Ο| := by | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| dsimp [P] | |
| split_ifs with hh | |
| Β· rw [one_mul,abs_of_nonneg hh] | |
| Β· rw [neg_one_mul,abs_of_neg (lt_of_not_ge hh)] | |
| have hh := h P hP | |
| rw [he,abs_of_nonneg (Finset.sum_nonneg fun Ο _ => abs_nonneg _)] at hh | |
| exact hh | |
| variable {ΞΉ S : Type*} [Fintype ΞΉ] [Fintype S] [Nonempty S] {n : β} | |
| namespace ReplicaTree | |
| theorem clockTest_atomic {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| [DecidableEq T.Assignment] (P : T.Assignment β β) (t : β) (x : ΞΉ β β) : | |
| linearClockTest L m (gaussianHierarchy w Ο steps) (T.expect w Ο P) t x = | |
| β Ο, P Ο*linearClockTest L m (gaussianHierarchy w Ο steps) | |
| (T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0)) t x := by | |
| have hF := gaussianHierarchy_regular hw Ο steps ha 0 | |
| have hi := (exponentialIncrement_linearGaussian L (Real.toNNReal t)).integrable_shift hF.1.choose_spec m x | |
| have he : T.expect w Ο P = fun y => β Ο, P Ο*T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0) y := by | |
| funext y | |
| simp_rw [T.expect_indicator] | |
| unfold expect | |
| apply Finset.sum_congr rfl | |
| intro Ο _ | |
| ring | |
| change shiftedMean _ _ _ _ _ = _ | |
| rw [he,shiftedMean_finsetSum Finset.univ | |
| (fun Ο _ => (T.expect_smooth hw Ο ha (fun Ο => if Ο = Ο then 1 else 0) 0).const_mul (P Ο)) hi] | |
| simp only [shiftedMean_const_mul,linearClockTest] | |
| theorem clockResponse_atomic {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| [DecidableEq T.Assignment] (P : T.Assignment β β) {t : β} (ht : 0 < t) (x : ΞΉ β β) : | |
| T.clockResponse w Ο L m P t x = | |
| β Ο, P Ο*T.clockResponse w Ο L m (fun Ο => if Ο = Ο then 1 else 0) t x := by | |
| have hd (P : T.Assignment β β) := | |
| (T.hasDerivWithinAt_linearClockTest hw Ο L ha P x ht.le).hasDerivAt (Ici_mem_nhds ht) | |
| have hs := HasDerivAt.fun_sum (u := Finset.univ) (fun Ο _ => (hd (fun Ο => if Ο = Ο then 1 else 0)).const_mul (P Ο)) | |
| have hh : HasDerivAt (fun s => linearClockTest L m (gaussianHierarchy w Ο steps) (T.expect w Ο P) s x) | |
| (β Ο, P Ο*T.clockResponse w Ο L m (fun Ο => if Ο = Ο then 1 else 0) t x) t := by | |
| have he : (fun s => linearClockTest L m (gaussianHierarchy w Ο steps) (T.expect w Ο P) s x) = | |
| (fun s => β Ο, P Ο*linearClockTest L m (gaussianHierarchy w Ο steps) | |
| (T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0)) s x) := | |
| funext fun s => T.clockTest_atomic hw Ο L ha P s x | |
| rw [he] | |
| exact hs | |
| exact (hd P).unique hh | |
| theorem atomic_clockResponse_variation {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| [DecidableEq T.Assignment] (D : Fin (n+1) β β) | |
| (hD : β i, 0 β€ D i) (hB : β i Ο, |Ο Ο (L (Pi.single i 1))| β€ D i) | |
| {t : β} (ht : 0 < t) (x : ΞΉ β β) : | |
| β Ο, |T.clockResponse w Ο L m (fun Ο => if Ο = Ο then 1 else 0) t x| β€ | |
| 4*(T.leaves:β)*(T.leaves+1:β)*β i, (D i)^2 := by | |
| apply finite_law_variation_dual | |
| intro P hP | |
| rw [β T.clockResponse_atomic hw Ο L ha P ht x] | |
| simpa only [mul_one] using T.clockResponse_abs_le hw Ο L ha D (by norm_num : (0:β) β€ 1) hD hP hB t x | |
| theorem atomic_clockTest_probability {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (T : ReplicaTree ΞΉ S steps) {m : β} (ha : OrderedSteps m steps) | |
| [DecidableEq T.Assignment] (t : β) (x : ΞΉ β β) : | |
| (β Ο, 0 β€ linearClockTest L m (gaussianHierarchy w Ο steps) | |
| (T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0)) t x) β§ | |
| (β Ο, linearClockTest L m (gaussianHierarchy w Ο steps) | |
| (T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0)) t x) = 1 := by | |
| have hF := gaussianHierarchy_regular hw Ο steps ha 0 | |
| have hi := (exponentialIncrement_linearGaussian L (Real.toNNReal t)).integrable_shift hF.1.choose_spec m x | |
| refine β¨fun Ο => ?_,?_β© | |
| Β· apply shiftedMean_nonneg _ hi | |
| intro y | |
| rw [T.expect_indicator] | |
| exact T.weight_nonneg hw Ο ha Ο y | |
| Β· have hh := T.clockTest_atomic hw Ο L ha (fun _ => 1) t x | |
| simp only [one_mul] at hh | |
| rw [β hh] | |
| have he : T.expect w Ο (fun _ => 1) = fun _ => 1 := funext fun y => T.expect_const hw Ο ha 1 y | |
| unfold linearClockTest | |
| rw [he,shiftedMean_const 1 hi] | |
| end ReplicaTree | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| universe uB vB wB | |
| inductive BoundaryTree (ΞΉ : Type uB) (Ξ² : Type vB) : List (GaussianStep ΞΉ) β Type (max uB vB) where | |
| | leaf (b : Ξ²) : BoundaryTree ΞΉ Ξ² [] | |
| | step (st : GaussianStep ΞΉ) {tail : List (GaussianStep ΞΉ)} | |
| (T : BoundaryTree ΞΉ Ξ² tail) : BoundaryTree ΞΉ Ξ² (st::tail) | |
| | fork {front : List (GaussianStep ΞΉ)} (T U : BoundaryTree ΞΉ Ξ² front) : BoundaryTree ΞΉ Ξ² front | |
| variable {ΞΉ : Type uB} {Ξ² : Type vB} {ΞΊ : Ξ² β Type wB} | |
| @[reducible] def BoundaryTree.Assignment (ΞΊ : Ξ² β Type wB) : | |
| {front : List (GaussianStep ΞΉ)} β BoundaryTree ΞΉ Ξ² front β Type wB | |
| | _, .leaf b => ΞΊ b | |
| | _, .step _ T => T.Assignment ΞΊ | |
| | _, .fork T U => T.Assignment ΞΊ Γ U.Assignment ΞΊ | |
| @[instance_reducible] noncomputable def BoundaryTree.assignmentFintype [β b, Fintype (ΞΊ b)] : | |
| {front : List (GaussianStep ΞΉ)} β (T : BoundaryTree ΞΉ Ξ² front) β Fintype (T.Assignment ΞΊ) | |
| | _, .leaf b => inferInstanceAs (Fintype (ΞΊ b)) | |
| | _, .step _ T => T.assignmentFintype | |
| | _, .fork T U => _ _ T.assignmentFintype U.assignmentFintype | |
| attribute [instance] BoundaryTree.assignmentFintype | |
| variable [Fintype ΞΉ] | |
| noncomputable def BoundaryTree.weight (F : β β (ΞΉ β β) β β) | |
| (W : β b, ΞΊ b β β β (ΞΉ β β) β β) : | |
| {front : List (GaussianStep ΞΉ)} β (T : BoundaryTree ΞΉ Ξ² front) β T.Assignment ΞΊ β β β (ΞΉ β β) β β | |
| | _, .leaf b, Ο => W b Ο | |
| | _, .step _ _ (m,q) tail T, Ο => fun t => | |
| shiftedMean (Measure.pi fun i => gaussianReal 0 (q i)) m | |
| (prefixContinuation tail (F t)) (fun x => T.weight F W Ο t x) | |
| | _, .fork T U, Ο => fun t x => T.weight F W Ο.1 t x*U.weight F W Ο.2 t x | |
| noncomputable def BoundaryTree.response (F D : β β (ΞΉ β β) β β) | |
| (W B : β b, ΞΊ b β β β (ΞΉ β β) β β) : | |
| {front : List (GaussianStep ΞΉ)} β (T : BoundaryTree ΞΉ Ξ² front) β T.Assignment ΞΊ β β β (ΞΉ β β) β β | |
| | _, .leaf b, Ο => B b Ο | |
| | _, .step _ _ (m,q) tail T, Ο => fun t => | |
| tiltedResponse q m (prefixContinuation tail (F t)) (prefixTest tail (F t) (D t)) | |
| (fun x => T.weight F W Ο t x) (fun x => T.response F D W B Ο t x) | |
| | _, .fork T U, Ο => fun t x => T.response F D W B Ο.1 t x*U.weight F W Ο.2 t x+ | |
| T.weight F W Ο.1 t x*U.response F D W B Ο.2 t x | |
| theorem BoundaryTree.parametric {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (Ο : T.Assignment ΞΊ) : | |
| β K, ParametricTest l r K (T.weight F W Ο) (T.response F D W B Ο) := by | |
| induction T with | |
| | leaf b => exact hW b Ο | |
| | st tail T ih => | |
| rcases st with β¨m,qβ© | |
| have ht := fun s hs => hm s (List.mem_cons_of_mem _ hs) | |
| obtain β¨K,hKβ© := ih ht Ο | |
| exact β¨_,hK.step (hF.prefix tail ht) q mβ© | |
| | fork T U ihT ihU => | |
| obtain β¨K,hKβ© := ihT hm Ο.1 | |
| obtain β¨J,hJβ© := ihU hm Ο.2 | |
| exact β¨_,hK.mul hJβ© | |
| theorem BoundaryTree.weight_smooth0 {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (Ο : T.Assignment ΞΊ) {t : β} (ht : t β Ioo l r) : | |
| BddSmooth 0 (fun x => T.weight F W Ο t x) := | |
| (T.parametric hF hW hm Ο).choose_spec.smooth0 ht | |
| theorem BoundaryTree.response_smooth0 {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (Ο : T.Assignment ΞΊ) {t : β} (ht : t β Ioo l r) : | |
| BddSmooth 0 (fun x => T.response F D W B Ο t x) := | |
| (T.parametric hF hW hm Ο).choose_spec.response_smooth0 ht | |
| theorem BoundaryTree.probability [β b, Fintype (ΞΊ b)] | |
| {l r J : β} {F D : β β (ΞΉ β β) β β} {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| (hp : β b, β t β Ioo l r, β x, (β Ο, 0 β€ W b Ο t x) β§ β Ο, W b Ο t x = 1) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) {t : β} (ht : t β Ioo l r) (x : ΞΉ β β) : | |
| (β Ο : T.Assignment ΞΊ, 0 β€ T.weight F W Ο t x) β§ β Ο, T.weight F W Ο t x = 1 := by | |
| induction T generalizing x with | |
| | leaf b => exact hp b t ht x | |
| | st tail T ih => | |
| rcases st with β¨m,qβ© | |
| have htail := fun s hs => hm s (List.mem_cons_of_mem _ hs) | |
| have hi := (exponentialIncrement_gaussian q).integrable_shift | |
| ((hF.prefix tail htail).spatial t ht).choose_spec m x | |
| refine β¨fun Ο => shiftedMean_nonneg (fun y => (ih htail y).1 Ο) hi,?_β© | |
| change β Ο, shiftedMean _ _ _ (fun y => T.weight F W Ο t y) x = _ | |
| rw [β shiftedMean_finsetSum Finset.univ (fun Ο _ => T.weight_smooth0 hF hW htail Ο ht) hi] | |
| simp_rw [(ih htail _).2] | |
| exact shiftedMean_const 1 hi | |
| | front T U ihT ihU => | |
| obtain β¨hT,sTβ© := ihT hm x | |
| obtain β¨hU,sUβ© := ihU hm x | |
| refine β¨fun Ο => mul_nonneg (hT Ο.1) (hU Ο.2),?_β© | |
| change β Ο : T.Assignment ΞΊ Γ U.Assignment ΞΊ, T.weight F W Ο.1 t x*U.weight F W Ο.2 t x = _ | |
| simp only [Fintype.sum_prod_type,β Finset.mul_sum,sU,mul_one,sT] | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| theorem BddSmooth.abs_zero {E : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| {A : E β β} (h : BddSmooth 0 A) : BddSmooth 0 (fun x => |A x|) := by | |
| obtain β¨K,hK,hbβ© := h.bound | |
| exact β¨h.continuous.abs,K,hK,fun x => by simpa only [abs_abs] using hb xβ© | |
| theorem sum_abs_shiftedMean_le {E ΞΊ : Type*} [NormedAddCommGroup E] [NormedSpace β E] | |
| [MeasurableSpace E] [BorelSpace E] {Ξ½ : Measure E} [IsProbabilityMeasure Ξ½] [Fintype ΞΊ] | |
| {F : E β β} {m K : β} {A : ΞΊ β E β β} | |
| (hA : β i, BddSmooth 0 (A i)) (hb : β x, β i, |A i x| β€ K) {x : E} | |
| (hi : Integrable (fun z => Real.exp (m*F (x+z))) Ξ½) : | |
| β i, |shiftedMean Ξ½ m F (A i) x| β€ K := by | |
| calc | |
| _ β€ β i, shiftedMean Ξ½ m F (fun y => |A i y|) x := | |
| Finset.sum_le_sum fun i _ => shiftedMean_abs_mono (hA i) (hA i).abs_zero (fun y => le_refl _) hi | |
| _ = shiftedMean Ξ½ m F (fun y => β i, |A i y|) x := | |
| (shiftedMean_finsetSum Finset.univ (fun i _ => (hA i).abs_zero) hi).symm | |
| _ β€ shiftedMean Ξ½ m F (fun _ => K) x := shiftedMean_mono | |
| (BddSmooth.sum Finset.univ fun i _ => (hA i).abs_zero) (BddSmooth.const 0 K) hb hi | |
| _ = K := shiftedMean_const K hi | |
| theorem finite_law_score_fork {ΞΊ Ο : Type*} [Fintype ΞΊ] [Fintype Ο] | |
| {W : ΞΊ β β} {V : Ο β β} {B : ΞΊ β β} {C : Ο β β} {a D K L M : β} | |
| (hW : β i, 0 β€ W i) (hV : β j, 0 β€ V j) | |
| (sW : β i, W i = 1) (sV : β j, V j = 1) | |
| (hB : β i, |B i+a*W i*D| β€ K) (hC : β j, |C j+a*V j*D| β€ L) | |
| (ha : 0 β€ a) (hD : |D| β€ M) : | |
| β z : ΞΊ Γ Ο, |B z.1*V z.2+W z.1*C z.2+a*(W z.1*V z.2)*D| β€ K+L+a*M := by | |
| have he (i : ΞΊ) (j : Ο) : | |
| B i*V j+W i*C j+a*(W i*V j)*D = | |
| (B i+a*W i*D)*V j+W i*(C j+a*V j*D)-a*W i*V j*D := by ring | |
| calc | |
| _ β€ β z : ΞΊ Γ Ο, (|B z.1+a*W z.1*D| *V z.2+W z.1*|C z.2+a*V z.2*D|+a*W z.1*V z.2*M) := by | |
| apply Finset.sum_le_sum | |
| intro z _ | |
| rw [he] | |
| apply (abs_sub _ _).trans | |
| have h := abs_add_le ((B z.1+a*W z.1*D)*V z.2) (W z.1*(C z.2+a*V z.2*D)) | |
| simp only [abs_mul,abs_of_nonneg (hW z.1),abs_of_nonneg (hV z.2),abs_of_nonneg ha] at h β’ | |
| have hh := mul_le_mul_of_nonneg_left hD (mul_nonneg (mul_nonneg ha (hW z.1)) (hV z.2)) | |
| linarith | |
| _ = (β i, |B i+a*W i*D|)+(β j, |C j+a*V j*D|)+a*M := by | |
| simp only [Fintype.sum_prod_type,Finset.sum_add_distrib,β Finset.sum_mul,β Finset.mul_sum,sV,sW,mul_one,one_mul] | |
| _ β€ K+L+a*M := by linarith | |
| theorem finite_law_subtraction_bound {ΞΊ : Type*} [Fintype ΞΊ] | |
| {W R : ΞΊ β β} {c D K J : β} (hW : β i, 0 β€ W i) (sW : β i, W i = 1) | |
| (hR : β i, |R i| β€ K) (hc : 0 β€ c) (hD : |D| β€ J) : | |
| β i, |R i-c*W i*D| β€ K+c*J := by | |
| calc | |
| _ β€ β i, (|R i|+c*W i*J) := by | |
| apply Finset.sum_le_sum | |
| intro i _ | |
| apply (abs_sub _ _).trans | |
| rw [abs_mul,abs_mul,abs_of_nonneg hc,abs_of_nonneg (hW i)] | |
| exact add_le_add (le_refl _) (mul_le_mul_of_nonneg_left hD (mul_nonneg hc (hW i))) | |
| _ = (β i, |R i|)+c*J := by | |
| simp only [Finset.sum_add_distrib,β Finset.sum_mul,β Finset.mul_sum,sW,mul_one] | |
| _ β€ K+c*J := add_le_add hR (le_refl _) | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| universe uB vB wB | |
| variable {ΞΉ : Type uB} {Ξ² : Type vB} {ΞΊ : Ξ² β Type wB} | |
| def PrefixOrdered (a b : β) : List (GaussianStep ΞΉ) β Prop | |
| | [] => 0 β€ a β§ a β€ b | |
| | (m,_)::tail => 0 β€ a β§ a β€ m β§ 0 < m β§ PrefixOrdered m b tail | |
| theorem PrefixOrdered.positive {a b : β} {front : List (GaussianStep ΞΉ)} | |
| (h : PrefixOrdered a b front) : β st β front, 0 < st.1 := by | |
| induction front generalizing a with | |
| | nil => simp | |
| | cons st tail ih => | |
| rcases st with β¨m,qβ© | |
| intro s hs | |
| rcases List.mem_cons.mp hs with hs|hs | |
| Β· simpa only [hs] using h.2.2.1 | |
| Β· exact ih h.2.2.2 s hs | |
| theorem PrefixOrdered.bounds {a b : β} {front : List (GaussianStep ΞΉ)} | |
| (h : PrefixOrdered a b front) : 0 β€ a β§ a β€ b := by | |
| induction front generalizing a with | |
| | nil => exact h | |
| | cons st tail ih => | |
| rcases st with β¨m,qβ© | |
| exact β¨h.1,h.2.1.trans (ih h.2.2.2).2β© | |
| def BoundaryTree.budget (V : Ξ² β β) : {front : List (GaussianStep ΞΉ)} β BoundaryTree ΞΉ Ξ² front β β | |
| | _, .leaf b => V b | |
| | _, .step _ T => T.budget V | |
| | _, .fork T U => T.budget V+U.budget V | |
| variable [Fintype ΞΉ] [β b, Fintype (ΞΊ b)] | |
| noncomputable def BoundaryTree.score (F D : β β (ΞΉ β β) β β) | |
| (W B : β b, ΞΊ b β β β (ΞΉ β β) β β) {front : List (GaussianStep ΞΉ)} | |
| (T : BoundaryTree ΞΉ Ξ² front) (a : β) (Ο : T.Assignment ΞΊ) (t : β) (x : ΞΉ β β) : β := | |
| T.response F D W B Ο t x+a*T.weight F W Ο t x*prefixTest front (F t) (D t) x | |
| omit [β b, Fintype (ΞΊ b)] in | |
| theorem BoundaryTree.score_smooth0 {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (a : β) (Ο : T.Assignment ΞΊ) {t : β} (ht : t β Ioo l r) : | |
| BddSmooth 0 (T.score F D W B a Ο t) := | |
| (T.response_smooth0 hF hW hm Ο ht).add | |
| (((T.weight_smooth0 hF hW hm Ο ht).const_mul a).mul ((hF.prefix front hm).response_smooth0 ht)) | |
| omit [β b, Fintype (ΞΊ b)] in | |
| theorem BoundaryTree.score_step {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (a m : β) (q : ΞΉ β ββ₯0) | |
| (Ο : T.Assignment ΞΊ) {t : β} (ht : t β Ioo l r) (x : ΞΉ β β) : | |
| (T.step (m,q)).score F D W B a Ο t x = | |
| shiftedMean (Measure.pi fun i => gaussianReal 0 (q i)) m (prefixContinuation front (F t)) | |
| (T.score F D W B m Ο t) x- | |
| (m-a)*(T.step (m,q)).weight F W Ο t x*prefixTest ((m,q)::front) (F t) (D t) x := by | |
| let Ξ½ := Measure.pi fun i => gaussianReal 0 (q i) | |
| have hi := (exponentialIncrement_gaussian q).integrable_shift | |
| ((hF.prefix front hm).spatial t ht).choose_spec m x | |
| have hB := T.response_smooth0 hF hW hm Ο ht | |
| have hA := T.weight_smooth0 hF hW hm Ο ht | |
| have hD := (hF.prefix front hm).response_smooth0 ht | |
| have he : (T.score F D W B m Ο t) = fun y => | |
| T.response F D W B Ο t y+m*(T.weight F W Ο t y*prefixTest front (F t) (D t) y) := by | |
| funext y | |
| unfold score | |
| ring | |
| rw [he,shiftedMean_add hB ((hA.mul hD).const_mul m) hi,shiftedMean_const_mul] | |
| simp only [score,response,weight,tiltedResponse,prefixTest] | |
| ring | |
| theorem BoundaryTree.score_variation {l r J m a : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} {V : Ξ² β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| (hp : β b, β t β Ioo l r, β x, (β Ο, 0 β€ W b Ο t x) β§ β Ο, W b Ο t x = 1) | |
| (hv : β b, β t β Ioo l r, β x, β Ο, |B b Ο t x+m*W b Ο t x*D t x| β€ V b) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (ha : PrefixOrdered a m front) {t : β} (ht : t β Ioo l r) (x : ΞΉ β β) : | |
| β Ο, |T.score F D W B a Ο t x| β€ T.budget (fun b => V b+m*J)-a*J := by | |
| induction T generalizing a x with | |
| | leaf b => | |
| have hh := finite_law_subtraction_bound (hp b t ht x).1 (hp b t ht x).2 (hv b t ht x) | |
| (sub_nonneg.mpr ha.2) (hF.bounded t ht x) | |
| have he (Ο : ΞΊ b) : (B b Ο t x+m*W b Ο t x*D t x)-(m-a)*W b Ο t x*D t x = | |
| (BoundaryTree.leaf b : BoundaryTree ΞΉ Ξ² []).score F D W B a Ο t x := by | |
| simp only [score,response,weight,prefixTest] | |
| ring | |
| simp_rw [he] at hh | |
| dsimp only [budget] | |
| linarith | |
| | st tail T ih => | |
| rcases st with β¨b,qβ© | |
| let Ξ½ := Measure.pi fun i => gaussianReal 0 (q i) | |
| have hm := ha.positive | |
| have hb := ha.2.2.2.positive | |
| have hi := (exponentialIncrement_gaussian q).integrable_shift | |
| ((hF.prefix tail hb).spatial t ht).choose_spec b x | |
| have hs := sum_abs_shiftedMean_le (fun Ο => T.score_smooth0 hF hW hb b Ο ht) | |
| (fun y => ih ha.2.2.2 y) hi | |
| have hp' := (T.step (b,q)).probability hF hW hp hm ht x | |
| have hd := (hF.prefix ((b,q)::tail) hm).bounded t ht x | |
| have hh := finite_law_subtraction_bound hp'.1 hp'.2 hs (sub_nonneg.mpr ha.2.1) hd | |
| simp_rw [β T.score_step hF hW hb a b q _ ht x] at hh | |
| dsimp only [budget] | |
| linarith | |
| | @fork front T U ihT ihU => | |
| have hT := T.probability hF hW hp ha.positive ht x | |
| have hU := U.probability hF hW hp ha.positive ht x | |
| have hd := (hF.prefix front ha.positive).bounded t ht x | |
| have hh := finite_law_score_fork hT.1 hU.1 hT.2 hU.2 (ihT ha x) (ihU ha x) ha.bounds.1 hd | |
| change (β Ο : T.Assignment ΞΊ Γ U.Assignment ΞΊ, | |
| |T.response F D W B Ο.1 t x*U.weight F W Ο.2 t x+ | |
| T.weight F W Ο.1 t x*U.response F D W B Ο.2 t x+ | |
| a*(T.weight F W Ο.1 t x*U.weight F W Ο.2 t x)*prefixTest front (F t) (D t) x|) β€ _ | |
| dsimp only [budget] | |
| exact hh.trans (by linarith) | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| universe uB vB wB | |
| theorem finite_law_addition_bound {ΞΊ : Type*} [Fintype ΞΊ] | |
| {W R : ΞΊ β β} {c D K J : β} (hW : β i, 0 β€ W i) (sW : β i, W i = 1) | |
| (hR : β i, |R i| β€ K) (hc : 0 β€ c) (hD : |D| β€ J) : | |
| β i, |R i+c*W i*D| β€ K+c*J := by | |
| have hh := finite_law_subtraction_bound hW sW hR hc (show |-D| β€ J by simpa only [abs_neg] using hD) | |
| simpa only [mul_neg,sub_neg_eq_add] using hh | |
| variable {ΞΉ : Type uB} {Ξ² : Type vB} {ΞΊ : Ξ² β Type wB} [Fintype ΞΉ] [β b, Fintype (ΞΊ b)] | |
| noncomputable def BoundaryTree.expect (F : β β (ΞΉ β β) β β) | |
| (W : β b, ΞΊ b β β β (ΞΉ β β) β β) {front : List (GaussianStep ΞΉ)} | |
| (T : BoundaryTree ΞΉ Ξ² front) (P : T.Assignment ΞΊ β β) (t : β) (x : ΞΉ β β) : β := | |
| β Ο, P Ο*T.weight F W Ο t x | |
| theorem BoundaryTree.expect_hasDerivAt {l r J : β} {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} | |
| (hF : ParametricRegular l r J F D) | |
| (hW : β b Ο, β K, ParametricTest l r K (W b Ο) (B b Ο)) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) | |
| (hm : β st β front, 0 < st.1) (P : T.Assignment ΞΊ β β) {t : β} (ht : t β Ioo l r) (x : ΞΉ β β) : | |
| HasDerivAt (fun s => T.expect F W P s x) (β Ο, P Ο*T.response F D W B Ο t x) t := by | |
| exact HasDerivAt.fun_sum (u := Finset.univ) (fun Ο _ => | |
| ((T.parametric hF hW hm Ο).choose_spec.derivative t ht x).const_mul (P Ο)) | |
| theorem BoundaryTree.tested_response_bound {F D : β β (ΞΉ β β) β β} | |
| {W B : β b, ΞΊ b β β β (ΞΉ β β) β β} {front : List (GaussianStep ΞΉ)} | |
| (T : BoundaryTree ΞΉ Ξ² front) {P : T.Assignment ΞΊ β β} {C K : β} {t : β} {x : ΞΉ β β} | |
| (hC : 0 β€ C) (hP : β Ο, |P Ο| β€ C) | |
| (hR : β Ο, |T.response F D W B Ο t x| β€ K) : | |
| |β Ο, P Ο*T.response F D W B Ο t x| β€ C*K := by | |
| apply (Finset.abs_sum_le_sum_abs _ _).trans | |
| calc | |
| _ β€ β Ο, C*|T.response F D W B Ο t x| := Finset.sum_le_sum fun Ο _ => by | |
| rw [abs_mul] | |
| exact mul_le_mul_of_nonneg_right (hP Ο) (abs_nonneg _) | |
| _ = C*β Ο, |T.response F D W B Ο t x| := (Finset.mul_sum _ _ _).symm | |
| _ β€ C*K := mul_le_mul_of_nonneg_left hR hC | |
| 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 : β} | |
| noncomputable def ReplicaTree.atomicClock (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) {steps : List (GaussianStep ΞΉ)} | |
| (T : ReplicaTree ΞΉ S steps) (m : β) (Ο : T.Assignment) : β β (ΞΉ β β) β β := by | |
| classical | |
| exact linearClockTest L m (gaussianHierarchy w Ο steps) (T.expect w Ο (fun Ο => if Ο = Ο then 1 else 0)) | |
| noncomputable def ReplicaTree.atomicResponse (w : S β β) (Ο : S β (ΞΉ β β) βL[β] β) | |
| (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) {steps : List (GaussianStep ΞΉ)} | |
| (T : ReplicaTree ΞΉ S steps) (m : β) (Ο : T.Assignment) : β β (ΞΉ β β) β β := by | |
| classical | |
| exact T.clockResponse w Ο L m (fun Ο => if Ο = Ο then 1 else 0) | |
| theorem BoundaryTree.actual_inserted_response_variation {w : S β β} (hw : β Ο, 0 < w Ο) | |
| (Ο : S β (ΞΉ β β) βL[β] β) (L : (Fin (n+1) β β) βL[β] (ΞΉ β β)) | |
| {steps : List (GaussianStep ΞΉ)} (R : Ξ² β ReplicaTree ΞΉ S steps) | |
| {m Q : β} (ha : OrderedSteps m steps) (hm : 0 < m) | |
| (hQ : β Ο, β i, (Ο Ο (L (Pi.single i 1)))^2 = Q) | |
| (D : Fin (n+1) β β) (hD : β i, 0 β€ D i) | |
| (hB : β i Ο, |Ο Ο (L (Pi.single i 1))| β€ D i) | |
| {front : List (GaussianStep ΞΉ)} (T : BoundaryTree ΞΉ Ξ² front) (hO : PrefixOrdered 0 m front) | |
| {t : β} (ht : 0 < t) (x : ΞΉ β β) : | |
| β Ο, |T.response (linearClockContinuation L m (gaussianHierarchy w Ο steps)) | |
| (featureClockResponse w Ο L steps m) | |
| (fun b => (R b).atomicClock w Ο L m) (fun b => (R b).atomicResponse w Ο L m) Ο t x| β€ | |
| T.budget (fun b => 4*((R b).leaves:β)*((R b).leaves+1:β)*(β i, (D i)^2)+m*Q) := by | |
| classical | |
| let F := linearClockContinuation L m (gaussianHierarchy w Ο steps) | |
| let J := featureClockResponse w Ο L steps m | |
| let W := fun b => (R b).atomicClock w Ο L m | |
| let B := fun b => (R b).atomicResponse w Ο L m | |
| have hF : ParametricRegular 0 (t+1) (Q/2) F J := parametric_featureClock hw Ο L hQ steps ha hm (t+1) | |
| have hW : β b Ο, β K, ParametricTest 0 (t+1) K (W b Ο) (B b Ο) := by | |
| intro b Ο | |
| refine β¨_,(R b).parametric_clockTest hw Ο L ha D (by norm_num : (0:β) β€ 1) hD ?_ hB (t+1)β© | |
| intro Ο | |
| split_ifs <;> norm_num | |
| have hp : β b, β s β Ioo 0 (t+1), β y, (β Ο, 0 β€ W b Ο s y) β§ β Ο, W b Ο s y = 1 := by | |
| intro b s _ y | |
| exact (R b).atomic_clockTest_probability hw Ο L ha s y | |
| let V : Ξ² β β := fun b => 4*((R b).leaves:β)*((R b).leaves+1:β)*(β i, (D i)^2)+m*(Q/2) | |
| have hv : β b, β s β Ioo 0 (t+1), β y, β Ο, |B b Ο s y+m*W b Ο s y*J s y| β€ V b := by | |
| intro b s hs y | |
| exact finite_law_addition_bound (hp b s hs y).1 (hp b s hs y).2 | |
| ((R b).atomic_clockResponse_variation hw Ο L ha D hD hB hs.1 y) hm.le (hF.bounded s hs y) | |
| have hs := T.score_variation hF hW hp hv hO (show t β Ioo 0 (t+1) by exact β¨ht,by linarithβ©) x | |
| have he : (fun b => V b+m*(Q/2)) = (fun b => 4*((R b).leaves:β)*((R b).leaves+1:β)*(β i, (D i)^2)+m*Q) := by | |
| funext b | |
| dsimp [V] | |
| ring | |
| rw [he] at hs | |
| simpa only [BoundaryTree.score,zero_mul,add_zero,sub_zero] using hs | |
| end SKFluctuations.Hierarchy | |
| namespace SKFluctuations.Hierarchy | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped Topology NNReal BigOperators | |
| variable {ΞΉ : Type*} [Fintype ΞΉ] | |
| def interpolate (F G : (ΞΉ β β) β β) (t : β) (x : ΞΉ β β) : β := | |
| (1-t)*F x+t*G x | |
| omit [Fintype ΞΉ] in | |
| theorem interpolate_derivative (F G : (ΞΉ β β) β β) (t : β) (x : ΞΉ β β) : | |
| HasDerivAt (fun s => interpolate F G s x) (G x-F x) t := by | |
| apply ((((hasDerivAt_const t (1:β)).sub (hasDerivAt_id t)).mul_const (F x)).add | |
| ((hasDerivAt_id t).mul_const (G x))).congr_deriv | |
| ring | |
| theorem parametric_interpolate {F G : (ΞΉ β β) β β} {Cβ Cβ : ββ₯0} {K l r : β} | |
| (hF : LipschitzWith Cβ F) (hG : LipschitzWith Cβ G) (hK : 0 β€ K) | |
| (hb : β x, |G x-F x| β€ K) : | |
| ParametricRegular l r K (interpolate F G) (fun _ x => G x-F x) := by | |
| refine β¨hK,?_,fun _ _ => hG.continuous.sub hF.continuous,fun _ _ x => hb x,fun t _ x => interpolate_derivative F G t xβ© | |
| intro t _ | |
| exact β¨_,((lipschitzWith_smul (1-t)).comp hF).add ((lipschitzWith_smul t).comp hG)β© | |
| omit [Fintype ΞΉ] in | |
| theorem parametricTest_interpolate {F G : (ΞΉ β β) β β} {K : β} | |
| (hF : Continuous F) (hG : Continuous G) (hK : 0 β€ K) | |
| (hbF : β x, |F x| β€ K) (hbG : β x, |G x| β€ K) : | |
| ParametricTest (-1) 2 (5*K) (interpolate F G) (fun _ x => G x-F x) := by | |
| refine β¨by positivity,fun t _ => (hF.const_mul (1-t)).add (hG.const_mul t), | |
| fun _ _ => hG.sub hF,?_,?_,fun t _ x => interpolate_derivative F G t xβ© | |
| Β· intro t ht x | |
| have ht1 : |1-t| β€ 3 := by rw [abs_le]; constructor <;> linarith [ht.1,ht.2] | |
| have ht2 : |t| β€ 2 := by rw [abs_le]; constructor <;> linarith [ht.1,ht.2] | |
| unfold interpolate | |
| apply (abs_add_le _ _).trans | |
| rw [abs_mul,abs_mul] | |
| have h1 := mul_le_mul ht1 (hbF x) (abs_nonneg _) (by norm_num : (0:β) β€ 3) | |
| have h2 := mul_le_mul ht2 (hbG x) (abs_nonneg _) (by norm_num : (0:β) β€ 2) | |
| linarith | |
| Β· intro t _ x | |
| exact (abs_sub _ _).trans (by linarith [hbF x,hbG x]) | |
| theorem ParametricRegular.restrict {l r l' r' K : β} {F D : β β (ΞΉ β β) β β} | |
| (h : ParametricRegular l r K F D) (hs : Ioo l' r' β Ioo l r) : ParametricRegular l' r' K F D := | |
| β¨h.nonneg,fun t ht => h.spatial t (hs ht),fun t ht => h.continuous t (hs ht), | |
| fun t ht => h.bounded t (hs ht),fun t ht => h.derivative t (hs ht)β© | |
| omit [Fintype ΞΉ] in | |
| theorem ParametricTest.restrict {l r l' r' K : β} {A B : β β (ΞΉ β β) β β} | |
| (h : ParametricTest l r K A B) (hs : Ioo l' r' β Ioo l r) : ParametricTest l' r' K A B := | |
| β¨h.nonneg,fun t ht => h.continuous t (hs ht),fun t ht => h.response_continuous t (hs ht), | |
| fun t ht => h.bounded t (hs ht),fun t ht => h.response_bounded t (hs ht), | |
| fun t ht => h.derivative t (hs ht)β© | |
| end SKFluctuations.Hierarchy | |
| end | |
| end OAI | |