Download data/lean/OAI/Probability/GaussianRegression/Precision.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.93 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GaussianRegression/Precision.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/GaussianRegression/Precision.lean
-
curl -L -o Precision.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GaussianRegression/Precision.lean
5.93 kB
| import OAI.Probability.GaussianRegression.Success | |
| namespace OAI | |
| /-! | |
| Real-valued success bounds and accuracy-uniform precision tradeoffs. | |
| -/ | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology | |
| open InnerProductSpace | |
| open scoped Pointwise | |
| noncomputable section | |
| universe u | |
| namespace NoiselessRegression | |
| namespace Learner | |
| lemma streaming_success_bound_real {d M T : β} {Ξ© : Type u} [MeasurableSpace Ξ©] | |
| (L : Learner d M T Ξ©) (Ο : Measure Ξ©) [IsProbabilityMeasure Ο] | |
| (hL : L.Admissible Ο) (hd : 3 β€ d) {Ξ΅ : β} (hΞ΅ : 0 < Ξ΅) | |
| {a q : β} (ha : 2*a β€ d-1) (hq : 2 β€ q) (hqa : 2*q β€ a) | |
| (hs : (2/3 : ββ₯0β) β€ L.uniformSuccess Ο Ξ΅) : | |
| (2/3 : β) β€ ((T : β)+1) * ((3 : β)*4^d * Ξ΅^a) * | |
| ((32768 : β)^d * ((2 : β)^M)^(1/(q : β)))^(T/q+1) := by | |
| have hb := hs.trans (L.streaming_success_bound Ο hL hd hΞ΅ ha hq hqa) | |
| have ht : (T+1 : ββ₯0β) * | |
| (ENNReal.ofReal ((3 : β)*4^d) * ENNReal.ofReal (Ξ΅^a)) * | |
| streamFactor (E := Vector d) (J := State M) q ^ (T/q+1) β β := by | |
| apply ENNReal.mul_ne_top | |
| Β· apply ENNReal.mul_ne_top (by simp) | |
| exact ENNReal.mul_ne_top ENNReal.ofReal_ne_top ENNReal.ofReal_ne_top | |
| Β· exact ENNReal.pow_ne_top (streamFactor_ne_top q) | |
| have hr := ENNReal.toReal_mono ht hb | |
| simpa [ENNReal.toReal_div, ENNReal.toReal_ofNat, ENNReal.toReal_mul, | |
| ENNReal.toReal_add, ENNReal.toReal_natCast, ENNReal.toReal_one, | |
| ENNReal.toReal_ofReal (by positivity : (0 : β) β€ 3*4^d), | |
| ENNReal.toReal_ofReal (by positivity : 0 β€ Ξ΅^a), streamFactor, | |
| ENNReal.toReal_pow, β ENNReal.toReal_rpow, finrank_euclideanSpace_fin, | |
| Fintype.card_fin, State, Nat.cast_pow, Nat.cast_ofNat, Vector] using hr | |
| end Learner | |
| lemma precision_from_stream_bound {d M T a q : β} {Ξ΅ A : β} | |
| (hd : 32 β€ d) (hT : d β€ 4*T) (hq : 0 < q) (hdq : d β€ 8*q) | |
| (ha : d β€ 4*a) (hM : (M : β) β€ A * (d : β)^2) (hA : 0 < A) | |
| (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1) | |
| (hbound : (2/3 : β) β€ ((T : β)+1) * ((3 : β)*4^d * Ξ΅^a) * | |
| ((32768 : β)^d * ((2 : β)^M)^(1/(q : β)))^(T/q+1)) : | |
| (1 / (4*(400000+100*A))) * (d : β) * Real.log (1/Ξ΅) β€ (T : β) := by | |
| have hd0 : (0 : β) < d := by exact_mod_cast (by omega : 0 < d) | |
| have hq0 : (0 : β) < q := by exact_mod_cast hq | |
| have hT0 : (0 : β) β€ T := Nat.cast_nonneg T | |
| have hdp : (d : β) β€ 4*T := by exact_mod_cast hT | |
| have hdqp : (d : β) β€ 8*q := by exact_mod_cast hdq | |
| have hap : (d : β) β€ 4*a := by exact_mod_cast ha | |
| have hB : ((T/q+1 : β) : β) * d β€ 12*T := by | |
| have hbd : (T/q+1)*d β€ 12*T := by | |
| have hmul := Nat.div_mul_le_self T q | |
| calc | |
| (T/q+1)*d = (T/q)*d+d := by ring | |
| _ β€ (T/q)*(8*q)+d := Nat.add_le_add_right (Nat.mul_le_mul_left _ hdq) _ | |
| _ = 8*((T/q)*q)+d := by ring | |
| _ β€ 8*T+d := Nat.add_le_add_right (Nat.mul_le_mul_left 8 hmul) _ | |
| _ β€ 12*T := by omega | |
| exact_mod_cast hbd | |
| have hMq : (M : β) / q β€ 8*A*d := by | |
| apply (div_le_iffβ hq0).2 | |
| calc | |
| (M : β) β€ A*d^2 := hM | |
| _ β€ A*d*(8*q) := by nlinarith [mul_le_mul_of_nonneg_left hdqp (by positivity : 0 β€ A*d)] | |
| _ = 8*A*d*q := by ring | |
| have hlog := Real.log_le_log (by norm_num : (0 : β) < 2/3) hbound | |
| rw [Real.log_mul (by positivity) (by positivity), | |
| Real.log_mul (by positivity) (by positivity), | |
| Real.log_mul (by positivity) (by positivity), | |
| Real.log_mul (by positivity) (by positivity), | |
| Real.log_pow, Real.log_pow, Real.log_pow, | |
| Real.log_mul (by positivity) (by positivity), Real.log_pow, | |
| Real.log_rpow (by positivity), Real.log_pow] at hlog | |
| have hlogΞ΅ : Real.log (1/Ξ΅) = -Real.log Ξ΅ := by simp | |
| have hlogΞ΅0 : 0 β€ Real.log (1/Ξ΅) := Real.log_nonneg ((le_div_iffβ hΞ΅).2 (by simpa using hΞ΅1)) | |
| have heq : (1/(q : β)) * ((M : β)*Real.log 2) = ((M : β)/q)*Real.log 2 := by ring | |
| rw [heq] at hlog | |
| have hlT : Real.log ((T : β)+1) β€ T := by | |
| simpa using Real.log_le_sub_one_of_pos (by positivity : (0 : β) < T+1) | |
| have hl3 : Real.log (3 : β) β€ 3 := Real.log_le_self (by norm_num) | |
| have hl4 : Real.log (4 : β) β€ 4 := Real.log_le_self (by norm_num) | |
| have hl32 : Real.log (32768 : β) β€ 32768 := Real.log_le_self (by norm_num) | |
| 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 hinside : (d : β)*Real.log 32768 + ((M : β)/q)*Real.log 2 β€ | |
| (32768+8*A)*d := by | |
| have hm0 : (0 : β) β€ (M : β)/q := by positivity | |
| have h1 := mul_le_mul_of_nonneg_left hl32 hd0.le | |
| have h2 := mul_le_mul_of_nonneg_left hl2 hm0 | |
| nlinarith | |
| have hfull : ((T/q+1 : β) : β) * | |
| ((d : β)*Real.log 32768 + ((M : β)/q)*Real.log 2) β€ | |
| 12*T*(32768+8*A) := by | |
| calc | |
| _ β€ ((T/q+1 : β) : β) * ((32768+8*A)*d) := | |
| mul_le_mul_of_nonneg_left hinside (Nat.cast_nonneg _) | |
| _ = (32768+8*A)*(((T/q+1 : β) : β)*d) := by ring | |
| _ β€ (32768+8*A)*(12*T) := mul_le_mul_of_nonneg_left hB (by positivity) | |
| _ = _ := by ring | |
| have hd4 : (4 : β) β€ d := by exact_mod_cast (by omega : 4 β€ d) | |
| have hlogbound : (a : β)*Real.log (1/Ξ΅) β€ (400000+100*A)*T := by | |
| have h4 := mul_le_mul_of_nonneg_left hl4 hd0.le | |
| rw [hlogΞ΅] | |
| nlinarith [mul_nonneg hA.le hT0] | |
| have hmain : (d : β)*Real.log (1/Ξ΅) β€ 4*(400000+100*A)*T := by | |
| have ham := mul_le_mul_of_nonneg_right hap hlogΞ΅0 | |
| linarith | |
| have hden : (0 : β) < 4*(400000+100*A) := by positivity | |
| calc | |
| _ = ((d : β)*Real.log (1/Ξ΅))/(4*(400000+100*A)) := by ring | |
| _ β€ T := (div_le_iffβ hden).2 (by nlinarith [hmain]) | |
| end NoiselessRegression | |
| end | |
| end OAI | |