Download lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 5.25 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean
-
curl -L -o BaseGaussianVariance.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/Probability/InvariantIsing/Gaussian/BaseGaussianVariance.lean
5.25 kB
| import OAI.Probability.InvariantIsing.Gaussian.CountableGaussianVariance | |
| namespace OAI | |
| /-! Gaussian variance for the countable spin/leaf partition with base energy. -/ | |
| noncomputable section | |
| open MeasureTheory ProbabilityTheory IsingPerceptron | |
| open scoped NNReal | |
| namespace InvariantIsing | |
| lemma cylinder_cgf_memLp_two {X : Type*} [MeasurableSpace X] [Countable X] | |
| [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] | |
| (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) | |
| (t : ℝ) : | |
| MemLp (fun g : ℕ → ℝ => cgf (fun x => cylinderField (A x) g) ν t) | |
| 2 gaussianCoordinates := by | |
| let H := fun p : (ℕ → ℝ) × X => t * cylinderField (A p.2) p.1 | |
| have hH : Measurable H := (measurable_cylinderFields A).const_mul t | |
| have hLaw (x : X) : gaussianCoordinates.map (fun g => H (g, x)) = | |
| gaussianReal 0 (⟨t ^ 2, sq_nonneg t⟩ * (((A x).sum (fun _ c => c ^ 2)).toNNReal)) := | |
| cylinder_scaled_law A x t | |
| have hVar (x : X) : | |
| ((⟨t ^ 2, sq_nonneg t⟩ : ℝ≥0) * (((A x).sum (fun _ c => c ^ 2)).toNNReal) : ℝ) ≤ t ^ 2 * B := by | |
| change t ^ 2 * (((A x).sum (fun _ c => c ^ 2)).toNNReal : ℝ) ≤ _ | |
| rw [Real.coe_toNNReal _ (show 0 ≤ (A x).sum (fun _ c => c ^ 2) from | |
| Finset.sum_nonneg (fun _ _ => sq_nonneg _))] | |
| exact mul_le_mul_of_nonneg_left (hA x) (sq_nonneg t) | |
| exact (memLp_two_iff_integrable_sq | |
| hH.exp.stronglyMeasurable.integral_prod_right'.measurable.log.aestronglyMeasurable).mpr | |
| (gaussian_log_partition_second (ν := ν) hH hLaw hVar).1 | |
| /-- Splitting off a fixed integrable base energy is an almost-everywhere | |
| identity for the actual countable Gaussian partition, including nonuniform | |
| and cascade-leaf weights. -/ | |
| lemma cylinder_log_partition_base {X : Type*} [MeasurableSpace X] [Countable X] | |
| [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] | |
| (H : X → ℝ) (hH : Integrable (fun x => Real.exp (H x)) ν) | |
| (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) : | |
| (fun g : ℕ → ℝ => Real.log (∫ x, Real.exp (H x + t * cylinderField (A x) g) ∂ν)) | |
| =ᵐ[gaussianCoordinates] | |
| (fun g => Real.log (∫ x, Real.exp (H x) ∂ν) + | |
| cgf (fun x => cylinderField (A x) g) (ν.tilted H) t) := by | |
| have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH | |
| have hVar (x : X) : (((A x).sum (fun _ c => c ^ 2)).toNNReal : ℝ) ≤ B := by | |
| rw [Real.coe_toNNReal _ (show 0 ≤ (A x).sum (fun _ c => c ^ 2) from | |
| Finset.sum_nonneg (fun _ _ => sq_nonneg _))] | |
| exact hA x | |
| have he := (gaussian_field_exp_integrable (ν := ν.tilted H) | |
| (measurable_cylinderFields A) (fun x => cylinderField_law (A x)) hVar t).1.prod_right_ae | |
| filter_upwards [he] with g hg | |
| have hz : 0 < ∫ x, Real.exp (H x) ∂ν := integral_exp_pos hH | |
| have hz' : 0 < ∫ x, Real.exp (t * cylinderField (A x) g) ∂ν.tilted H := integral_exp_pos hg | |
| have hi := integral_exp_tilted (μ := ν) H (fun x => t * cylinderField (A x) g) | |
| have hid : (∫ x, Real.exp (H x + t * cylinderField (A x) g) ∂ν) = | |
| (∫ x, Real.exp (H x) ∂ν) * | |
| (∫ x, Real.exp (t * cylinderField (A x) g) ∂ν.tilted H) := by | |
| rw [hi] | |
| simp only [Pi.add_apply] | |
| field_simp | |
| rw [hid, Real.log_mul hz.ne' hz'.ne'] | |
| rfl | |
| lemma cylinder_log_partition_memLp_two {X : Type*} [MeasurableSpace X] [Countable X] | |
| [MeasurableSingletonClass X] (ν : Measure X) [IsProbabilityMeasure ν] | |
| (H : X → ℝ) (hH : Integrable (fun x => Real.exp (H x)) ν) | |
| (A : X → ℕ →₀ ℝ) {B : ℝ} (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) : | |
| MemLp (fun g : ℕ → ℝ => Real.log | |
| (∫ x, Real.exp (H x + t * cylinderField (A x) g) ∂ν)) 2 gaussianCoordinates := by | |
| have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH | |
| have he := cylinder_log_partition_base ν H hH A hA t | |
| exact MemLp.ae_eq (Filter.EventuallyEq.symm he) | |
| ((memLp_const (Real.log (∫ x, Real.exp (H x) ∂ν))).add | |
| (cylinder_cgf_memLp_two (ν.tilted H) A hA t)) | |
| /-- The actual countable Gaussian partition with arbitrary integrable base | |
| energy has the same coefficient variance bound. This is conditional only on | |
| the specified published Gaussian Poincaré consequence. -/ | |
| theorem countable_cylinder_log_partition_variance_le (hpub : GaussianLipschitzVarianceInput) | |
| {X : Type*} [MeasurableSpace X] [Countable X] [MeasurableSingletonClass X] | |
| (ν : Measure X) [IsProbabilityMeasure ν] (H : X → ℝ) | |
| (hH : Integrable (fun x => Real.exp (H x)) ν) | |
| (A : X → ℕ →₀ ℝ) (B : ℝ) (hB : 0 ≤ B) | |
| (hA : ∀ x, (A x).sum (fun _ c => c ^ 2) ≤ B) (t : ℝ) : | |
| variance (fun g : ℕ → ℝ => Real.log | |
| (∫ x, Real.exp (H x + t * cylinderField (A x) g) ∂ν)) gaussianCoordinates ≤ t ^ 2 * B := by | |
| have : IsProbabilityMeasure (ν.tilted H) := isProbabilityMeasure_tilted hH | |
| have he := cylinder_log_partition_base ν H hH A hA t | |
| rw [variance_congr he, variance_const_add (cylinder_cgf_memLp_two (ν.tilted H) A hA t).aestronglyMeasurable] | |
| exact countable_cylinder_cgf_variance_le hpub (ν.tilted H) A B hB hA t | |
| end InvariantIsing | |
| end | |
| end OAI | |