Download data/lean/OAI/Probability/MemoryPrecision/Precision.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.29 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/Precision.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/MemoryPrecision/Precision.lean
-
curl -L -o Precision.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/Precision.lean
5.29 kB
| import Mathlib | |
| import OAI.Probability.GaussianRegression.Main | |
| import OAI.Probability.MemoryPrecision.KernelAdmissibility | |
| import OAI.Probability.MemoryPrecision.KernelStream | |
| import OAI.Probability.MemoryPrecision.Reflection | |
| namespace OAI | |
| open MeasureTheory ProbabilityTheory Set Filter EuclideanGeometry | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise | |
| noncomputable section | |
| universe u v | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise | |
| namespace MemoryPrecision.Kernel | |
| open MemoryPrecision NoiselessRegression | |
| lemma precision_from_exact_bound {d M T : β} {Ξ΅ C A : β} | |
| (hd : 32 β€ d) (hT : d β€ 4*T) (hC : 0 < C) (hA : 0 < A) | |
| (hM : (M:β) β€ A*(d:β)^2) (hΞ΅ : 0 < Ξ΅) | |
| (hb : (2/3:β) β€ | |
| (2*Ξ΅*Real.exp (C*(1+(M:β)/(d:β)^2)*(BlockCount T ((d-1)/8):β)))^(((d:β)-1)/2)) : | |
| (1/(8+20*C*(1+A)))*(d:β)*Real.log (1/Ξ΅) β€ (T:β) := by | |
| have hd0 : (0:β) < d := by exact_mod_cast (show 0 < d by omega) | |
| have hdp : (d:β) β€ 4*T := by exact_mod_cast hT | |
| let q := (d-1)/8 | |
| let b := BlockCount T q | |
| let a := ((d:β)-1)/2 | |
| let X := C*(1+(M:β)/(d:β)^2)*(b:β) | |
| have hq : 0 < q := by dsimp [q]; omega | |
| have hdq : (d:β) β€ 16*(q:β) := by | |
| exact_mod_cast (show d β€ 16*q by dsimp [q]; omega) | |
| have hq0 : (0:β) < q := by exact_mod_cast hq | |
| have hbd : (b:β)*(d:β) β€ 20*T := by | |
| have hceil : (b:β) β€ (T:β)/q+1 := | |
| (Nat.ceil_lt_add_one (by positivity : (0:β) β€ (T:β)/q)).le | |
| calc | |
| _ β€ ((T:β)/q+1)*d := mul_le_mul_of_nonneg_right hceil hd0.le | |
| _ = ((T:β)/q)*d+d := by ring | |
| _ β€ ((T:β)/q)*(16*q)+d := by gcongr | |
| _ = 16*T+d := by field_simp | |
| _ β€ _ := by linarith | |
| have ha : 1 β€ a := by | |
| dsimp [a] | |
| have : (32:β) β€ d := by exact_mod_cast hd | |
| linarith | |
| have ha0 : 0 < a := by linarith | |
| have hlog := Real.log_le_log (by norm_num : (0:β) < 2/3) hb | |
| change Real.log (2/3:β) β€ Real.log ((2*Ξ΅*Real.exp X)^a) at hlog | |
| rw [Real.log_rpow (by positivity), Real.log_mul (by positivity) (by positivity), | |
| Real.log_exp, Real.log_mul (by norm_num) hΞ΅.ne'] at hlog | |
| have hl2 : Real.log 2 β€ (1:β) := by | |
| convert Real.log_le_sub_one_of_pos (by norm_num : (0:β) < 2) using 1 | |
| norm_num | |
| have hl23 : -(1:β) β€ Real.log (2/3:β) := by | |
| have h := Real.one_sub_inv_le_log_of_pos (by norm_num : (0:β) < 2/3) | |
| norm_num at h | |
| linarith | |
| have hle : Real.log (1/Ξ΅) β€ 2+X := by | |
| have hmul := mul_le_mul_of_nonneg_left hl2 ha0.le | |
| have he : Real.log (1/Ξ΅) = -Real.log Ξ΅ := by simp | |
| rw [he] | |
| nlinarith | |
| have hmem : (M:β)/(d:β)^2 β€ A := (div_le_iffβ (sq_pos_of_pos hd0)).2 hM | |
| have hX : X*(d:β) β€ 20*C*(1+A)*T := by | |
| calc | |
| _ = C*(1+(M:β)/(d:β)^2)*((b:β)*d) := by dsimp [X]; ring | |
| _ β€ C*(1+A)*((b:β)*d) := by gcongr | |
| _ β€ C*(1+A)*(20*T) := mul_le_mul_of_nonneg_left hbd (by positivity) | |
| _ = _ := by ring | |
| have hfinal : (d:β)*Real.log (1/Ξ΅) β€ (8+20*C*(1+A))*T := by | |
| have hh := mul_le_mul_of_nonneg_left hle hd0.le | |
| nlinarith | |
| have hp : 0 < 8+20*C*(1+A) := by positivity | |
| calc | |
| _ = ((d:β)*Real.log (1/Ξ΅))/(8+20*C*(1+A)) := by ring | |
| _ β€ _ := (div_le_iffβ hp).2 (by nlinarith) | |
| namespace Policy | |
| lemma source_uniform_of_pointwise {d M T : β} {Ξ© : Type u} [MeasurableSpace Ξ©] | |
| (L : Ξ© β Policy d M T) (Ο : Measure Ξ©) [IsProbabilityMeasure Ο] | |
| (hd : 0 < d) (hL : Admissible L Ο (UniformSphere d)) (Ξ΅ : β) | |
| (hs : β s, (2/3:ββ₯0β) β€ FixedSuccess L Ο Ξ΅ s) : | |
| (2/3:ββ₯0β) β€ Success L Ο (UniformSphere d) Ξ΅ := by | |
| let : NeZero d := β¨hd.ne'β© | |
| have hm := hL.experiment (angleTest Ξ΅) (measurable_angleTest Ξ΅) (angleTest_le_one Ξ΅) | |
| unfold Success | |
| rw [lintegral_prod _ hm] | |
| calc | |
| _ = β«β» _s : MemoryPrecision.Kernel.Sphere d, (2/3:ββ₯0β) βUniformSphere d := by simp | |
| _ β€ _ := lintegral_mono hs | |
| lemma source_precision {d M T : β} {Ξ© : Type u} [MeasurableSpace Ξ©] | |
| (L : Ξ© β Policy d M T) (Ο : Measure Ξ©) [IsProbabilityMeasure Ο] | |
| (hd : 32 β€ d) (hL : Admissible L Ο (UniformSphere d)) {Ξ΅ A : β} | |
| (hA : 0 < A) (hM : (M:β) β€ A*(d:β)^2) (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1/10) | |
| (hs : (2/3:ββ₯0β) β€ Success L Ο (UniformSphere d) Ξ΅) : | |
| (1/(8+20*StreamConstant*(1+A)))*(d:β)*Real.log (1/Ξ΅) β€ (T:β) := by | |
| have hT : d β€ 4*T := by | |
| by_contra hn | |
| have hb := hs.trans (source_linear_success_bound L Ο (by omega) (by omega) hΞ΅1 hL) | |
| have hb' : ENNReal.ofReal (2/3:β) β€ ENNReal.ofReal (21/32:β) := by | |
| simpa [ENNReal.ofReal_div_of_pos] using hb | |
| have hh := (ENNReal.ofReal_le_ofReal_iff (by norm_num : (0:β) β€ 21/32)).mp hb' | |
| norm_num at hh | |
| have hb := hs.trans (source_stream_explicit d M T hd Ξ΅ hΞ΅ hΞ΅1 Ξ© Ο inferInstance L hL) | |
| have hb' : (2/3:β) β€ | |
| (2*Ξ΅*Real.exp (StreamConstant*(1+(M:β)/(d:β)^2)*(BlockCount T ((d-1)/8):β)))^(((d:β)-1)/2) := by | |
| apply (ENNReal.ofReal_le_ofReal_iff (by positivity)).mp | |
| simpa [ENNReal.ofReal_div_of_pos] using hb.trans (min_le_right _ _) | |
| exact precision_from_exact_bound hd hT streamConstant_pos hA hM hΞ΅ hb' | |
| end Policy | |
| end MemoryPrecision.Kernel | |
| end | |
| end OAI | |