Download lean/OAI/Probability/SKGap/Stability/PlantedFieldArray.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 22.4 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Probability/SKGap/Stability/PlantedFieldArray.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Probability/SKGap/Stability/PlantedFieldArray.lean
-
curl -L -o PlantedFieldArray.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Probability/SKGap/Stability/PlantedFieldArray.lean
22.4 kB
| import Mathlib | |
| import OAI.Probability.SKGap.Entropy.ProdFst | |
| import OAI.Probability.SKGap.Entropy.BoundGood | |
| import OAI.Probability.SKGap.Terminal.GibbsEventProbabilityReal | |
| namespace OAI | |
| section | |
| open scoped BigOperators | |
| open scoped BigOperators | |
| open scoped BigOperators | |
| open scoped BigOperators | |
| open scoped BigOperators | |
| open scoped BigOperators NNReal | |
| open MeasureTheory ProbabilityTheory | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators NNReal ENNReal | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators Matrix Matrix.Norms.Elementwise | |
| open scoped BigOperators | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators Matrix Matrix.Norms.Elementwise | |
| open scoped BigOperators | |
| open scoped BigOperators NNReal ENNReal | |
| open MeasureTheory Metric Set | |
| open scoped BigOperators NNReal ENNReal | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped BigOperators Matrix.Norms.L2Operator | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open scoped BigOperators Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Set | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators ENNReal NNReal | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal Matrix | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators ENNReal NNReal | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal | |
| open scoped BigOperators | |
| open MeasureTheory ProbabilityTheory | |
| open scoped BigOperators Matrix Matrix.Norms.Elementwise NNReal ENNReal | |
| open scoped BigOperators | |
| open Filter Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal NNReal Topology BigOperators | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal NNReal Topology BigOperators | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal NNReal Topology BigOperators | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped ENNReal NNReal Topology BigOperators | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Set Matrix | |
| open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped NNReal ENNReal BigOperators Topology Matrix Matrix.Norms.Elementwise | |
| open Filter MeasureTheory ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open Filter MeasureTheory ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter | |
| open scoped Topology | |
| open MeasureTheory Filter ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter ProbabilityTheory ContinuousLinearMap | |
| open scoped Topology NNReal ENNReal | |
| open Filter MeasureTheory ProbabilityTheory | |
| open scoped Topology NNReal ENNReal | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology | |
| open Filter Set Metric | |
| open scoped Topology RealInnerProductSpace | |
| open scoped BigOperators | |
| open ContinuousLinearMap | |
| open scoped BigOperators | |
| open ContinuousLinearMap | |
| open scoped Topology Interval | |
| open MeasureTheory | |
| open MeasureTheory | |
| open scoped BigOperators Topology Interval | |
| open MeasureTheory | |
| open scoped BigOperators Topology Interval | |
| open scoped Topology | |
| open MeasureTheory | |
| open scoped BigOperators Topology Interval | |
| open scoped BigOperators Topology | |
| open MeasureTheory | |
| open scoped BigOperators Topology Interval RealInnerProductSpace | |
| open MeasureTheory Filter | |
| open scoped BigOperators Topology Interval | |
| open MeasureTheory Filter | |
| open scoped Topology | |
| open MeasureTheory Filter | |
| open scoped Topology | |
| open MeasureTheory Filter | |
| open scoped Topology | |
| open MeasureTheory ProbabilityTheory Filter | |
| open scoped BigOperators NNReal ENNReal Matrix.Norms.L2Operator | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped BigOperators ENNReal NNReal Topology Matrix.Norms.L2Operator | |
| namespace SKGapCutoff.Regression | |
| noncomputable def plantedFieldArray (β : ℝ) (n : ℕ) (g : Option (Fin n) → ℝ) : Fin n → ℝ := | |
| sharedGaussianField (β^2*((n:ℝ)-1)/(n:ℝ)) | |
| (β*Real.sqrt (((n:ℝ)-2)/(n:ℝ))) (β/Real.sqrt (n:ℝ)) g | |
| lemma plantedFieldArray_measurable (β : ℝ) (n : ℕ) : Measurable (plantedFieldArray β n) := by | |
| unfold plantedFieldArray sharedGaussianField | |
| fun_prop | |
| lemma planted_field_event_eq (β : ℝ) {n : ℕ} (hn : 2≤n) (x : Spin n) | |
| (E : Set (Fin n → ℝ)) (hE : MeasurableSet E) : | |
| singleSpinPlantedLaw β x ((gaugedField x) ⁻¹' E) = | |
| standardArrayLaw (Option (Fin n)) ((plantedFieldArray β n) ⁻¹' E) := by | |
| have hh := congrArg (fun μ : Measure (Fin n → ℝ) => μ E) (planted_field_representation β hn x) | |
| change (singleSpinPlantedLaw β x).map (gaugedField x) E = | |
| (standardArrayLaw (Option (Fin n))).map (plantedFieldArray β n) E at hh | |
| rw [Measure.map_apply (continuous_gaugedField x).measurable hE, | |
| Measure.map_apply (plantedFieldArray_measurable β n) hE] at hh | |
| exact hh | |
| lemma plantedField_common_convergence (β : ℝ) (hβ : 0<β) : | |
| ExponentialConvergence (fun n => standardArrayLaw (Option (Fin n))) | |
| (fun n g => (β/Real.sqrt (n:ℝ))*g none) 0 := by | |
| intro ε hε | |
| refine ⟨2,ε^2/(2*β^2),by norm_num,by positivity,?_⟩ | |
| filter_upwards [eventually_gt_atTop 0] with n hn | |
| have hnR : (0:ℝ)<n := Nat.cast_pos.mpr hn | |
| have ht := subgaussian_abs_tail | |
| (gaussian_hasSubgaussianMGF (coordinate_hasLaw (none : Option (Fin n)))) | |
| (ε*Real.sqrt (n:ℝ)/β) (by positivity) | |
| simp only [Real.dist_eq,sub_zero] | |
| apply (measure_mono (show {g : Option (Fin n) → ℝ | ε ≤ |β/Real.sqrt (n:ℝ)*g none|} ⊆ | |
| {g | ε*Real.sqrt (n:ℝ)/β ≤ |g none|} from ?_)).trans | |
| · apply ht.trans_eq | |
| rw [ENNReal.ofReal_mul (by norm_num : (0:ℝ)≤2)] | |
| norm_num only [ENNReal.ofReal_ofNat,NNReal.coe_one,mul_one] | |
| congr 2 | |
| rw [div_pow,mul_pow,Real.sq_sqrt hnR.le] | |
| ring_nf | |
| · intro g hg | |
| change ε ≤ |β/Real.sqrt (n:ℝ)*g none| at hg | |
| rw [abs_mul,abs_of_pos (by positivity : 0<β/Real.sqrt (n:ℝ))] at hg | |
| apply (div_le_iff₀ hβ).mpr | |
| have hh := (le_div_iff₀ (Real.sqrt_pos.mpr hnR)).mp | |
| (show ε ≤ β*|g none|/Real.sqrt (n:ℝ) by simpa only [div_mul_eq_mul_div] using hg) | |
| nlinarith | |
| lemma plantedField_mean_bound (β : ℝ) (n : ℕ) : | |
| |β^2*((n:ℝ)-1)/(n:ℝ)| ≤ β^2 := by | |
| by_cases hn : n=0 | |
| · simp [hn, sq_nonneg] | |
| have hn1 : (1:ℝ)≤n := by exact_mod_cast (Nat.one_le_iff_ne_zero.mpr hn) | |
| rw [abs_of_nonneg (by positivity)] | |
| apply (div_le_iff₀ (by positivity : (0:ℝ)<n)).mpr | |
| nlinarith [sq_nonneg β] | |
| lemma plantedField_scale_bound (β : ℝ) (n : ℕ) : | |
| |β*Real.sqrt (((n:ℝ)-2)/(n:ℝ))| ≤ |β| := by | |
| have hs : Real.sqrt (((n:ℝ)-2)/(n:ℝ)) ≤ 1 := by | |
| apply Real.sqrt_le_one.mpr | |
| by_cases hn : n=0 | |
| · simp [hn] | |
| · apply (div_le_iff₀ (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn))).mpr | |
| linarith | |
| rw [abs_mul,abs_of_nonneg (Real.sqrt_nonneg _)] | |
| nlinarith [abs_nonneg β] | |
| lemma plantedFieldArray_squareTails (β : ℝ) (hβ : 0<β) : | |
| ExponentialSquareTails (fun n => standardArrayLaw (Option (Fin n))) | |
| (plantedFieldArray β) := by | |
| let ρ := fun n => standardArrayLaw (Option (Fin n)) | |
| have hi : ExponentialSquareTails ρ (fun _ g i => g (some i)) := by | |
| exact iid_exponential_squareTails ρ _ (fun _ _ => measurable_pi_apply _) | |
| (fun _ => coordinates_independent.precomp (Option.some_injective _)) | |
| (gaussianReal 0 1) (fun _ _ => coordinate_hasLaw _) gaussian_integrable_exp_quarter_sq | |
| have ha := hi.bounded_mul | |
| (fun n _ _ => β*Real.sqrt (((n:ℝ)-2)/(n:ℝ))) |β| (abs_nonneg β) | |
| (fun n _ _ => plantedField_scale_bound β n) | |
| have hm := exponentialSquareTails_of_bounded ρ | |
| (fun n _ _ => β^2*((n:ℝ)-1)/(n:ℝ)) (β^2) (fun n _ _ => plantedField_mean_bound β n) | |
| have hb := hm.add ha | |
| apply hb.l2_stability | |
| have hz := (plantedField_common_convergence β hβ).continuous_map | |
| (f := fun x : ℝ => x^2) (by fun_prop) | |
| simp only [zero_pow (by norm_num : (2:ℕ)≠0)] at hz | |
| intro ε hε | |
| apply (hz ε hε).mono | |
| filter_upwards [eventually_gt_atTop 0] with n hn | |
| intro g hg | |
| have he : (∑ i : Fin n, | |
| (β^2*((n:ℝ)-1)/(n:ℝ)+β*Real.sqrt (((n:ℝ)-2)/(n:ℝ))*g (some i) - | |
| plantedFieldArray β n g i)^2)/(n:ℝ) = ((β/Real.sqrt (n:ℝ))*g none)^2 := by | |
| simp only [plantedFieldArray,sharedGaussianField,sub_add_cancel_left, | |
| neg_sq,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul] | |
| field_simp | |
| change ε ≤ dist _ 0 at hg ⊢ | |
| rwa [he] at hg | |
| noncomputable def plantedFieldLimitLaw (β : ℝ) : Measure ℝ := | |
| (gaussianReal 0 1).map (fun z => β^2+β*z) | |
| instance plantedFieldLimitLaw_probability (β : ℝ) : IsProbabilityMeasure (plantedFieldLimitLaw β) := by | |
| unfold plantedFieldLimitLaw | |
| infer_instance | |
| lemma plantedFieldArray_empirical (β : ℝ) (hβ : 0<β) : | |
| ExponentialEmpiricalConcentration (fun n => standardArrayLaw (Option (Fin n))) | |
| (plantedFieldArray β) (plantedFieldLimitLaw β) := by | |
| intro f K hf B hB ε hε | |
| have hf' : LipschitzWith (K+1) f := hf.weaken (by simp) | |
| obtain ⟨c,hc,ht⟩ := planted_field_average_exponential β hβ f (by positivity) hf' | |
| (|B|+1) (by positivity) (fun z => (hB z).trans (by linarith [le_abs_self B])) ε hε | |
| refine ⟨1,c,by norm_num,hc,?_⟩ | |
| filter_upwards [ht,eventually_ge_atTop 2] with n hn hn2 | |
| have hm : (∫ z, f z ∂plantedFieldLimitLaw β) = ∫ z, f (β^2+β*z) ∂gaussianReal 0 1 := by | |
| exact integral_map (by fun_prop) hf.continuous.aestronglyMeasurable | |
| rw [hm] | |
| have hh := hn (fun _ => false) | |
| have hE : MeasurableSet {v : Fin n → ℝ | ε ≤ |(∑ i, f (v i))/(n:ℝ) - | |
| ∫ z, f (β^2+β*z) ∂gaussianReal 0 1|} := by | |
| apply measurableSet_le measurable_const | |
| exact (((Finset.measurable_sum _ (fun i _ => hf.continuous.measurable.comp | |
| (measurable_pi_apply i))).div_const _).sub_const _).abs | |
| rw [show singleSpinPlantedLaw β (fun _ : Fin n => false) {g | ε ≤ | |
| |(∑ i, f (gaugedField (fun _ => false) g i))/(n:ℝ) - | |
| ∫ z, f (β^2+β*z) ∂gaussianReal 0 1|} = _ from | |
| planted_field_event_eq β hn2 (fun _ => false) _ hE] at hh | |
| simpa only [one_mul,Set.preimage_ofPred_eq] using hh | |
| lemma plantedFieldLimitLaw_secondMoment (β : ℝ) : | |
| Integrable (fun z : ℝ => z^2) (plantedFieldLimitLaw β) ∧ | |
| (∫ z, z^2 ∂plantedFieldLimitLaw β)=β^2+β^4 := by | |
| have hl : HasLaw (fun z : ℝ => β^2+β*z) (plantedFieldLimitLaw β) (gaussianReal 0 1) := | |
| ⟨by fun_prop,rfl⟩ | |
| have hi2 : MemLp (id : ℝ → ℝ) 2 (plantedFieldLimitLaw β) := by | |
| apply (memLp_map_measure_iff (by fun_prop) (by fun_prop)).mpr | |
| exact (memLp_const (β^2)).add | |
| (((IsGaussian.hasGaussianLaw_id (μ := gaussianReal 0 1)).memLp_two).const_mul β) | |
| have hi := hi2.integrable_sq | |
| refine ⟨hi,?_⟩ | |
| have hmean : (∫ z, z ∂plantedFieldLimitLaw β)=β^2 := by | |
| rw [← hl.integral_eq] | |
| have hm : Integrable (fun z : ℝ => β*z) (gaussianReal 0 1) := | |
| (IsGaussian.hasGaussianLaw_id (μ := gaussianReal 0 1)).integrable.const_mul β | |
| rw [integral_add (integrable_const _) hm,integral_const,integral_const_mul] | |
| simp [integral_id_gaussianReal] | |
| have hv : Var[id; plantedFieldLimitLaw β]=β^2 := by | |
| rw [← hl.variance_eq,variance_const_add (by fun_prop),variance_const_mul] | |
| simp | |
| have hh := variance_eq_sub (X := id) hi2 | |
| simp only [Pi.pow_apply,id_eq,hmean] at hh | |
| rw [hv] at hh | |
| nlinarith | |
| lemma plantedFieldArray_secondMoment (β : ℝ) (hβ : 0<β) : | |
| ExponentialConvergence (fun n => standardArrayLaw (Option (Fin n))) | |
| (fun n g => (∑ i, plantedFieldArray β n g i^2)/(n:ℝ)) (β^2+β^4) := by | |
| have hh := (plantedFieldArray_empirical β hβ).secondMoment | |
| (plantedFieldArray_squareTails β hβ) (plantedFieldLimitLaw_secondMoment β).1 | |
| rwa [(plantedFieldLimitLaw_secondMoment β).2] at hh | |
| lemma ExponentiallyRare.without_prefactor {H : ℕ → Type*} [∀ n, MeasurableSpace (H n)] | |
| {ρ : ∀ n, Measure (H n)} {A : ∀ n, Set (H n)} (hA : ExponentiallyRare ρ A) : | |
| ∃ c : ℝ, 0<c ∧ ∀ᶠ n in atTop, ρ n (A n) ≤ ENNReal.ofReal (Real.exp (-c*n)) := by | |
| obtain ⟨C,c,hC,hc,he⟩ := hA | |
| refine ⟨c/2,by positivity,?_⟩ | |
| have hnc := (tendsto_natCast_atTop_atTop : Tendsto (fun n : ℕ => (n:ℝ)) atTop atTop) | |
| filter_upwards [he,hnc.eventually (eventually_ge_atTop (2*Real.log C/c))] with n hn hsize | |
| apply hn.trans | |
| apply ENNReal.ofReal_le_ofReal | |
| rw [show C*Real.exp (-c*n)=Real.exp (Real.log C-c*n) by | |
| rw [Real.exp_sub,Real.exp_log hC,neg_mul,Real.exp_neg,div_eq_mul_inv] ] | |
| apply Real.exp_le_exp.mpr | |
| have hh := (div_le_iff₀ hc).mp hsize | |
| nlinarith | |
| noncomputable def spinFieldSquareAverage {n : ℕ} (x : Spin n) | |
| (g : GaussianCoordinates n) : ℝ := (∑ i, gaugedField x g i^2)/(n:ℝ) | |
| lemma continuous_spinFieldSquareAverage {n : ℕ} (x : Spin n) : | |
| Continuous (spinFieldSquareAverage x) := by | |
| change Continuous (fun g => (∑ i, gaugedField x g i^2)/(n:ℝ)) | |
| exact (continuous_finsetSum _ (fun i _ => | |
| ((continuous_apply i).comp (continuous_gaugedField x)).pow 2)).div_const _ | |
| lemma spinFieldSquareAverage_planted_exponential (β : ℝ) (hβ : 0<β) | |
| (ε : ℝ) (hε : 0<ε) : ∃ c : ℝ, 0<c ∧ ∀ᶠ n : ℕ in atTop, | |
| ∀ x : Spin n, singleSpinPlantedLaw β x {g | ε ≤ |spinFieldSquareAverage x g-(β^2+β^4)|} ≤ | |
| ENNReal.ofReal (Real.exp (-c*n)) := by | |
| obtain ⟨c,hc,ht⟩ := ((plantedFieldArray_secondMoment β hβ) ε hε).without_prefactor | |
| refine ⟨c,hc,?_⟩ | |
| filter_upwards [ht,eventually_ge_atTop 2] with n hn hn2 | |
| intro x | |
| have hE : MeasurableSet {v : Fin n → ℝ | ε ≤ |(∑ i, v i^2)/(n:ℝ)-(β^2+β^4)|} := by | |
| apply measurableSet_le measurable_const | |
| exact (((Finset.measurable_sum _ (fun i _ => (measurable_pi_apply i).pow_const 2)).div_const _).sub_const _).abs | |
| have he := planted_field_event_eq β hn2 x _ hE | |
| change singleSpinPlantedLaw β x {g | ε ≤ |spinFieldSquareAverage x g-(β^2+β^4)|} = _ at he | |
| rw [he] | |
| simpa only [Real.dist_eq,Set.preimage_ofPred_eq] using hn | |
| theorem quenched_spinFieldSquareAverage_exponential (β : ℝ) (hβ : 0<β) (hβ1 : β<1) | |
| (ε : ℝ) (hε : 0<ε) : ∃ c : ℝ, 0<c ∧ Tendsto (fun n => disorderLaw β n {g | | |
| ENNReal.ofReal (Real.exp (-c*n)) ≤ gibbsEventProbability | |
| (fun x : Spin n => {h | ε ≤ |spinFieldSquareAverage x h-(β^2+β^4)|}) g}) | |
| atTop (nhds 0) := by | |
| obtain ⟨c,hc,hs⟩ := spinFieldSquareAverage_planted_exponential β hβ ε hε | |
| refine ⟨c/2,by positivity,?_⟩ | |
| apply quenched_gibbs_events_exponential β (by nlinarith) c hc _ _ hs | |
| intro n x | |
| exact measurableSet_le measurable_const ((continuous_spinFieldSquareAverage x).measurable.sub_const _).abs | |
| lemma spinFieldSquareAverage_abs_le_opNorm_sq {n : ℕ} (hn : 0<n) (x : Spin n) | |
| (g : GaussianCoordinates n) : |spinFieldSquareAverage x g| ≤ | |
| ‖Matrix.toEuclideanCLM (n := Fin n) (𝕜 := ℝ) (sampledInteraction g)‖^2 := by | |
| have hh := matrix_mulVec_sq_bound (sampledInteraction g) (spin x) le_rfl | |
| have he : (∑ i, gaugedField x g i^2) = ∑ i, (sampledInteraction g *ᵥ spin x) i^2 := by | |
| simp only [gaugedField,mul_pow,spin_sq,one_mul,field,Matrix.mulVec,dotProduct] | |
| have hsum : (∑ i : Fin n, spin x i^2)=(n:ℝ) := by simp [spin_sq] | |
| rw [hsum] at hh | |
| rw [spinFieldSquareAverage,abs_of_nonneg (by positivity),he] | |
| exact (div_le_iff₀ (Nat.cast_pos.mpr hn)).mpr hh | |
| noncomputable def gibbsSpinFieldSquareAverage {n : ℕ} (g : GaussianCoordinates n) : ℝ := | |
| gibbsExpectation (sampledInteraction g) (fun x => spinFieldSquareAverage x g) | |
| theorem gibbsSpinFieldSquareAverage_limit (β : ℝ) (hβ : 0<β) (hβ1 : β<1) | |
| (ε : ℝ) (hε : 0<ε) : | |
| Tendsto (fun n => disorderLaw β n {g | ε ≤ |gibbsSpinFieldSquareAverage g-(β^2+β^4)|}) | |
| atTop (nhds 0) := by | |
| obtain ⟨c,hc,hevent⟩ := quenched_spinFieldSquareAverage_exponential β hβ hβ1 (ε/2) (by positivity) | |
| let C := 2*(β^2+10) | |
| let K := C^2+(β^2+β^4) | |
| have hK : 0 ≤ K := by dsimp [K,C]; positivity | |
| have hnorm := RandomMatrix.sampled_opNorm_tendsto β | |
| have ht : Tendsto (fun n : ℕ => K*Real.exp (-c*n)) atTop (nhds 0) := by | |
| have hh := Real.tendsto_exp_neg_atTop_nhds_zero.comp | |
| ((tendsto_natCast_atTop_atTop : Tendsto (fun n : ℕ => (n:ℝ)) atTop atTop).const_mul_atTop hc) | |
| simpa only [Function.comp_apply,neg_mul,mul_zero] using hh.const_mul K | |
| have hsum := hnorm.add hevent | |
| simp only [add_zero] at hsum | |
| apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hsum | |
| (Eventually.of_forall (fun _ => bot_le)) | |
| filter_upwards [eventually_gt_atTop 0,ht.eventually (gt_mem_nhds (by positivity : (0:ℝ)<ε/2))] | |
| with n hn hsmall | |
| apply (measure_mono (show {g | ε ≤ |gibbsSpinFieldSquareAverage g-(β^2+β^4)|} ⊆ | |
| {g | C < ‖Matrix.toEuclideanCLM (n := Fin n) (𝕜 := ℝ) (sampledInteraction g)‖} ∪ | |
| {g | ENNReal.ofReal (Real.exp (-c*n)) ≤ | |
| gibbsEventProbability (fun x : Spin n => {h | ε/2 ≤ |spinFieldSquareAverage x h-(β^2+β^4)|}) g} from ?_)).trans | |
| (measure_union_le _ _) | |
| intro g hg | |
| by_cases ha : C < ‖Matrix.toEuclideanCLM (n := Fin n) (𝕜 := ℝ) (sampledInteraction g)‖ | |
| · exact Or.inl ha | |
| by_cases hb : ENNReal.ofReal (Real.exp (-c*n)) ≤ | |
| gibbsEventProbability (fun x : Spin n => {h | ε/2 ≤ |spinFieldSquareAverage x h-(β^2+β^4)|}) g | |
| · exact Or.inr hb | |
| exfalso | |
| have hp : (gibbsEventProbability (fun x : Spin n => {h | ε/2 ≤ |spinFieldSquareAverage x h-(β^2+β^4)|}) g).toReal | |
| ≤ Real.exp (-c*n) := by | |
| have hh := ENNReal.toReal_mono (show ENNReal.ofReal (Real.exp (-c*n))≠⊤ from ENNReal.ofReal_ne_top) | |
| (lt_of_not_ge hb).le | |
| simpa only [ENNReal.toReal_ofReal (Real.exp_pos _).le] using hh | |
| have hdev := gibbsExpectation_deviation_bound g | |
| (fun x h => spinFieldSquareAverage x h) ((β^2+β^4)) (ε/2) K (by positivity) (fun x => by | |
| calc | |
| _ ≤ |spinFieldSquareAverage x g|+|(β^2+β^4)| := by simpa only [sub_zero,zero_sub,abs_neg] using abs_sub_le (spinFieldSquareAverage x g) (0:ℝ) ((β^2+β^4)) | |
| _ ≤ C^2+(β^2+β^4) := by | |
| rw [abs_of_nonneg (by positivity : 0≤β^2+β^4)] | |
| exact add_le_add_left ((spinFieldSquareAverage_abs_le_opNorm_sq hn x g).trans | |
| (pow_le_pow_left₀ (norm_nonneg _) (le_of_not_gt ha) 2)) _) | |
| change ε ≤ |gibbsExpectation (sampledInteraction g) (fun x => spinFieldSquareAverage x g)-(β^2+β^4)| at hg | |
| have he := mul_le_mul_of_nonneg_left hp hK | |
| linarith | |
| end SKGapCutoff.Regression | |
| open MeasureTheory ProbabilityTheory Filter Matrix | |
| open scoped BigOperators ENNReal Matrix.Norms.L2Operator | |
| end | |
| end OAI | |