Buckets:
| import Mathlib | |
| namespace OAI | |
| section | |
| section | |
| noncomputable section | |
| open MeasureTheory Filter Set | |
| open scoped ENNReal Topology BigOperators | |
| noncomputable section | |
| open scoped BigOperators ComplexConjugate | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped ENNReal NNReal Topology BigOperators | |
| namespace HardSphere.Wiener | |
| abbrev Index := Unit ⊕ (Σ n : ℕ, Fin (2 ^ n)) | |
| abbrev Noise := Index → ℝ | |
| abbrev Time := unitInterval | |
| instance : MeasurableSpace C(Time, ℝ) := borel _ | |
| instance : BorelSpace C(Time, ℝ) := ⟨rfl⟩ | |
| def law : Measure Noise := Measure.infinitePi (fun _ : Index ↦ gaussianReal 0 1) | |
| instance : IsProbabilityMeasure law := by unfold law; infer_instance | |
| lemma coordinate_preserving (i : Index) : | |
| MeasurePreserving (fun ω : Noise ↦ ω i) law (gaussianReal 0 1) := | |
| measurePreserving_eval_infinitePi _ _ | |
| def tent (n : ℕ) (k : Fin (2 ^ n)) (t : ℝ) : ℝ := | |
| max 0 (1 - |(2 : ℝ) ^ (n + 1) * t - (2 * (k : ℝ) + 1)|) | |
| lemma tent_nonneg (n : ℕ) (k : Fin (2 ^ n)) (t : ℝ) : 0 ≤ tent n k t := | |
| le_max_left _ _ | |
| lemma tent_le_one (n : ℕ) (k : Fin (2 ^ n)) (t : ℝ) : tent n k t ≤ 1 := by | |
| unfold tent | |
| exact max_le (by norm_num) (by linarith [abs_nonneg ((2:ℝ)^(n+1)*t-(2*(k:ℝ)+1))]) | |
| lemma tent_positive_unique (n : ℕ) (k l : Fin (2 ^ n)) (t : ℝ) | |
| (hk : 0 < tent n k t) (hl : 0 < tent n l t) : k = l := by | |
| have hk' : |(2 : ℝ) ^ (n + 1) * t - (2 * (k : ℝ) + 1)| < 1 := by | |
| simpa only [tent, lt_max_iff, lt_self_iff_false, false_or, sub_pos] using hk | |
| have hl' : |(2 : ℝ) ^ (n + 1) * t - (2 * (l : ℝ) + 1)| < 1 := by | |
| simpa only [tent, lt_max_iff, lt_self_iff_false, false_or, sub_pos] using hl | |
| obtain ⟨hk1, hk2⟩ := abs_lt.mp hk' | |
| obtain ⟨hl1, hl2⟩ := abs_lt.mp hl' | |
| have hkl : (k : ℝ) < (l : ℝ) + 1 := by linarith | |
| have hlk : (l : ℝ) < (k : ℝ) + 1 := by linarith | |
| have hkl' : k.val < l.val + 1 := by exact_mod_cast hkl | |
| have hlk' : l.val < k.val + 1 := by exact_mod_cast hlk | |
| apply Fin.ext | |
| omega | |
| lemma sum_tent_le_one (n : ℕ) (t : ℝ) : ∑ k, tent n k t ≤ 1 := by | |
| classical | |
| by_cases h : ∃ k, 0 < tent n k t | |
| · obtain ⟨k, hk⟩ := h | |
| rw [Finset.sum_eq_single k] | |
| · exact tent_le_one n k t | |
| · intro l _ hl | |
| exact le_antisymm (le_of_not_gt fun hp ↦ hl (tent_positive_unique n l k t hp hk)) | |
| (tent_nonneg n l t) | |
| · simp | |
| · have hz : ∀ k, tent n k t = 0 := fun k ↦ | |
| le_antisymm (le_of_not_gt fun hk ↦ h ⟨k, hk⟩) (tent_nonneg n k t) | |
| simp [hz] | |
| def tentMap (n : ℕ) (k : Fin (2 ^ n)) : C(Time, ℝ) := | |
| ⟨fun t ↦ tent n k t, by unfold tent; fun_prop⟩ | |
| def amplitude (n : ℕ) : ℝ := (1/2 : ℝ) * (Real.sqrt 2)⁻¹ ^ n | |
| lemma amplitude_nonneg (n : ℕ) : 0 ≤ amplitude n := by unfold amplitude; positivity | |
| def level (n : ℕ) (ω : Noise) : C(Time, ℝ) := | |
| amplitude n • ∑ k : Fin (2 ^ n), ω (.inr ⟨n, k⟩) • tentMap n k | |
| lemma norm_level_le (n : ℕ) (ω : Noise) {M : ℝ} (hM : 0 ≤ M) | |
| (hω : ∀ k : Fin (2 ^ n), |ω (.inr ⟨n, k⟩)| ≤ M) : | |
| ‖level n ω‖ ≤ amplitude n * M := by | |
| apply (ContinuousMap.norm_le _ (mul_nonneg (amplitude_nonneg n) hM)).2 | |
| intro t | |
| simp only [level, ContinuousMap.smul_apply, ContinuousMap.sum_apply, | |
| smul_eq_mul, tentMap, ContinuousMap.coe_mk, Real.norm_eq_abs] | |
| rw [abs_mul, abs_of_nonneg (amplitude_nonneg n)] | |
| apply mul_le_mul_of_nonneg_left _ (amplitude_nonneg n) | |
| calc | |
| |∑ k, ω (.inr ⟨n, k⟩) * tent n k t| ≤ | |
| ∑ k, |ω (.inr ⟨n, k⟩) * tent n k t| := Finset.abs_sum_le_sum_abs _ _ | |
| _ = ∑ k, |ω (.inr ⟨n, k⟩)| * tent n k t := by | |
| simp_rw [abs_mul, abs_of_nonneg (tent_nonneg n _ t)] | |
| _ ≤ ∑ k, M * tent n k t := Finset.sum_le_sum fun k _ ↦ | |
| mul_le_mul_of_nonneg_right (hω k) (tent_nonneg n k t) | |
| _ = M * ∑ k, tent n k t := (Finset.mul_sum ..).symm | |
| _ ≤ M * 1 := mul_le_mul_of_nonneg_left (sum_tent_le_one n t) hM | |
| _ = M := mul_one _ | |
| def moment : ℝ≥0∞ := (eLpNorm (id : ℝ → ℝ) 4 (gaussianReal 0 1)) ^ 4 | |
| lemma moment_ne_top : moment ≠ ∞ := by | |
| exact ENNReal.pow_ne_top (memLp_id_gaussianReal' (μ := 0) (v := 1) 4 (by norm_num)).ne | |
| lemma coordinate_tail (i : Index) {a : ℝ} (ha : 0 < a) : | |
| law {ω | a ≤ |ω i|} ≤ (ENNReal.ofReal a)⁻¹ ^ (4 : ℕ) * moment := by | |
| have hm := (memLp_id_gaussianReal' (μ := 0) (v := 1) 4 (by norm_num)) | |
| have he : eLpNorm (fun ω : Noise ↦ ω i) 4 law = | |
| eLpNorm (id : ℝ → ℝ) 4 (gaussianReal 0 1) := | |
| by simpa only [Function.comp_def, id_eq] using | |
| (eLpNorm_comp_measurePreserving (p := 4) (g := (id : ℝ → ℝ)) | |
| hm.aestronglyMeasurable (coordinate_preserving i)) | |
| have ht := meas_ge_le_mul_pow_eLpNorm_enorm law (p := 4) (by norm_num) (by norm_num) | |
| (f := fun ω : Noise ↦ ω i) | |
| (ε := ENNReal.ofReal a) (ne_of_gt (ENNReal.ofReal_pos.mpr ha)) (by simp) | |
| have hs : {ω : Noise | ENNReal.ofReal a ≤ ‖ω i‖ₑ} = {ω | a ≤ |ω i|} := by | |
| ext ω | |
| simp only [Set.mem_ofPred_eq, ← ofReal_norm, Real.norm_eq_abs] | |
| exact ENNReal.ofReal_le_ofReal_iff (abs_nonneg _) | |
| simpa only [Function.comp_def, id_eq, ENNReal.toReal_ofNat, ← ENNReal.rpow_natCast, | |
| Nat.cast_ofNat, he, hs, moment] using ht | |
| def badLevel (n : ℕ) : Set Noise := | |
| {ω | ∃ k : Fin (2 ^ n), (4/3 : ℝ) ^ n ≤ |ω (.inr ⟨n, k⟩)|} | |
| lemma badLevel_bound (n : ℕ) : | |
| law (badLevel n) ≤ (ENNReal.ofReal (81/128 : ℝ)) ^ n * moment := by | |
| have hu : badLevel n = ⋃ k : Fin (2 ^ n), {ω | (4/3 : ℝ)^n ≤ |ω (.inr ⟨n, k⟩)|} := by | |
| ext ω; simp [badLevel] | |
| rw [hu] | |
| refine (measure_iUnion_fintype_le _ _).trans ?_ | |
| calc | |
| _ ≤ ∑ _k : Fin (2 ^ n), (ENNReal.ofReal ((4/3 : ℝ)^n))⁻¹ ^ (4 : ℕ) * moment := | |
| Finset.sum_le_sum fun k _ ↦ coordinate_tail _ (by positivity) | |
| _ = (ENNReal.ofReal (81/128 : ℝ))^n * moment := by | |
| simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, | |
| Nat.cast_pow, Nat.cast_ofNat, ENNReal.ofReal_pow (by norm_num : (0:ℝ) ≤ 4/3), | |
| ENNReal.ofReal_div_of_pos (by norm_num : (0:ℝ) < 3), ENNReal.ofReal_ofNat, | |
| ← mul_assoc] | |
| rw [ENNReal.inv_pow, ← pow_mul, Nat.mul_comm n 4, pow_mul, ← mul_pow] | |
| have hq : (2 : ℝ≥0∞) * (4/3)⁻¹ ^ (4 : ℕ) = ENNReal.ofReal (81/128 : ℝ) := by | |
| have hreal : (2 : ℝ) * (4/3)⁻¹ ^ (4 : ℕ) = 81/128 := by norm_num | |
| rw [← hreal, ENNReal.ofReal_mul (by norm_num : (0:ℝ) ≤ 2), | |
| ENNReal.ofReal_pow (by positivity), ENNReal.ofReal_inv_of_pos (by norm_num), | |
| ENNReal.ofReal_div_of_pos (by norm_num)] | |
| norm_num | |
| rw [hq] | |
| lemma ae_eventually_coordinates_small : ∀ᵐ ω ∂law, ∀ᶠ n in atTop, | |
| ∀ k : Fin (2 ^ n), |ω (.inr ⟨n, k⟩)| < (4/3 : ℝ)^n := by | |
| have hs : (∑' n, law (badLevel n)) ≠ ∞ := by | |
| apply ne_top_of_le_ne_top _ (ENNReal.tsum_le_tsum badLevel_bound) | |
| rw [ENNReal.tsum_mul_right, ENNReal.tsum_geometric] | |
| apply ENNReal.mul_ne_top _ moment_ne_top | |
| simpa only [ENNReal.inv_ne_top] using | |
| (ne_of_gt (tsub_pos_of_lt (by rw [ENNReal.ofReal_lt_one]; norm_num : (ENNReal.ofReal (81/128 : ℝ)) < 1))) | |
| filter_upwards [ae_eventually_notMem hs] with ω hω | |
| filter_upwards [hω] with n hn | |
| simpa only [badLevel, Set.mem_ofPred_eq, not_exists, not_le] using hn | |
| lemma decay_lt_one : (4/3 : ℝ) / Real.sqrt 2 < 1 := by | |
| have hp : 0 < Real.sqrt 2 := Real.sqrt_pos.2 (by norm_num) | |
| rw [div_lt_one hp] | |
| nlinarith [Real.sq_sqrt (by norm_num : (0:ℝ) ≤ 2)] | |
| lemma summable_level_bound : Summable (fun n : ℕ ↦ amplitude n * (4/3 : ℝ)^n) := by | |
| have h := (summable_geometric_of_lt_one (by positivity : 0 ≤ (4/3 : ℝ) / Real.sqrt 2) | |
| decay_lt_one).mul_left (1/2 : ℝ) | |
| have heq : (fun n : ℕ ↦ amplitude n * (4/3 : ℝ)^n) = | |
| (fun n : ℕ ↦ (1/2 : ℝ) * ((4/3 : ℝ) / Real.sqrt 2)^n) := by | |
| funext n | |
| simp only [amplitude, div_eq_mul_inv, mul_pow] | |
| ring | |
| rw [heq] | |
| exact h | |
| lemma ae_summable_level : ∀ᵐ ω ∂law, Summable (fun n ↦ level n ω) := by | |
| filter_upwards [ae_eventually_coordinates_small] with ω hω | |
| apply summable_level_bound.of_norm_bounded_eventually_nat | |
| filter_upwards [hω] with n hn | |
| exact norm_level_le n ω (by positivity) (fun k ↦ (hn k).le) | |
| def path (ω : Noise) : C(Time, ℝ) := | |
| ω (.inl ()) • ⟨fun t ↦ t.val, continuous_subtype_val⟩ + ∑' n, level n ω | |
| lemma continuous_level (n : ℕ) : Continuous (level n) := by | |
| unfold level | |
| fun_prop | |
| lemma measurable_path : Measurable path := by | |
| unfold path | |
| apply Measurable.add | |
| · exact (by fun_prop : Continuous (fun ω : Noise ↦ | |
| ω (.inl ()) • (⟨fun t : Time ↦ t.val, continuous_subtype_val⟩ : C(Time, ℝ)))).measurable | |
| · exact Measurable.tsum fun n ↦ (continuous_level n).measurable | |
| def wiener : Measure C(Time, ℝ) := law.map path | |
| instance : IsProbabilityMeasure wiener := by unfold wiener; infer_instance | |
| lemma path_continuous (ω : Noise) : Continuous (fun t : Time ↦ path ω t) := (path ω).continuous | |
| lemma tent_at_zero (n : ℕ) (k : Fin (2 ^ n)) : tent n k 0 = 0 := by | |
| simp only [tent, mul_zero, zero_sub, abs_neg] | |
| rw [abs_of_nonneg (by positivity : (0:ℝ) ≤ 2 * (k:ℝ) + 1)] | |
| apply max_eq_left | |
| norm_num | |
| lemma tent_at_one (n : ℕ) (k : Fin (2 ^ n)) : tent n k 1 = 0 := by | |
| have hk : (k : ℝ) + 1 ≤ (2:ℝ)^n := by exact_mod_cast k.isLt | |
| simp only [tent, mul_one, pow_succ] | |
| rw [abs_of_nonneg (by linarith : (0:ℝ) ≤ (2:ℝ)^n*2-(2*(k:ℝ)+1))] | |
| exact max_eq_left (by linarith) | |
| lemma level_at_zero (n : ℕ) (ω : Noise) : level n ω 0 = 0 := by | |
| simp [level, tentMap, tent_at_zero] | |
| lemma level_at_one (n : ℕ) (ω : Noise) : level n ω 1 = 0 := by | |
| simp [level, tentMap, tent_at_one] | |
| lemma path_at_zero (ω : Noise) : path ω 0 = 0 := by | |
| by_cases h : Summable (fun n ↦ level n ω) | |
| · simp only [path, ContinuousMap.add_apply, ContinuousMap.smul_apply, ContinuousMap.coe_mk, | |
| smul_eq_mul] | |
| change ω (.inl ()) * 0 + _ = 0 | |
| rw [← ContinuousMap.tsum_apply h] | |
| simp [level_at_zero] | |
| · simp [path, tsum_eq_zero_of_not_summable h] | |
| lemma path_at_one (ω : Noise) : path ω 1 = ω (.inl ()) := by | |
| by_cases h : Summable (fun n ↦ level n ω) | |
| · simp only [path, ContinuousMap.add_apply, ContinuousMap.smul_apply, ContinuousMap.coe_mk, | |
| smul_eq_mul] | |
| change ω (.inl ()) * 1 + _ = _ | |
| rw [← ContinuousMap.tsum_apply h] | |
| simp [level_at_one] | |
| · simp [path, tsum_eq_zero_of_not_summable h] | |
| open Complex in | |
| lemma hasLaw_gaussian_of_ae_tendsto {Ω : Type*} [MeasurableSpace Ω] | |
| {P : Measure Ω} [IsProbabilityMeasure P] {X : ℕ → Ω → ℝ} {Y : Ω → ℝ} | |
| {m : ℕ → ℝ} {v : ℕ → ℝ≥0} {m₀ : ℝ} {v₀ : ℝ≥0} | |
| (hX : ∀ n, HasLaw (X n) (gaussianReal (m n) (v n)) P) | |
| (hY : ∀ᵐ ω ∂P, Tendsto (fun n ↦ X n ω) atTop (𝓝 (Y ω))) | |
| (hm : Tendsto m atTop (𝓝 m₀)) (hv : Tendsto v atTop (𝓝 v₀)) : | |
| HasLaw Y (gaussianReal m₀ v₀) P := by | |
| have hmY := aemeasurable_of_tendsto_metrizable_ae atTop (fun n ↦ (hX n).aemeasurable) hY | |
| refine ⟨hmY, Measure.ext_of_charFun (funext fun t ↦ ?_)⟩ | |
| have : IsProbabilityMeasure (P.map Y) := inferInstance | |
| have hlim : Tendsto (fun n ↦ charFun (P.map (X n)) t) atTop | |
| (𝓝 (charFun (P.map Y) t)) := by | |
| have he (Z : Ω → ℝ) (hZ : AEMeasurable Z P) : | |
| charFun (P.map Z) t = ∫ ω, exp ((t * Z ω : ℝ) * I) ∂P := by | |
| rw [charFun_apply_real, integral_map hZ (by fun_prop)] | |
| simp only [ofReal_mul] | |
| simp_rw [he _ (hX _).aemeasurable, he _ hmY] | |
| apply tendsto_integral_of_dominated_convergence (fun _ ↦ (1 : ℝ)) | |
| · intro n | |
| exact ((by fun_prop : Continuous (fun x : ℝ ↦ exp ((t * x : ℝ) * I))).measurable.comp_aemeasurable | |
| (hX n).aemeasurable).aestronglyMeasurable | |
| · exact integrable_const 1 | |
| · intro n | |
| exact ae_of_all P fun ω ↦ le_of_eq (norm_exp_ofReal_mul_I _) | |
| · filter_upwards [hY] with ω hω | |
| exact continuous_exp.continuousAt.tendsto.comp | |
| ((continuous_ofReal.tendsto _ |>.comp (tendsto_const_nhds.mul hω)).mul_const I) | |
| have hlim' : Tendsto (fun n ↦ charFun (P.map (X n)) t) atTop | |
| (𝓝 (charFun (gaussianReal m₀ v₀) t)) := by | |
| simp_rw [(hX _).map_eq, charFun_gaussianReal] | |
| exact continuous_exp.continuousAt.tendsto.comp | |
| (((tendsto_const_nhds.mul (continuous_ofReal.tendsto _ |>.comp hm)).mul_const I).sub | |
| (((continuous_ofReal.tendsto _ |>.comp (NNReal.continuous_coe.tendsto _ |>.comp hv)).mul_const | |
| ((t : ℂ)^2)).div_const 2)) | |
| exact tendsto_nhds_unique hlim hlim' | |
| lemma hasLaw_centered_gaussian_sum {ι Ω : Type*} [Fintype ι] [MeasurableSpace Ω] | |
| {P : Measure Ω} [IsProbabilityMeasure P] {X : ι → Ω → ℝ} {v : ι → ℝ≥0} | |
| (hX : ∀ i, HasLaw (X i) (gaussianReal 0 (v i)) P) (hind : iIndepFun X P) : | |
| HasLaw (fun ω ↦ ∑ i, X i ω) (gaussianReal 0 (∑ i, v i)) P := by | |
| classical | |
| have hg := hind.hasGaussianLaw_fun_sum (fun i ↦ (hX i).hasGaussianLaw) | |
| have hmean : ∫ ω, ∑ i, X i ω ∂P = 0 := by | |
| rw [integral_finsetSum _ (fun i _ ↦ (hX i).hasGaussianLaw.integrable)] | |
| simp only [(hX _).integral_eq, integral_id_gaussianReal, Finset.sum_const_zero] | |
| have hvar : Var[fun ω ↦ ∑ i, X i ω; P] = ∑ i, (v i : ℝ) := by | |
| have hh := IndepFun.variance_sum (s := Finset.univ) | |
| (fun i _ ↦ (hX i).hasGaussianLaw.memLp_two) | |
| (fun i _ j _ hij ↦ hind.indepFun hij) | |
| have he : (fun ω ↦ ∑ i, X i ω) = ∑ i, X i := by funext ω; simp | |
| rw [he] | |
| simpa only [(hX _).variance_eq, variance_id_gaussianReal] using hh | |
| refine ⟨hg.aemeasurable, ?_⟩ | |
| rw [hg.map_eq_gaussianReal, hmean, hvar] | |
| simp only [← NNReal.coe_sum, Real.toNNReal_coe] | |
| def leftIndex (n : ℕ) (k : Fin (2^n)) : Fin (2^(n+1)) := | |
| ⟨k.val, by have := k.isLt; simp only [pow_succ]; omega⟩ | |
| def rightIndex (n : ℕ) (k : Fin (2^n)) : Fin (2^(n+1)) := | |
| ⟨2^n + k.val, by have := k.isLt; simp only [pow_succ]; omega⟩ | |
| lemma sum_split_level (n : ℕ) (f : Fin (2^(n+1)) → ℝ) : | |
| ∑ k, f k = ∑ k, f (leftIndex n k) + ∑ k, f (rightIndex n k) := by | |
| let e : Fin (2^n + 2^n) ≃ Fin (2^(n+1)) := | |
| finCongr (by simp [pow_succ, Nat.mul_two]) | |
| rw [← Equiv.sum_comp e, Fin.sum_univ_add] | |
| rfl | |
| lemma tent_left (n : ℕ) (k : Fin (2^n)) (s : ℝ) : | |
| tent (n+1) (leftIndex n k) s = tent n k (2*s) := by | |
| unfold tent leftIndex | |
| congr 3 | |
| simp only [pow_succ] | |
| ring | |
| lemma tent_right (n : ℕ) (k : Fin (2^n)) (s : ℝ) : | |
| tent (n+1) (rightIndex n k) s = tent n k (2*s-1) := by | |
| unfold tent rightIndex | |
| congr 3 | |
| simp only [pow_succ, Nat.cast_add, Nat.cast_pow, Nat.cast_ofNat] | |
| ring | |
| lemma tent_nonpos (n : ℕ) (k : Fin (2^n)) {s : ℝ} (hs : s ≤ 0) : tent n k s = 0 := by | |
| unfold tent | |
| apply max_eq_left | |
| have hpow : 0 ≤ (2:ℝ)^(n+1) := by positivity | |
| have hx : (2:ℝ)^(n+1)*s ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hpow hs | |
| rw [abs_of_nonpos (by linarith [show (0:ℝ) ≤ k by positivity])] | |
| linarith [show (0:ℝ) ≤ k by positivity] | |
| lemma tent_ge_one (n : ℕ) (k : Fin (2^n)) {s : ℝ} (hs : 1 ≤ s) : tent n k s = 0 := by | |
| have hk : (k : ℝ) + 1 ≤ (2:ℝ)^n := by exact_mod_cast k.isLt | |
| have hp : 0 < (2:ℝ)^n := by positivity | |
| have hx : (2:ℝ)^n*2 ≤ (2:ℝ)^n*2*s := le_mul_of_one_le_right (by positivity) hs | |
| unfold tent | |
| simp only [pow_succ] | |
| rw [abs_of_nonneg (by linarith : (0:ℝ) ≤ (2:ℝ)^n*2*s-(2*(k:ℝ)+1))] | |
| exact max_eq_left (by linarith) | |
| def hatKernel (n : ℕ) (s t : ℝ) : ℝ := ∑ k : Fin (2^n), tent n k s * tent n k t | |
| def weight (n : ℕ) : ℝ := (1/4 : ℝ)*(1/2 : ℝ)^n | |
| def partialBridge (n : ℕ) (s t : ℝ) : ℝ := | |
| ∑ m ∈ Finset.range n, weight m * hatKernel m s t | |
| lemma hatKernel_rec (n : ℕ) (s t : ℝ) : | |
| hatKernel (n+1) s t = hatKernel n (2*s) (2*t) + hatKernel n (2*s-1) (2*t-1) := by | |
| unfold hatKernel | |
| rw [sum_split_level] | |
| simp only [tent_left, tent_right] | |
| lemma partialBridge_zero_left (n : ℕ) {s : ℝ} (hs : s ≤ 0 ∨ 1 ≤ s) (t : ℝ) : | |
| partialBridge n s t = 0 := by | |
| rcases hs with hs | hs <;> simp [partialBridge, hatKernel, tent_nonpos, tent_ge_one, hs] | |
| lemma partialBridge_zero_right (n : ℕ) (s : ℝ) {t : ℝ} (ht : t ≤ 0 ∨ 1 ≤ t) : | |
| partialBridge n s t = 0 := by | |
| rcases ht with ht | ht <;> simp [partialBridge, hatKernel, tent_nonpos, tent_ge_one, ht] | |
| lemma partialBridge_rec (n : ℕ) (s t : ℝ) : | |
| partialBridge (n+1) s t = (1/4 : ℝ) * tent 0 0 s * tent 0 0 t + | |
| (1/2 : ℝ)*(partialBridge n (2*s) (2*t) + partialBridge n (2*s-1) (2*t-1)) := by | |
| have h0 : hatKernel 0 s t = tent 0 0 s * tent 0 0 t := by | |
| simp [hatKernel] | |
| have hx : ∑ m ∈ Finset.range n, weight (m+1)*hatKernel (m+1) s t = | |
| (1/2 : ℝ)*(partialBridge n (2*s) (2*t) + partialBridge n (2*s-1) (2*t-1)) := by | |
| simp only [partialBridge, mul_add, Finset.mul_sum, ← Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro m _ | |
| rw [hatKernel_rec] | |
| simp only [weight, pow_succ] | |
| ring | |
| change (∑ m ∈ Finset.range (n+1), weight m * hatKernel m s t) = _ | |
| rw [Finset.sum_range_succ', hx, h0] | |
| simp only [weight, pow_zero, mul_one] | |
| ring | |
| lemma tent_zero_left {s : ℝ} (h0 : 0 ≤ s) (h1 : s ≤ 1/2) : tent 0 0 s = 2*s := by | |
| simp only [tent, pow_one, Fin.val_zero, Nat.cast_zero, mul_zero, zero_add] | |
| rw [abs_of_nonpos (by linarith), max_eq_right (by linarith)] | |
| ring | |
| lemma tent_zero_right {s : ℝ} (h0 : 1/2 ≤ s) (h1 : s ≤ 1) : tent 0 0 s = 2*(1-s) := by | |
| simp only [tent, pow_one, Fin.val_zero, Nat.cast_zero, mul_zero, zero_add] | |
| rw [abs_of_nonneg (by linarith), max_eq_right (by linarith)] | |
| ring | |
| lemma weight_step (n : ℕ) : weight (n+1) = (1/2 : ℝ)*weight n := by | |
| simp only [weight, pow_succ] | |
| ring | |
| lemma abs_half_mul (x : ℝ) : |(1/2 : ℝ)*x| = (1/2 : ℝ)*|x| := by | |
| rw [abs_mul] | |
| norm_num | |
| lemma partialBridge_error_ordered (n : ℕ) {s t : ℝ} | |
| (hs : 0 ≤ s) (ht : t ≤ 1) (hst : s ≤ t) : | |
| |partialBridge n s t - (s-s*t)| ≤ weight n := by | |
| induction n generalizing s t with | |
| | zero => | |
| have hnn : 0 ≤ s-s*t := by nlinarith | |
| have hb : s-s*t ≤ (1/4 : ℝ) := by nlinarith [sq_nonneg (s-1/2)] | |
| simp only [partialBridge, Finset.range_zero, Finset.sum_empty, zero_sub, | |
| abs_neg, abs_of_nonneg hnn, weight, pow_zero, mul_one] | |
| exact hb | |
| | succ n ih => | |
| rw [partialBridge_rec, weight_step] | |
| by_cases ht2 : t ≤ 1/2 | |
| · have hs2 : s ≤ 1/2 := hst.trans ht2 | |
| rw [tent_zero_left hs hs2, tent_zero_left (hs.trans hst) ht2, | |
| partialBridge_zero_left n (Or.inl (by linarith : 2*s-1 ≤ 0)), add_zero] | |
| have hh := ih (s := 2*s) (t := 2*t) (by linarith) (by linarith) (by linarith) | |
| calc | |
| _ = (1/2 : ℝ)*|partialBridge n (2*s) (2*t) - (2*s-(2*s)*(2*t))| := by | |
| rw [← abs_half_mul] | |
| congr 1 | |
| ring | |
| _ ≤ _ := mul_le_mul_of_nonneg_left hh (by norm_num) | |
| · by_cases hs2 : 1/2 ≤ s | |
| · rw [tent_zero_right hs2 (hst.trans ht), tent_zero_right (hs2.trans hst) ht, | |
| partialBridge_zero_left n (Or.inr (by linarith : 1 ≤ 2*s)), zero_add] | |
| have hh := ih (s := 2*s-1) (t := 2*t-1) (by linarith) (by linarith) (by linarith) | |
| calc | |
| _ = (1/2 : ℝ)*|partialBridge n (2*s-1) (2*t-1) - ((2*s-1)-(2*s-1)*(2*t-1))| := by | |
| rw [← abs_half_mul] | |
| congr 1 | |
| ring | |
| _ ≤ _ := mul_le_mul_of_nonneg_left hh (by norm_num) | |
| · rw [tent_zero_left hs (by linarith), tent_zero_right (by linarith) ht, | |
| partialBridge_zero_right n _ (Or.inr (by linarith : 1 ≤ 2*t)), | |
| partialBridge_zero_left n (Or.inl (by linarith : 2*s-1 ≤ 0))] | |
| have he : (1/4 : ℝ)*(2*s)*(2*(1-t)) + (1/2)*(0+0) - (s-s*t) = 0 := by ring | |
| rw [he, abs_zero] | |
| unfold weight | |
| positivity | |
| end HardSphere.Wiener | |
| end | |
| end | |
| end | |
| end | |
| end | |
| end OAI | |
Xet Storage Details
- Size:
- 20 kB
- Xet hash:
- 728d33f2216d38d6ed106cbc2617ad49c008ea963e47b34cfe8f1aefc21c25d0
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.