Download data/lean/OAI/Probability/FreeIsing/Estimates/DyadicContinuity.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 12.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Estimates/DyadicContinuity.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/FreeIsing/Estimates/DyadicContinuity.lean
-
curl -L -o DyadicContinuity.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/FreeIsing/Estimates/DyadicContinuity.lean
12.2 kB
| import OAI.Probability.FreeIsing.Estimates.ContinuousModification | |
| namespace OAI | |
| noncomputable section | |
| open Filter | |
| open scoped Topology NNReal | |
| namespace Problem367.DyadicContinuity | |
| theorem geometric_limit {T : Type*} (u : β β T β β) (s : Set T) | |
| {C r : β} (_hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) | |
| (hstep : β n t, t β s β dist (u n t) (u (n+1) t) β€ C * r^n) : | |
| β t β s, | |
| Tendsto (fun n => u n t) atTop (π (limUnder atTop (fun n => u n t))) β§ | |
| β n, dist (u n t) (limUnder atTop (fun m => u m t)) β€ | |
| C * r^n * (1-r)β»ΒΉ := by | |
| intro t ht | |
| have hs : Summable (fun n : β => C * r^n) := | |
| (summable_geometric_of_norm_lt_one (by simpa [Real.norm_eq_abs, abs_of_nonneg hr] using hr1)).mul_left C | |
| obtain β¨a, haβ© := cauchySeq_tendsto_of_complete | |
| (cauchySeq_of_dist_le_of_summable (fun n => C*r^n) (fun n => hstep n t ht) hs) | |
| have hlim : Tendsto (fun n => u n t) atTop | |
| (π (limUnder atTop (fun n => u n t))) := by rwa [ha.limUnder_eq] | |
| refine β¨hlim, fun n => ?_β© | |
| have h := dist_le_tsum_of_dist_le_of_tendsto (fun n => C*r^n) | |
| (fun n => hstep n t ht) hs hlim n | |
| calc | |
| dist (u n t) (limUnder atTop (fun m => u m t)) β€ β' m : β, C*r^(n+m) := h | |
| _ = C*r^n*(1-r)β»ΒΉ := by | |
| simp only [pow_add, β mul_assoc] | |
| rw [tsum_mul_left, tsum_geometric_of_lt_one hr hr1] | |
| theorem continuousOn_geometric_limit {T : Type*} [PseudoMetricSpace T] | |
| (u : β β T β β) (s : Set T) {C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) | |
| (hstep : β n t, t β s β dist (u n t) (u (n+1) t) β€ C*r^n) | |
| (hosc : β n x, x β s β β Ξ΄ > 0, β y β s, | |
| dist y x < Ξ΄ β dist (u n y) (u n x) β€ C*r^n) : | |
| ContinuousOn (fun t => limUnder atTop (fun n => u n t)) s := by | |
| apply Metric.continuousOn_iff.mpr | |
| intro x hx Ξ΅ hΞ΅ | |
| have he : Tendsto (fun n : β => (2*C*(1-r)β»ΒΉ+C)*r^n) atTop (π 0) := by | |
| simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one hr hr1).const_mul | |
| (2*C*(1-r)β»ΒΉ+C) | |
| obtain β¨n, hnβ© := (he.eventually_lt_const hΞ΅).exists | |
| obtain β¨Ξ΄, hΞ΄, hΞ΄boundβ© := hosc n x hx | |
| refine β¨Ξ΄, hΞ΄, fun y hy hxy => ?_β© | |
| have hxerr := (geometric_limit u s hC hr hr1 hstep x hx).2 n | |
| have hyerr := (geometric_limit u s hC hr hr1 hstep y hy).2 n | |
| have htri := dist_triangle4 | |
| (limUnder atTop (fun n => u n y)) (u n y) (u n x) | |
| (limUnder atTop (fun n => u n x)) | |
| rw [dist_comm (limUnder atTop (fun n => u n y)) (u n y)] at htri | |
| have hosc' := hΞ΄bound y hy hxy | |
| nlinarith | |
| private theorem floor_double_cases (x : β) : | |
| β2*xβ = 2*βxβ β¨ β2*xβ = 2*βxβ+1 := by | |
| have hlo : 2*βxβ β€ β2*xβ := Int.le_floor.mpr (by | |
| have := Int.floor_le x | |
| push_cast | |
| linarith) | |
| have hhi : β2*xβ < 2*βxβ+2 := Int.floor_lt.mpr (by | |
| have := Int.lt_floor_add_one x | |
| push_cast | |
| linarith) | |
| omega | |
| private theorem floor_near_cases {x y : β} (h : |x-y| < 1) : | |
| βxβ = βyβ β¨ βxβ = βyβ+1 β¨ βyβ = βxβ+1 := by | |
| have hxy := (abs_lt.mp h) | |
| have h1 : βxβ < βyβ+2 := Int.floor_lt.mpr (by | |
| have := Int.lt_floor_add_one y | |
| push_cast | |
| linarith) | |
| have h2 : βyβ < βxβ+2 := Int.floor_lt.mpr (by | |
| have := Int.lt_floor_add_one x | |
| push_cast | |
| linarith) | |
| omega | |
| open ContinuousModification | |
| theorem dyadicLeft_refinement (t : β) (n : β) : | |
| dyadicLeft t (n+1) = dyadicLeft t n β¨ | |
| dyadicLeft t (n+1) = dyadicLeft t n + ((2 : β)^(n+1))β»ΒΉ := by | |
| have hp : (2 : β)^n β 0 := by positivity | |
| rcases floor_double_cases ((2 : β)^n*t) with h | h | |
| Β· left | |
| unfold dyadicLeft | |
| rw [pow_succ] | |
| have he : (2 : β)^n*2*t = 2*((2 : β)^n*t) := by ring | |
| rw [he, h] | |
| push_cast | |
| field_simp | |
| Β· right | |
| unfold dyadicLeft | |
| rw [pow_succ] | |
| have he : (2 : β)^n*2*t = 2*((2 : β)^n*t) := by ring | |
| rw [he, h] | |
| push_cast | |
| field_simp | |
| theorem dyadic_refinement_bound (f : β β β) {H B : β} (hB : 0 β€ B) | |
| (n : β) | |
| (hinc : β k : β€, 0 β€ k β (k : β)/(2:β)^(n+1) β€ H β | |
| dist (f ((k:β)/(2:β)^(n+1))) | |
| (f (((k:β)+1)/(2:β)^(n+1))) β€ B) | |
| {t : β} (ht : t β Set.Icc 0 H) : | |
| dist (f (dyadicLeft t n)) (f (dyadicLeft t (n+1))) β€ B := by | |
| rcases dyadicLeft_refinement t n with h | h | |
| Β· rw [h, dist_self] | |
| exact hB | |
| Β· let k : β€ := 2*β(2:β)^n*tβ | |
| have hk : 0 β€ k := by | |
| dsimp [k] | |
| exact mul_nonneg (by norm_num) (Int.floor_nonneg.mpr (mul_nonneg (by positivity) ht.1)) | |
| have he : (k:β)/(2:β)^(n+1) = dyadicLeft t n := by | |
| dsimp [k, dyadicLeft] | |
| rw [pow_succ] | |
| push_cast | |
| field_simp | |
| have he' : ((k:β)+1)/(2:β)^(n+1) = dyadicLeft t (n+1) := by | |
| rw [h, βhe, add_div] | |
| simp [one_div] | |
| rw [βhe, βhe'] | |
| exact hinc k hk (he βΈ (dyadicLeft_le t n).trans ht.2) | |
| theorem dyadic_oscillation_bound (f : β β β) {H B : β} (hB : 0 β€ B) | |
| (n : β) | |
| (hinc : β k : β€, 0 β€ k β (k : β)/(2:β)^n β€ H β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ B) | |
| {x y : β} (hx : x β Set.Icc 0 H) (hy : y β Set.Icc 0 H) | |
| (hxy : dist x y < ((2:β)^n)β»ΒΉ) : | |
| dist (f (dyadicLeft x n)) (f (dyadicLeft y n)) β€ B := by | |
| have hp : (0:β) < 2^n := by positivity | |
| have hclose : |(2:β)^n*x-(2:β)^n*y| < 1 := by | |
| rw [βmul_sub, abs_mul, abs_of_pos hp] | |
| have h := (mul_lt_mul_of_pos_left hxy hp) | |
| rw [Real.dist_eq, mul_inv_cancelβ hp.ne'] at h | |
| exact h | |
| rcases floor_near_cases hclose with h | h | h | |
| Β· simp only [dyadicLeft, h, dist_self] | |
| exact hB | |
| Β· have hk := Int.floor_nonneg.mpr (mul_nonneg hp.le hy.1) | |
| have hb := hinc β(2:β)^n*yβ hk ((dyadicLeft_le y n).trans hy.2) | |
| simpa only [dyadicLeft, h, Int.cast_add, Int.cast_one, dist_comm] using hb | |
| Β· have hk := Int.floor_nonneg.mpr (mul_nonneg hp.le hx.1) | |
| have hb := hinc β(2:β)^n*xβ hk ((dyadicLeft_le x n).trans hx.2) | |
| simpa only [dyadicLeft, h, Int.cast_add, Int.cast_one] using hb | |
| theorem continuousOn_dyadicLimit (f : β β β) {H C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) (N : β) | |
| (hinc : β n β₯ N, β k : β€, 0 β€ k β (k:β)/(2:β)^n β€ H β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ C*r^n) : | |
| ContinuousOn (fun t => limUnder atTop (fun n => f (dyadicLeft t n))) | |
| (Set.Icc 0 H) := by | |
| let u : β β β β β := fun n t => f (dyadicLeft t (n+N)) | |
| have hD : 0 β€ C*r^N := mul_nonneg hC (pow_nonneg hr _) | |
| have hstep : β n t, t β Set.Icc 0 H β | |
| dist (u n t) (u (n+1) t) β€ (C*r^N)*r^n := by | |
| intro n t ht | |
| have hh := dyadic_refinement_bound f | |
| (mul_nonneg hC (pow_nonneg hr (n+N+1))) (n+N) | |
| (hinc (n+N+1) (by omega)) ht | |
| have hp : C*r^(n+N+1) β€ C*r^(n+N) := by | |
| rw [pow_succ] | |
| exact mul_le_mul_of_nonneg_left | |
| (mul_le_of_le_one_right (pow_nonneg hr _) hr1.le) hC | |
| have he : C*r^(n+N) = (C*r^N)*r^n := by rw [pow_add]; ring | |
| simpa only [u, show n+1+N=n+N+1 by omega, he] using hh.trans hp | |
| have hosc : β n x, x β Set.Icc 0 H β β Ξ΄ > 0, β y β Set.Icc 0 H, | |
| dist y x < Ξ΄ β dist (u n y) (u n x) β€ (C*r^N)*r^n := by | |
| intro n x hx | |
| refine β¨((2:β)^(n+N))β»ΒΉ, by positivity, fun y hy hxy => ?_β© | |
| have hh := dyadic_oscillation_bound f | |
| (mul_nonneg hC (pow_nonneg hr (n+N))) (n+N) | |
| (hinc (n+N) (by omega)) hy hx hxy | |
| have he : C*r^(n+N) = (C*r^N)*r^n := by rw [pow_add]; ring | |
| simpa only [u, he] using hh | |
| have hc := continuousOn_geometric_limit u (Set.Icc 0 H) hD hr hr1 hstep hosc | |
| apply hc.congr | |
| intro t ht | |
| have hshift := (geometric_limit u (Set.Icc 0 H) hD hr hr1 hstep t ht).1 | |
| have hfull := (tendsto_add_atTop_iff_nat (f := fun n => f (dyadicLeft t n)) N).mp hshift | |
| exact hfull.limUnder_eq | |
| theorem tendsto_dyadic_sample (f : β β β) {H C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) (N : β) | |
| (hinc : β n β₯ N, β k : β€, 0 β€ k β (k:β)/(2:β)^n β€ H β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ C*r^n) | |
| {t : β} (ht : t β Set.Icc 0 H) : | |
| Tendsto (fun n => f (dyadicLeft t n)) atTop | |
| (π (limUnder atTop (fun n => f (dyadicLeft t n)))) := by | |
| have hs : Summable (fun n : β => C*r^(n+N+1)) := by | |
| have hh : Summable (fun n : β => r^n) := | |
| summable_geometric_of_norm_lt_one (by simpa [Real.norm_eq_abs, abs_of_nonneg hr] using hr1) | |
| simpa [pow_add, mul_assoc, mul_left_comm, mul_comm] using hh.mul_left (C*r^(N+1)) | |
| have hstep (n : β) : dist (f (dyadicLeft t (n+N))) | |
| (f (dyadicLeft t ((n+1)+N))) β€ C*r^(n+N+1) := by | |
| simpa only [show n+1+N=n+N+1 by omega] using | |
| dyadic_refinement_bound f (mul_nonneg hC (pow_nonneg hr _)) (n+N) | |
| (hinc (n+N+1) (by omega)) ht | |
| obtain β¨a, haβ© := cauchySeq_tendsto_of_complete | |
| (cauchySeq_of_dist_le_of_summable _ hstep hs) | |
| have hfull := (tendsto_add_atTop_iff_nat (f := fun n => f (dyadicLeft t n)) N).mp ha | |
| rwa [hfull.limUnder_eq] | |
| theorem dyadicLeft_grid (k : β€) (n m : β) (hnm : n β€ m) : | |
| dyadicLeft ((k:β)/(2:β)^n) m = (k:β)/(2:β)^n := by | |
| obtain β¨l, rflβ© := Nat.exists_eq_add_of_le hnm | |
| have hp : (2:β)^n β 0 := by positivity | |
| have he : (2:β)^(n+l)*((k:β)/(2:β)^n) = ((2:β€)^l*k:β€) := by | |
| push_cast | |
| rw [pow_add] | |
| field_simp | |
| unfold dyadicLeft | |
| rw [he, Int.floor_intCast] | |
| push_cast | |
| rw [pow_add] | |
| field_simp | |
| theorem dyadicLimit_grid (f : β β β) (k : β€) (n : β) : | |
| limUnder atTop (fun m => f (dyadicLeft ((k:β)/(2:β)^n) m)) = | |
| f ((k:β)/(2:β)^n) := by | |
| have he : (fun m => f (dyadicLeft ((k:β)/(2:β)^n) m)) =αΆ [atTop] | |
| (fun _ => f ((k:β)/(2:β)^n)) := by | |
| apply eventually_atTop.mpr | |
| exact β¨n, fun m hm => by dsimp; rw [dyadicLeft_grid k n m hm]β© | |
| exact ((tendsto_congr' he).mpr tendsto_const_nhds).limUnder_eq | |
| theorem continuousOn_Ici_dyadicLimit (f : β β β) {C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) | |
| (hinc : β H : β, β N : β, β n β₯ N, β k : β€, | |
| 0 β€ k β (k:β)/(2:β)^n β€ H β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ C*r^n) : | |
| ContinuousOn (fun t => limUnder atTop (fun n => f (dyadicLeft t n))) | |
| (Set.Ici 0) := by | |
| intro t ht | |
| obtain β¨H, hHβ© := exists_nat_gt t | |
| obtain β¨N, hNβ© := hinc H | |
| have hc := continuousOn_dyadicLimit f hC hr hr1 N hN | |
| apply (hc t (show t β Set.Icc 0 (H:β) from β¨ht, hH.leβ©)).mono_of_mem_nhdsWithin | |
| apply mem_nhdsWithin_iff_exists_mem_nhds_inter.mpr | |
| refine β¨Set.Iio (H:β), Iio_mem_nhds hH, ?_β© | |
| intro x hx | |
| exact β¨hx.2, hx.1.leβ© | |
| theorem continuous_nnreal_dyadicLimit (f : β β β) {C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) | |
| (hinc : β H : β, β N : β, β n β₯ N, β k : β€, | |
| 0 β€ k β (k:β)/(2:β)^n β€ H β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ C*r^n) : | |
| Continuous (fun t : ββ₯0 => limUnder atTop (fun n => f (dyadicLeft t n))) := by | |
| exact (continuousOn_Ici_dyadicLimit f hC hr hr1 hinc).comp_continuous | |
| continuous_subtype_val (fun t => t.property) | |
| theorem continuous_nnreal_dyadicLimit_of_nat_grid (f : β β β) {C r : β} | |
| (hC : 0 β€ C) (hr : 0 β€ r) (hr1 : r < 1) | |
| (hinc : β H : β, β N : β, β n β₯ N, β k : β, k < H*2^n β | |
| dist (f ((k:β)/(2:β)^n)) (f (((k:β)+1)/(2:β)^n)) β€ C*r^n) : | |
| Continuous (fun t : ββ₯0 => limUnder atTop (fun n => f (dyadicLeft t n))) := by | |
| apply continuous_nnreal_dyadicLimit f hC hr hr1 | |
| intro H | |
| obtain β¨N, hNβ© := hinc (H+1) | |
| refine β¨N, fun n hn k hk hkH => ?_β© | |
| have hcast : (k.toNat:β) = (k:β) := by | |
| exact_mod_cast Int.toNat_of_nonneg hk | |
| have hkR : (k:β) β€ (H:β)*(2:β)^n := | |
| (div_le_iffβ (by positivity : (0:β)<2^n)).mp hkH | |
| have hb : (k.toNat:β) < ((H+1:β):β)*(2:β)^n := by | |
| rw [hcast] | |
| have hp : (0:β)<2^n := by positivity | |
| push_cast | |
| nlinarith | |
| have hbNat : k.toNat < (H+1)*2^n := by exact_mod_cast hb | |
| simpa only [hcast] using hN n hn k.toNat hbNat | |
| end Problem367.DyadicContinuity | |
| end | |
| end OAI | |