Download data/lean/OAI/Probability/MemoryPrecision/SuccessArithmetic.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.34 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/SuccessArithmetic.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/MemoryPrecision/SuccessArithmetic.lean
-
curl -L -o SuccessArithmetic.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/SuccessArithmetic.lean
4.34 kB
| import Mathlib | |
| import OAI.Probability.GaussianRegression.Main | |
| import OAI.Probability.MemoryPrecision.RealContinuation | |
| 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 | |
| def SuccessConstant : β := 6*StepConstant | |
| lemma successConstant_one : 1 β€ SuccessConstant := by | |
| have h := stepConstant_one | |
| dsimp [SuccessConstant] | |
| linarith | |
| lemma stopping_factor_bound {d : β} (hd : 16 β€ d) (T : β) : | |
| (T+1:β) β€ ((2:β)^d)^BlockCount T (d/8) := by | |
| have hT := blockCount_mul_ge T (by omega : 0 < d/8) | |
| have hp : d/8 β€ d := Nat.div_le_self _ _ | |
| have hTd : T β€ d * BlockCount T (d/8) := by nlinarith | |
| have htwo : (T+1:β) β€ 2^T := Nat.lt_two_pow_self | |
| have hpow : (2:β)^T β€ 2^(d * BlockCount T (d/8)) := | |
| pow_le_pow_rightβ (by norm_num) hTd | |
| rw [pow_mul] at hpow | |
| exact (by exact_mod_cast htwo : (T+1:β) β€ (2:β)^T).trans hpow | |
| lemma stopping_step_bound {d N K : β} (hd : 16 β€ d) (hN : 1 β€ N) (hNK : N β€ K) | |
| (T : β) : | |
| (T+1:β) * RealStep d N ^ BlockCount T (d/8) β€ | |
| ((2*StepConstant)^d * (K:β)^(1/((d/8:β):β))) ^ BlockCount T (d/8) := by | |
| have hSp := stepConstant_pos | |
| have hR := realStep_pos d hN | |
| have hn0 : (0:β) β€ N := by positivity | |
| have hroot : (N:β)^(1/((d/8:β):β)) β€ (K:β)^(1/((d/8:β):β)) := | |
| Real.rpow_le_rpow hn0 (by exact_mod_cast hNK) (by positivity) | |
| calc | |
| _ β€ ((2:β)^d)^BlockCount T (d/8) * RealStep d N ^ BlockCount T (d/8) := | |
| mul_le_mul_of_nonneg_right (stopping_factor_bound hd T) (by positivity) | |
| _ = ((2*StepConstant)^d * (N:β)^(1/((d/8:β):β))) ^ BlockCount T (d/8) := by | |
| rw [β mul_pow] | |
| congr 1 | |
| simp only [RealStep, mul_pow] | |
| ring | |
| _ β€ _ := pow_le_pow_leftβ (by positivity) | |
| (mul_le_mul_of_nonneg_left hroot (by positivity)) _ | |
| lemma stopping_step_bound_three {d N K T : β} (hd : 16 β€ d) (hN : 1 β€ N) | |
| (hNK : N β€ K) (hT : 0 < T) : | |
| 3 * ((T+1:β) * RealStep d N ^ BlockCount T (d/8)) β€ | |
| (SuccessConstant^d * (K:β)^(1/((d/8:β):β))) ^ BlockCount T (d/8) := by | |
| have hSp := stepConstant_pos | |
| have hR := realStep_pos d hN | |
| have hb := blockCount_pos hT (by omega : 0 < d/8) | |
| have h3 : (3:β) β€ ((3:β)^d)^BlockCount T (d/8) := by | |
| rw [β pow_mul] | |
| have hdb : 1 β€ d * BlockCount T (d/8) := Nat.mul_pos (by omega) hb | |
| simpa using pow_le_pow_rightβ (by norm_num : (1:β) β€ 3) hdb | |
| have hroot0 : 0 β€ (K:β)^(1/((d/8:β):β)) := by positivity | |
| calc | |
| _ β€ ((3:β)^d)^BlockCount T (d/8) * | |
| ((2*StepConstant)^d * (K:β)^(1/((d/8:β):β))) ^ BlockCount T (d/8) := | |
| mul_le_mul h3 (stopping_step_bound hd hN hNK T) | |
| (by positivity) (by positivity) | |
| _ = _ := by | |
| rw [β mul_pow] | |
| congr 1 | |
| rw [β mul_assoc, β mul_pow] | |
| congr 2 | |
| dsimp [SuccessConstant] | |
| ring | |
| lemma cap_constant_le {d : β} (hd : 1 β€ d) : (3*4^d:β) β€ 12^d := by | |
| have h3 : (3:β) β€ 3^d := by | |
| simpa using pow_le_pow_rightβ (by norm_num : (1:β) β€ 3) hd | |
| calc | |
| _ β€ 3^d*4^d := mul_le_mul_of_nonneg_right h3 (by positivity) | |
| _ = _ := by rw [β mul_pow]; norm_num | |
| lemma terminal_angular_zero_bound {d : β} (hd : 16 β€ d) {Ξ΅ : β} | |
| (hΞ΅ : 0 < Ξ΅) (hΞ΅1 : Ξ΅ β€ 1/10) : | |
| (3*4^d:β)*Ξ΅^(d-1) β€ 4^d*Ξ΅^(((d:β)-1)/2) := by | |
| have hd' : (16:β) β€ d := by exact_mod_cast hd | |
| have hΞ± : (1:β) β€ ((d:β)-1)/2 := by linarith | |
| have hΞ΅a : Ξ΅^(((d:β)-1)/2) β€ Ξ΅ := by | |
| simpa using Real.rpow_le_rpow_of_exponent_ge hΞ΅ (by linarith : Ξ΅ β€ 1) hΞ± | |
| have hn : ((d-1:β):β) = (d:β)-1 := by rw [Nat.cast_sub (by omega), Nat.cast_one] | |
| have he : Ξ΅^(d-1) = Ξ΅^(((d:β)-1)/2) * Ξ΅^(((d:β)-1)/2) := by | |
| rw [β Real.rpow_add hΞ΅, β Real.rpow_natCast, hn] | |
| congr 1 | |
| ring | |
| rw [he] | |
| have haux : 3*Ξ΅^(((d:β)-1)/2) β€ 1 := by linarith | |
| calc | |
| _ = (4^d*Ξ΅^(((d:β)-1)/2)) * (3*Ξ΅^(((d:β)-1)/2)) := by ring | |
| _ β€ (4^d*Ξ΅^(((d:β)-1)/2)) * 1 := mul_le_mul_of_nonneg_left haux (by positivity) | |
| _ = _ := mul_one _ | |
| end MemoryPrecision | |
| end | |
| end OAI | |