Download data/lean/OAI/Probability/SKRatio/Dynamics/ClockTransfer.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.59 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Dynamics/ClockTransfer.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/SKRatio/Dynamics/ClockTransfer.lean
-
curl -L -o ClockTransfer.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/SKRatio/Dynamics/ClockTransfer.lean
7.59 kB
| import Mathlib | |
| import OAI.Probability.SKRatio.Dynamics.Median | |
| import OAI.Probability.SKRatio.Dynamics.PoissonBinomial | |
| import OAI.Probability.SKRatio.Dynamics.ClockBridge | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators Topology Matrix | |
| open ContinuousLinearMap MeasureTheory Filter ProbabilityTheory SKRatioClock | |
| namespace SKRatio.Calculus | |
| lemma median_attempts_diverge_of_log_lower | |
| (G : β n : β, Set (Disorder n)) {c : β} (hc : 0 < c) | |
| (hscale : βαΆ n : β in atTop, β g β G n, c*Real.log n β€ medianTime g) : | |
| β R : β, βαΆ n : β in atTop, β g β G n, R β€ (n:β)*medianTime g := by | |
| have hlog : Tendsto (fun n : β => Real.log (n:β)) atTop atTop := | |
| Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop | |
| have hlim : Tendsto (fun n : β => (n:β)*(c*Real.log n)) atTop atTop := | |
| tendsto_natCast_atTop_atTop.atTop_mul_atTopβ (hlog.const_mul_atTop hc) | |
| intro R | |
| filter_upwards [hscale,hlim.eventually_ge_atTop R] with n hn hR | |
| intro g hg | |
| exact hR.trans (mul_le_mul_of_nonneg_left (hn g hg) (Nat.cast_nonneg n)) | |
| lemma upper_median_clock_diverges | |
| (G : β n : β, Set (Disorder n)) {b : β} (hb : 0 < b) | |
| (hdiv : β R : β, βαΆ n : β in atTop, β g β G n, R β€ (n:β)*medianTime g) : | |
| β K : β, βαΆ n : β in atTop, β g β G n, | |
| K β€ β(1+b)*(n:β)*medianTime gββ := by | |
| intro K | |
| have hp : 0 < 1+b := by linarith | |
| filter_upwards [hdiv ((K:β)/(1+b))] with n hn | |
| intro g hg | |
| have hx := (div_le_iffβ hp).mp (hn g hg) | |
| have hy : (K:β) β€ (β(1+b)*(n:β)*medianTime gββ:β) := by | |
| apply le_trans _ (Nat.le_ceil _) | |
| nlinarith only [hx] | |
| exact_mod_cast hy | |
| lemma upper_clock_shifted_time {n : β} (hn : 0 < n) (t : β) | |
| {b q y : β} (hb : 0 < b) (hq : 0 < q) | |
| (hy : |y| β€ (q*b/(2*(1+b)))*Real.sqrt (β(1+b)*(n:β)*tββ:β)) : | |
| (1+b/2)*t β€ | |
| (q*(β(1+b)*(n:β)*tββ:β)+y*Real.sqrt (β(1+b)*(n:β)*tββ:β))/(q*n) := by | |
| let M : β := β(1+b)*(n:β)*tββ | |
| let c := q*b/(2*(1+b)) | |
| have hc : 0 < c := by dsimp [c]; positivity | |
| have hcq : c < q := by | |
| dsimp [c] | |
| apply (div_lt_iffβ (by positivity : 0 < 2*(1+b))).mpr | |
| nlinarith | |
| have hn' : (0:β) < n := Nat.cast_pos.mpr hn | |
| have hM : (1+b)*(n:β)*t β€ (M:β) := Nat.le_ceil _ | |
| have hsq : Real.sqrt (M:β)^2 = (M:β) := Real.sq_sqrt (Nat.cast_nonneg _) | |
| have herr : -c*(M:β) β€ y*Real.sqrt (M:β) := by | |
| have hh := mul_le_mul_of_nonneg_right hy (Real.sqrt_nonneg (M:β)) | |
| have hy' := mul_le_mul_of_nonneg_right (neg_abs_le y) (Real.sqrt_nonneg (M:β)) | |
| change |y| * Real.sqrt (M:β) β€ c*Real.sqrt (M:β)*Real.sqrt (M:β) at hh | |
| nlinarith | |
| apply (le_div_iffβ (mul_pos hq hn')).mpr | |
| have hmain := mul_le_mul_of_nonneg_left hM (sub_pos.mpr hcq).le | |
| have hid : (q-c)*(1+b) = q*(1+b/2) := by | |
| dsimp [c] | |
| field_simp | |
| ring | |
| change _ β€ q*(M:β)+y*Real.sqrt (M:β) | |
| calc | |
| _ = (q-c)*((1+b)*(n:β)*t) := by | |
| calc | |
| _ = ((q-c)*(1+b))*(n:β)*t := by rw [hid]; ring | |
| _ = _ := by ring | |
| _ β€ (q-c)*(M:β) := hmain | |
| _ β€ _ := by nlinarith | |
| lemma uniform_upper_clock_shift | |
| (G : β n : β, Set (Disorder n)) {b q : β} (hb : 0 < b) (hq : 0 < q) | |
| (hdiv : β R : β, βαΆ n : β in atTop, β g β G n, R β€ (n:β)*medianTime g) | |
| (y : β) : | |
| βαΆ n : β in atTop, β g β G n, | |
| (1+b/2)*medianTime g β€ | |
| (q*(β(1+b)*(n:β)*medianTime gββ:β)+ | |
| y*Real.sqrt (β(1+b)*(n:β)*medianTime gββ:β))/(q*n) := by | |
| have hc : 0 < q*b/(2*(1+b)) := by positivity | |
| have hs := (Real.tendsto_sqrt_atTop.comp | |
| (tendsto_natCast_atTop_atTop : Tendsto (fun n : β => (n:β)) atTop atTop)).const_mul_atTop hc | |
| obtain β¨N,hNβ© := eventually_atTop.mp (hs.eventually_ge_atTop |y|) | |
| filter_upwards [upper_median_clock_diverges G hb hdiv N,eventually_gt_atTop 0] with n hn hn0 | |
| intro g hg | |
| exact upper_clock_shifted_time hn0 (medianTime g) hb hq (hN _ (hn g hg)) | |
| theorem uniform_discrete_upper_of_holding | |
| (G : β n : β, Set (Disorder n)) {b q : β} | |
| (hb : 0 < b) (hq : 0 < q) (hq1 : q < 1) | |
| (hdiv : β R : β, βαΆ n : β in atTop, β g β G n, R β€ (n:β)*medianTime g) | |
| (hhold : β n, 0 < n β β g β G n, β x, 1-q β€ transition g x x) | |
| (hcont : β Ξ΄ : β, 0 < Ξ΄ β βαΆ n : β in atTop, β g β G n, | |
| continuousDistance g ((1+b/2)*medianTime g) β€ Ξ΄) : | |
| β Ξ΄ : β, 0 < Ξ΄ β βαΆ n : β in atTop, β g β G n, | |
| discreteDistance g β(1+b)*(n:β)*medianTime gββ β€ Ξ΄ := by | |
| classical | |
| let ΞΉ : β β Type := fun n => Option | |
| ({g : Disorder n // g β G n β§ 0 < n} Γ Spin n Γ | |
| {f : Observables n // β x, |f x| β€ 1}) | |
| let M : (n : β) β ΞΉ n β β := fun n i => match i with | |
| | none => n+1 | |
| | some j => β(1+b)*(n:β)*medianTime j.1.valββ | |
| let a : (n : β) β ΞΉ n β β β β := fun _ i k => match i with | |
| | none => 0 | |
| | some j => (residualAttempt (coupling j.1.val) q ^ k) j.2.2.val j.2.1- | |
| FiniteLaw.mean (mass j.1.val 0) j.2.2.val | |
| have hM : β K : β, βαΆ n in atTop, β i : ΞΉ n, K β€ M n i := by | |
| intro K | |
| filter_upwards [upper_median_clock_diverges G hb hdiv K,eventually_ge_atTop K] with n hn hnK | |
| intro i | |
| cases i with | |
| | none => exact hnK.trans (Nat.le_succ n) | |
| | some j => exact hn j.1.val j.1.property.1 | |
| have hab : β n (i : ΞΉ n) k, |a n i k| β€ 2 := by | |
| intro n i k | |
| cases i with | |
| | none => norm_num [a] | |
| | some j => | |
| exact residual_test_bound j.1.val hq | |
| (hhold n j.1.property.2 j.1.val j.1.property.1) j.2.2.val j.2.2.property j.2.1 k | |
| have hp : β y Ξ΅ : β, 0 < Ξ΅ β βαΆ n in atTop, β i : ΞΉ n, | |
| |β' j, Clock.poissonMass (q*M n i+y*Real.sqrt (M n i)) j*a n i j| < Ξ΅ := by | |
| intro y Ξ΅ hΞ΅ | |
| filter_upwards [uniform_upper_clock_shift G hb hq hdiv y,hcont (Ξ΅/4) (by positivity)] with n hn hcn | |
| intro i | |
| cases i with | |
| | none => simpa only [a,mul_zero,tsum_zero,abs_zero] using hΞ΅ | |
| | some j => | |
| change |β' k, Clock.poissonMass | |
| (q*(β(1+b)*(n:β)*medianTime j.1.valββ:β)+ | |
| y*Real.sqrt (β(1+b)*(n:β)*medianTime j.1.valββ:β)) k* | |
| ((residualAttempt (coupling j.1.val) q ^ k) j.2.2.val j.2.1- | |
| FiniteLaw.mean (mass j.1.val 0) j.2.2.val)| < Ξ΅ | |
| rw [residual_poisson_test j.1.property.2 j.1.val hq.ne'] | |
| have htime := hn j.1.val j.1.property.1 | |
| have ht : 0 β€ (1+b/2)*medianTime j.1.val := | |
| mul_nonneg (by linarith) (medianTime_mem j.1.val).1 | |
| have hbd := (continuous_test_bound j.1.val _ j.2.2.val j.2.2.property j.2.1).trans | |
| (mul_le_mul_of_nonneg_left (continuousDistance_antitone j.1.val ht htime) (by norm_num)) | |
| have hc := hcn j.1.val j.1.property.1 | |
| linarith | |
| have hbin := Clock.poisson_to_binomial_uniform_clocks hq hq1 M hM a hab hp | |
| intro Ξ΄ hΞ΄ | |
| filter_upwards [hbin Ξ΄ hΞ΄,eventually_gt_atTop 0] with n hn hn0 | |
| intro g hg | |
| apply Finset.sup'_le | |
| intro x _ | |
| apply FiniteLaw.totalVariation_le_of_tests | |
| intro f hf | |
| let i : ΞΉ n := some (β¨g,hg,hn0β©,x,β¨f,hfβ©) | |
| have hbd := hn i | |
| change |β' k, Clock.binomialMass q β(1+b)*(n:β)*medianTime gββ k* | |
| ((residualAttempt (coupling g) q ^ k) f x-FiniteLaw.mean (mass g 0) f)| < Ξ΄ at hbd | |
| rw [residual_binomial_test g hq.ne'] at hbd | |
| change |((transition g ^ β(1+b)*(n:β)*medianTime gββ) *α΅₯ f) x- | |
| FiniteLaw.mean (mass g 0) f| β€ 2*Ξ΄ | |
| linarith | |
| end SKRatio.Calculus | |
| end | |
| end | |
| end OAI | |