Download data/lean/OAI/Probability/ProjectionMoments/StoppingKernel.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 21.8 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ProjectionMoments/StoppingKernel.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/ProjectionMoments/StoppingKernel.lean
-
curl -L -o StoppingKernel.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/ProjectionMoments/StoppingKernel.lean
21.8 kB
| import OAI.Probability.ProjectionMoments.Realization | |
| namespace OAI | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal RealInnerProductSpace | |
| namespace NoiselessRegression | |
| section | |
| variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace β E] | |
| [FiniteDimensional β E] [MeasurableSpace E] [BorelSpace E] [Nontrivial E] | |
| lemma capWeight_mass_mixed (y : E) {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1) | |
| (a : β) {b : β} (hb : 0 β€ b) (hab : (a:β)+b β€ (Module.finrank β E-1:β)) : | |
| PolynomialMass ((ambientSphereLaw (E := E)).withDensity (capWeight y Ξ΅)) a | |
| (ENNReal.ofReal ((3 : β)*4^Module.finrank β E) * ENNReal.ofReal (Ξ΅^b)) := by | |
| change PolynomialMass ((ambientSphereLaw (E := E)).withDensity ((Metric.closedBall y Ξ΅).indicator 1)) a _ | |
| rw [withDensity_indicator_one Metric.isClosed_closedBall.measurableSet] | |
| intro z r hr | |
| rw [Measure.restrict_apply Metric.isClosed_closedBall.measurableSet] | |
| by_cases h : r β€ Ξ΅ | |
| Β· apply (measure_mono Set.inter_subset_left).trans | |
| apply (ambientSphereLaw_closedBall z hr (Module.finrank β E-1) le_rfl).trans | |
| rw [mul_assoc, β ENNReal.ofReal_mul (Real.rpow_nonneg hΞ΅.le _)] | |
| apply mul_le_mul' le_rfl | |
| apply ENNReal.ofReal_le_ofReal | |
| have hpow : r^(Module.finrank β E-1) β€ r^((a:β)+b) := by | |
| rw [β Real.rpow_natCast] | |
| exact Real.rpow_le_rpow_of_exponent_ge hr (h.trans hΞ΅1) hab | |
| apply hpow.trans | |
| rw [Real.rpow_add hr,Real.rpow_natCast,mul_comm] | |
| exact mul_le_mul_of_nonneg_right (Real.rpow_le_rpow hr.le h hb) (pow_nonneg hr.le _) | |
| Β· apply (measure_mono Set.inter_subset_right).trans | |
| apply (ambientSphereLaw_closedBall y hΞ΅ (Module.finrank β E-1) le_rfl).trans | |
| rw [mul_assoc, β ENNReal.ofReal_mul (Real.rpow_nonneg hΞ΅.le _)] | |
| apply mul_le_mul' le_rfl | |
| apply ENNReal.ofReal_le_ofReal | |
| have hpow : Ξ΅^(Module.finrank β E-1) β€ Ξ΅^((a:β)+b) := by | |
| rw [β Real.rpow_natCast] | |
| exact Real.rpow_le_rpow_of_exponent_ge hΞ΅ hΞ΅1 hab | |
| apply hpow.trans | |
| rw [Real.rpow_add hΞ΅,Real.rpow_natCast,mul_comm] | |
| exact mul_le_mul_of_nonneg_left (pow_le_pow_leftβ hΞ΅.le (le_of_not_ge h) a) (Real.rpow_nonneg hΞ΅.le _) | |
| variable {J : Type*} [Fintype J] [MeasurableSpace J] [MeasurableSingletonClass J] [Nonempty J] | |
| lemma continuation_mixed_integral_bound {Ξ΄ : β β J β (E Γ β) β J} | |
| (hΞ΄ : β n j, Measurable (Ξ΄ n j)) (y : β β J β E) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1) {a q : β} {b : β} | |
| (hb : 0 β€ b) (hab : (a:β)+b β€ (Module.finrank β E-1:β)) | |
| (hq : 2 β€ q) (hqa : 2*q β€ a) (n k : β) (j : J) : | |
| (β«β» s, continuation Ξ΄ (fun n j => capWeight (y n j) Ξ΅) n k j s βambientSphereLaw) β€ | |
| (ENNReal.ofReal ((3 : β)*4^Module.finrank β E) * ENNReal.ofReal (Ξ΅^b)) * | |
| streamFactor (E := E) (J := J) q ^ ((k+q-1)/q) := by | |
| have ha : a β€ Module.finrank β E := by | |
| have : (a:β) β€ (Module.finrank β E:β) := by | |
| have hh : ((Module.finrank β E-1:β):β) β€ Module.finrank β E := by exact_mod_cast Nat.sub_le (Module.finrank β E) 1 | |
| linarith | |
| exact_mod_cast this | |
| apply ambient_mass_bound | |
| apply continuation_mass_bound_ceil _ hΞ΄ (fun n j => measurable_capWeight _ _) | |
| (fun n j s => capWeight_le_one _ _ _) | |
| (mul_ne_zero (by positivity) (by positivity)) (ENNReal.mul_ne_top ENNReal.ofReal_ne_top ENNReal.ofReal_ne_top) | |
| (fun n j => capWeight_mass_mixed (y n j) hΞ΅ hΞ΅1 a hb hab) | |
| (Module.finrank_pos (R := β) (M := E)) ha hq hqa | |
| lemma route_mixed_bound {Ξ΄ : β β J β (E Γ β) β J} | |
| (hΞ΄ : β n j, Measurable (Ξ΄ n j)) (y : J β E) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1) {a q : β} {b : β} | |
| (hb : 0 β€ b) (hab : (a:β)+b β€ (Module.finrank β E-1:β)) | |
| (hq : 2 β€ q) (hqa : 2*q β€ a) (k : β) (j : J) : | |
| ((sphereLaw (E := E)).prod (Measure.pi (fun _ : Fin k => stdGaussian E))) | |
| {z | dist z.1.val (y (streamRoute Ξ΄ 0 k j (z.2,fun i => βͺz.1.val,z.2 iβ«))) β€ Ξ΅} β€ | |
| (ENNReal.ofReal ((3 : β)*4^Module.finrank β E) * ENNReal.ofReal (Ξ΅^b)) * | |
| streamFactor (E := E) (J := J) q ^ ((k+q-1)/q) := by | |
| let w : β β J β E β ββ₯0β := fun _ j => capWeight (y j) Ξ΅ | |
| have hV := measurable_continuation (w := w) hΞ΄ (fun _ j => measurable_capWeight (y j) Ξ΅) 0 k j | |
| have he (s : E) : continuation Ξ΄ w 0 k j s = | |
| β«β» A : Fin k β E, capWeight (y (streamRoute Ξ΄ 0 k j (A,fun i => βͺs,A iβ«))) Ξ΅ s | |
| βMeasure.pi (fun _ => stdGaussian E) := by | |
| simpa [w, blockValue, continuation] using continuation_unroll (w := w) hΞ΄ 0 k 0 j s | |
| let S : Set ((Metric.sphere (0 : E) 1) Γ (Fin k β E)) := | |
| {z | dist z.1.val (y (streamRoute Ξ΄ 0 k j (z.2,fun i => βͺz.1.val,z.2 iβ«))) β€ Ξ΅} | |
| have hS : MeasurableSet S := by | |
| apply measurableSet_le _ measurable_const | |
| exact measurable_subtype_coe.comp measurable_fst |>.dist | |
| ((measurable_of_finite y).comp ((measurable_streamRoute hΞ΄ 0 k j).comp (by fun_prop))) | |
| change ((sphereLaw (E := E)).prod _) S β€ _ | |
| rw [β one_mul (((sphereLaw (E := E)).prod _) S), β lintegral_indicator_const hS 1, | |
| lintegral_prod _ (measurable_const.indicator hS).aemeasurable] | |
| have hf : β s : Metric.sphere (0 : E) 1, | |
| (β«β» A, S.indicator (fun _ => (1 : ββ₯0β)) (s,A) βMeasure.pi (fun _ => stdGaussian E)) = | |
| continuation Ξ΄ w 0 k j s.val := by | |
| intro s | |
| rw [he] | |
| apply lintegral_congr | |
| intro A | |
| classical | |
| change (if dist s.val (y (streamRoute Ξ΄ 0 k j (A,fun i => βͺs.val,A iβ«))) β€ Ξ΅ then 1 else 0) = _ | |
| unfold capWeight | |
| rw [Set.indicator_apply] | |
| rfl | |
| simp_rw [hf] | |
| rw [β lintegral_map hV measurable_subtype_coe] | |
| exact continuation_mixed_integral_bound hΞ΄ (fun _ => y) hΞ΅ hΞ΅1 hb hab hq hqa 0 k j | |
| end | |
| namespace Learner | |
| section | |
| variable {d M : β} | |
| def haltShift {k : β} : TaggedState M k β TaggedState M (k+1) | |
| | .inl j => .inl j | |
| | .inr (t,j) => .inr (t.succ,j) | |
| def haltRoute (Ο : β β State M β (Vector d Γ β) β Bool Γ State M) (n : β) : | |
| (k : β) β State M β ((Fin k β Vector d) Γ (Fin k β β)) β TaggedState M k | |
| | 0, j, _ => .inl j | |
| | k+1, j, X => | |
| let a := Ο (n+1) j (X.1 0,X.2 0) | |
| if a.1 then .inr (β¨1,by omegaβ©,a.2) | |
| else haltShift (haltRoute Ο (n+1) k a.2 (Fin.tail X.1,Fin.tail X.2)) | |
| lemma measurable_haltRoute {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| (hΟ : β t j, Measurable (Ο t j)) (n k : β) (j : State M) : | |
| Measurable (haltRoute Ο n k j) := by | |
| induction k generalizing n j with | |
| | zero => exact measurable_const | |
| | succ k ih => | |
| let h : (Bool Γ State M) β ((Fin (k+1) β Vector d) Γ (Fin (k+1) β β)) β TaggedState M (k+1) := | |
| fun a X => if a.1 then .inr (β¨1,by omegaβ©,a.2) | |
| else haltShift (haltRoute Ο (n+1) k a.2 (Fin.tail X.1,Fin.tail X.2)) | |
| change Measurable (fun X => h (Ο (n+1) j (X.1 0,X.2 0)) X) | |
| apply measurable_select (J := Bool Γ State M) _ ((hΟ (n+1) j).comp (by fun_prop)) | |
| intro a | |
| dsimp [h] | |
| split_ifs | |
| Β· exact measurable_const | |
| Β· exact (measurable_of_finite haltShift).comp ((ih (n+1) a.2).comp (by | |
| change Measurable (fun X : ((Fin (k+1) β Vector d) Γ (Fin (k+1) β β)) => | |
| ((fun i : Fin k => X.1 i.succ),(fun i : Fin k => X.2 i.succ))) | |
| fun_prop)) | |
| def haltChild (w : β β State M β Vector d β ββ₯0β) | |
| (v : State M β Vector d β ββ₯0β) (n : β) {k : β} : TaggedState M k β Vector d β ββ₯0β | |
| | .inl j => v j | |
| | .inr (t,j) => w (n+t) j | |
| def stoppedContinuation (Ο : β β State M β (Vector d Γ β) β Bool Γ State M) | |
| (w : β β State M β Vector d β ββ₯0β) (n : β) : β β State M β Vector d β ββ₯0β | |
| | 0, j, s => w n j s | |
| | k+1, j, s => β«β» x, let a := Ο (n+1) j (x,βͺs,xβ«) | |
| if a.1 then w (n+1) a.2 s else stoppedContinuation Ο w (n+1) k a.2 s βstdGaussian (Vector d) | |
| lemma measurable_stoppedContinuation {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (hΟ : β t j, Measurable (Ο t j)) (hw : β n j, Measurable (w n j)) (n k : β) (j : State M) : | |
| Measurable (stoppedContinuation Ο w n k j) := by | |
| induction k generalizing n j with | |
| | zero => exact hw n j | |
| | succ k ih => | |
| apply Measurable.lintegral_prod_left | |
| change Measurable (fun z : Vector d Γ Vector d => | |
| if (Ο (n+1) j (z.1,βͺz.2,z.1β«)).1 then w (n+1) (Ο (n+1) j (z.1,βͺz.2,z.1β«)).2 z.2 | |
| else stoppedContinuation Ο w (n+1) k (Ο (n+1) j (z.1,βͺz.2,z.1β«)).2 z.2) | |
| apply measurable_select (J := Bool Γ State M) (h := fun a (z : Vector d Γ Vector d) => | |
| if a.1 then w (n+1) a.2 z.2 else stoppedContinuation Ο w (n+1) k a.2 z.2) _ | |
| ((hΟ (n+1) j).comp (by fun_prop)) | |
| intro a | |
| split_ifs | |
| Β· exact (hw (n+1) a.2).comp measurable_snd | |
| Β· exact (ih (n+1) a.2).comp measurable_snd | |
| lemma stoppedContinuation_le_one | |
| {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (hw : β n j s, w n j s β€ 1) (n k : β) (j : State M) (s : Vector d) : | |
| stoppedContinuation Ο w n k j s β€ 1 := by | |
| induction k generalizing n j with | |
| | zero => exact hw n j s | |
| | succ k ih => | |
| change (β«β» x, (if (Ο (n+1) j (x,βͺs,xβ«)).1 then w (n+1) (Ο (n+1) j (x,βͺs,xβ«)).2 s else stoppedContinuation Ο w (n+1) k (Ο (n+1) j (x,βͺs,xβ«)).2 s) βstdGaussian (Vector d)) β€ 1 | |
| apply (lintegral_mono (g := fun _ => (1:ββ₯0β)) (fun x => ?_)).trans_eq (by simp) | |
| split_ifs | |
| Β· exact hw _ _ _ | |
| Β· exact ih _ _ | |
| lemma stoppedContinuation_unroll | |
| {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (hΟ : β t j, Measurable (Ο t j)) (n m k : β) (j : State M) (s : Vector d) : | |
| stoppedContinuation Ο w n (m+k) j s = | |
| blockValue (haltChild w (stoppedContinuation Ο w (n+m) k) n) (haltRoute Ο n m j) s := by | |
| induction m generalizing n j with | |
| | zero => simp [blockValue,haltRoute,haltChild] | |
| | succ m ih => | |
| rw [Nat.succ_add,stoppedContinuation] | |
| unfold blockValue | |
| have hf : Measurable (fun X : Fin (m+1) β Vector d => | |
| haltChild w (stoppedContinuation Ο w (n+(m+1)) k) n | |
| (haltRoute Ο n (m+1) j (X,fun i => βͺs,X iβ«)) s) := | |
| (measurable_of_finite (fun a => haltChild w (stoppedContinuation Ο w (n+(m+1)) k) n a s)).comp | |
| ((measurable_haltRoute hΟ n (m+1) j).comp (by fun_prop)) | |
| rw [lintegral_pi_cons _ _ hf] | |
| apply lintegral_congr | |
| intro x | |
| have htail (X : Fin m β Vector d) : Fin.tail (fun i : Fin (m+1) => βͺs,(Fin.cons x X : Fin (m+1) β Vector d) iβ«) = (fun i => βͺs,X iβ«) := by funext i; rfl | |
| simp only [haltRoute,Fin.cons_zero,Fin.tail_cons,htail] | |
| split_ifs with h | |
| Β· simp [haltChild] | |
| Β· rw [ih] | |
| unfold blockValue | |
| apply lintegral_congr | |
| intro X | |
| have h1 : n+(m+1) = n+1+m := by omega | |
| rw [h1] | |
| generalize haltRoute Ο (n+1) m (Ο (n+1) j (x,βͺs,xβ«)).2 (X,fun i => βͺs,X iβ«) = a | |
| cases a with | |
| | inl j => rfl | |
| | inr done => | |
| simp only [haltShift,haltChild,Fin.val_succ] | |
| rw [show n+1+done.1.val = n+(done.1.val+1) by omega] | |
| lemma stoppedContinuation_mass_bound {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (hΟ : β t j, Measurable (Ο t j)) (hw : β n j, Measurable (w n j)) | |
| (hw1 : β n j s, w n j s β€ 1) | |
| {a q : β} {C : ββ₯0β} (hC : C β 0) (hCt : C β β) | |
| (hlocal : β n j, PolynomialMass (ambientSphereLaw.withDensity (w n j)) a C) | |
| (hd : 1 β€ d) (ha : a β€ d) (hq : 2 β€ q) (hqa : 2*q β€ a) | |
| (n k : β) (j : State M) : | |
| PolynomialMass (ambientSphereLaw.withDensity (stoppedContinuation Ο w n k j)) a | |
| (C * streamFactor (E := Vector d) (J := TaggedState M q) q ^ ((k+q-1)/q)) := by | |
| let : NeZero d := β¨by omegaβ© | |
| let K := streamFactor (E := Vector d) (J := TaggedState M q) q | |
| have hK1 : 1 β€ K := one_le_streamFactor (by omega) | |
| have hK0 : K β 0 := ne_of_gt (lt_of_lt_of_le zero_lt_one hK1) | |
| have hKt : K β β := streamFactor_ne_top _ | |
| have hden : ((q-1 : β) : β)+1 = (q : β) := by rw [Nat.cast_sub (by omega),Nat.cast_one]; ring | |
| have hq0 : 0 < q := by omega | |
| change PolynomialMass _ a (C*K^_) | |
| induction k using Nat.strong_induction_on generalizing n j with | |
| | h k ih => | |
| by_cases hk0 : k = 0 | |
| Β· subst k | |
| simpa only [Nat.zero_add,Nat.div_eq_of_lt (by omega : q-1 < q),pow_zero,mul_one,stoppedContinuation] using hlocal n j | |
| let m := min k q | |
| have hm0 : 0 < m := by dsimp [m]; omega | |
| have hm : m β€ q := min_le_right _ _ | |
| have hmk : m β€ k := min_le_left _ _ | |
| have hki : k-m < k := by omega | |
| let C' := C*K^((k-m+q-1)/q) | |
| have hC' : C' β 0 := mul_ne_zero hC (pow_ne_zero _ hK0) | |
| have hC't : C' β β := ENNReal.mul_ne_top hCt (ENNReal.pow_ne_top hKt) | |
| have hCC' : C β€ C' := le_mul_of_one_le_right' (one_le_powβ hK1) | |
| let f := haltChild w (stoppedContinuation Ο w (n+m) (k-m)) n (k := m) | |
| have hf (a : TaggedState M m) : Measurable (f a) := by | |
| cases a with | |
| | inl j => exact measurable_stoppedContinuation hΟ hw _ _ _ | |
| | inr done => exact hw _ _ | |
| have hf1 (a : TaggedState M m) (s : Vector d) : f a s β€ 1 := by | |
| cases a with | |
| | inl j => exact stoppedContinuation_le_one hw1 _ _ _ _ | |
| | inr done => exact hw1 _ _ _ | |
| have hflocal (a' : TaggedState M m) : PolynomialMass (ambientSphereLaw.withDensity (f a')) a C' := by | |
| cases a' with | |
| | inl j => exact ih (k-m) hki (n+m) j | |
| | inr done => | |
| intro z r hr | |
| exact (hlocal (n+done.1) done.2 z r hr).trans (mul_le_mul' hCC' le_rfl) | |
| have hb := blockValue_mass_bound ambientSphereLaw hf hf1 hflocal hC' hC't | |
| (by simpa using hd) (by simpa using ha) (by simpa using (show m β€ d by omega)) | |
| (by omega : 1 β€ q-1) (by omega : q-1+m β€ a) (measurable_haltRoute hΟ n m j) | |
| have he : stoppedContinuation Ο w n k j = blockValue f (haltRoute Ο n m j) := by | |
| funext s | |
| simpa [f,Nat.add_sub_of_le hmk] using stoppedContinuation_unroll hΟ n m (k-m) j s | |
| rw [he] | |
| intro z r hr | |
| apply (hb z r hr).trans | |
| apply mul_le_mul' _ le_rfl | |
| have hdiv : (k+q-1)/q = (k-m+q-1)/q+1 := by | |
| by_cases hqk : q β€ k | |
| Β· have hme : m = q := min_eq_right hqk | |
| rw [hme] | |
| have he : k+q-1 = q+(k-q+q-1) := by omega | |
| rw [he,Nat.add_div_left _ hq0] | |
| Β· have hme : m = k := min_eq_left (by omega) | |
| rw [hme,Nat.sub_self,Nat.zero_add,Nat.div_eq_of_lt (by omega : q-1 < q)] | |
| have he : k+q-1 = q+(k-1) := by omega | |
| rw [he,Nat.add_div_left _ hq0,Nat.div_eq_of_lt (by omega : k-1 < q)] | |
| rw [hden] | |
| have hcard : (Fintype.card (TaggedState M m):ββ₯0β)^(1/(q:β)) β€ | |
| (Fintype.card (TaggedState M q):ββ₯0β)^(1/(q:β)) := by | |
| apply ENNReal.rpow_le_rpow _ (by positivity) | |
| exact_mod_cast (show Fintype.card (TaggedState M m) β€ Fintype.card (TaggedState M q) by | |
| rw [card_taggedState,card_taggedState] | |
| exact Nat.mul_le_mul_right _ (Nat.add_le_add_right hm 2)) | |
| calc | |
| _ β€ K*C' := mul_le_mul' (mul_le_mul' le_rfl hcard) le_rfl | |
| _ = _ := by rw [hdiv,pow_succ]; dsimp [C']; ring | |
| end | |
| variable {d M T : β} | |
| def taggedWeight (w : β β State M β Vector d β ββ₯0β) (n : β) : TaggedState M T β Vector d β ββ₯0β | |
| | .inl j => w n j | |
| | .inr (t,j) => w t j | |
| lemma measurable_taggedWeight {w : β β State M β Vector d β ββ₯0β} | |
| (hw : β n j, Measurable (w n j)) (n : β) (j : TaggedState M T) : | |
| Measurable (taggedWeight w n j) := by cases j <;> exact hw _ _ | |
| lemma continuation_tagged_eq {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (n k : β) (hnk : n+k β€ T) (j : TaggedState M T) (s : Vector d) : | |
| continuation (taggedStep Ο) (taggedWeight w) n k j s = | |
| match j with | |
| | .inl a => stoppedContinuation Ο w n k a s | |
| | .inr (t,a) => w t a s := by | |
| induction k generalizing n j with | |
| | zero => cases j <;> rfl | |
| | succ k ih => | |
| cases j with | |
| | inl j => | |
| simp only [continuation,stoppedContinuation] | |
| apply lintegral_congr | |
| intro x | |
| rw [ih (n+1) (by omega)] | |
| simp only [taggedStep,dite_eq_left (by omega : n+1 β€ T)] | |
| split_ifs <;> rfl | |
| | inr done => | |
| simp only [continuation,taggedStep] | |
| simp only [ih (n+1) (by omega),lintegral_const,measure_univ,mul_one] | |
| lemma tagged_continuation_mass {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| {w : β β State M β Vector d β ββ₯0β} | |
| (hΟ : β t j, Measurable (Ο t j)) (hw : β n j, Measurable (w n j)) | |
| (hw1 : β n j s, w n j s β€ 1) | |
| {a q : β} {C : ββ₯0β} (hC : C β 0) (hCt : C β β) | |
| (hlocal : β n j, PolynomialMass (ambientSphereLaw.withDensity (w n j)) a C) | |
| (hd : 1 β€ d) (ha : a β€ d) (hq : 2 β€ q) (hqa : 2*q β€ a) | |
| (j : TaggedState M T) : | |
| PolynomialMass (ambientSphereLaw.withDensity | |
| (continuation (taggedStep Ο) (taggedWeight w) 0 T j)) a | |
| (C * streamFactor (E := Vector d) (J := TaggedState M q) q ^ ((T+q-1)/q)) := by | |
| have he := fun s => continuation_tagged_eq (Ο := Ο) (w := w) 0 T (by omega) j s | |
| cases j with | |
| | inl j => | |
| have he' : continuation (taggedStep (T := T) Ο) (taggedWeight w) 0 T (.inl j) = stoppedContinuation Ο w 0 T j := | |
| funext he | |
| rw [he'] | |
| exact stoppedContinuation_mass_bound hΟ hw hw1 hC hCt hlocal hd ha hq hqa 0 T j | |
| | inr done => | |
| have he' : continuation (taggedStep (T := T) Ο) (taggedWeight w) 0 T (.inr done) = w done.1 done.2 := | |
| funext he | |
| rw [he'] | |
| intro z r hr | |
| apply (hlocal _ _ z r hr).trans | |
| apply mul_le_mul' _ le_rfl | |
| exact le_mul_of_one_le_right' (one_le_powβ (one_le_streamFactor (by omega))) | |
| variable [NeZero d] | |
| lemma stopped_route_mixed_bound {Ο : β β State M β (Vector d Γ β) β Bool Γ State M} | |
| (hΟ : β t j, Measurable (Ο t j)) (y : β β State M β Vector d) | |
| {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1) {a q : β} {b : β} | |
| (hb : 0 β€ b) (hab : (a:β)+b β€ (d-1:β)) | |
| (hq : 2 β€ q) (hqa : 2*q β€ a) (j : TaggedState M T) : | |
| ((uniformSphere d).prod (sampleLaw d T)) | |
| {z | dist z.1.val | |
| (match streamRoute (taggedStep (T := T) Ο) 0 T j (z.2,fun i => βͺz.1.val,z.2 iβ«) with | |
| | .inl a => y T a | |
| | .inr (t,a) => y t a) β€ Ξ΅} β€ | |
| (ENNReal.ofReal ((3:β)*4^d)*ENNReal.ofReal (Ξ΅^b)) * | |
| streamFactor (E := Vector d) (J := TaggedState M q) q ^ ((T+q-1)/q) := by | |
| let w : β β State M β Vector d β ββ₯0β := fun n j => capWeight (y n j) Ξ΅ | |
| let Ξ΄ := taggedStep (T := T) Ο | |
| let w' : β β TaggedState M T β Vector d β ββ₯0β := taggedWeight w | |
| let yy : TaggedState M T β Vector d := fun a => match a with | |
| | .inl a => y T a | |
| | .inr (t,a) => y t a | |
| have hw' (n : β) (a : TaggedState M T) : Measurable (w' n a) := | |
| measurable_taggedWeight (fun n j => measurable_capWeight _ _) n a | |
| have hΞ΄ := measurable_taggedStep (T := T) hΟ | |
| have hV := measurable_continuation hΞ΄ hw' 0 T j | |
| have he (s : Vector d) : continuation Ξ΄ w' 0 T j s = | |
| β«β» A : Fin T β Vector d, capWeight (yy (streamRoute Ξ΄ 0 T j (A,fun i => βͺs,A iβ«))) Ξ΅ s | |
| βMeasure.pi (fun _ => stdGaussian (Vector d)) := by | |
| have hu := continuation_unroll (w := w') hΞ΄ 0 T 0 j s | |
| simp only [Nat.add_zero,continuation] at hu | |
| rw [hu] | |
| unfold blockValue | |
| apply lintegral_congr | |
| intro A | |
| cases streamRoute Ξ΄ 0 T j (A,fun i => βͺs,A iβ«) <;> simp [w',w,yy,taggedWeight] | |
| let S : Set (UnitSphere d Γ Samples d T) := | |
| {z | dist z.1.val (yy (streamRoute Ξ΄ 0 T j (z.2,fun i => βͺz.1.val,z.2 iβ«))) β€ Ξ΅} | |
| have hS : MeasurableSet S := by | |
| apply measurableSet_le _ measurable_const | |
| exact (measurable_subtype_coe.comp measurable_fst).dist | |
| ((measurable_of_finite yy).comp ((measurable_streamRoute hΞ΄ 0 T j).comp (by fun_prop))) | |
| change ((sphereLaw (E := Vector d)).prod _) S β€ _ | |
| rw [β one_mul (((sphereLaw (E := Vector d)).prod _) S), β lintegral_indicator_const hS 1, | |
| lintegral_prod _ (measurable_const.indicator hS).aemeasurable] | |
| have hf : β s : UnitSphere d, | |
| (β«β» A, S.indicator (fun _ => (1:ββ₯0β)) (s,A) βsampleLaw d T) = continuation Ξ΄ w' 0 T j s.val := by | |
| intro s | |
| rw [he] | |
| apply lintegral_congr | |
| intro A | |
| classical | |
| change (if dist s.val (yy (streamRoute Ξ΄ 0 T j (A,fun i => βͺs.val,A iβ«))) β€ Ξ΅ then 1 else 0) = _ | |
| unfold capWeight | |
| rw [Set.indicator_apply] | |
| rfl | |
| simp_rw [hf] | |
| rw [β lintegral_map hV measurable_subtype_coe] | |
| apply ambient_mass_bound (a := a) | |
| have ha : a β€ d := by | |
| have hdn : ((d-1:β):β) β€ (d:β) := by exact_mod_cast Nat.sub_le d 1 | |
| have : (a:β) β€ d := by linarith | |
| exact_mod_cast this | |
| have hl (n : β) (j : State M) : PolynomialMass (ambientSphereLaw.withDensity (w n j)) a | |
| (ENNReal.ofReal ((3:β)*4^d)*ENNReal.ofReal (Ξ΅^b)) := by | |
| simpa only [finrank_euclideanSpace_fin] using capWeight_mass_mixed (y n j) hΞ΅ hΞ΅1 a hb (by simpa using hab) | |
| exact tagged_continuation_mass hΟ (fun n j => measurable_capWeight _ _) | |
| (fun n j s => capWeight_le_one _ _ _) | |
| (mul_ne_zero (by positivity) (by positivity)) | |
| (ENNReal.mul_ne_top ENNReal.ofReal_ne_top ENNReal.ofReal_ne_top) | |
| hl | |
| (Nat.pos_of_ne_zero (NeZero.ne d)) ha hq hqa j | |
| end Learner | |
| end NoiselessRegression | |
| end | |
| end OAI | |